mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9620 Pressure/depth data: add user interface.
This commit is contained in:
@@ -76,6 +76,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderOpmRft.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRftSegment.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifPressureDepthTextFileReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderPressureDepthData.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -153,6 +154,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderOpmRft.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRftSegment.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifPressureDepthTextFileReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderPressureDepthData.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimObservedFmuRftData.h"
|
||||
#include "RimPressureDepthData.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimWellLogFile.h"
|
||||
@@ -100,6 +101,17 @@ RifDataSourceForRftPlt::RifDataSourceForRftPlt( SourceType sourceType, RimObserv
|
||||
m_observedFmuRftData = observedFmuRftData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifDataSourceForRftPlt::RifDataSourceForRftPlt( SourceType sourceType, RimPressureDepthData* observedFmuRftData )
|
||||
{
|
||||
CVF_ASSERT( sourceType == SourceType::OBSERVED_FMU_RFT );
|
||||
|
||||
m_sourceType = sourceType;
|
||||
m_pressureDepthData = observedFmuRftData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -170,6 +182,14 @@ RimObservedFmuRftData* RifDataSourceForRftPlt::observedFmuRftData() const
|
||||
return m_observedFmuRftData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPressureDepthData* RifDataSourceForRftPlt::pressureDepthData() const
|
||||
{
|
||||
return m_pressureDepthData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -35,6 +35,7 @@ class RifReaderRftInterface;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimObservedFmuRftData;
|
||||
class RimPressureDepthData;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -60,6 +61,7 @@ public:
|
||||
RifDataSourceForRftPlt( SourceType sourceType, RimSummaryCase* summaryCase, RimSummaryCaseCollection* ensemble );
|
||||
RifDataSourceForRftPlt( SourceType sourceType, RimWellLogFile* wellLogFile = nullptr );
|
||||
RifDataSourceForRftPlt( SourceType sourceType, RimObservedFmuRftData* observedFmuRftData );
|
||||
RifDataSourceForRftPlt( SourceType sourceType, RimPressureDepthData* pressureDepthData );
|
||||
|
||||
SourceType sourceType() const;
|
||||
RimEclipseCase* eclCase() const;
|
||||
@@ -68,6 +70,7 @@ public:
|
||||
RimSummaryCase* summaryCase() const;
|
||||
RimWellLogFile* wellLogFile() const;
|
||||
RimObservedFmuRftData* observedFmuRftData() const;
|
||||
RimPressureDepthData* pressureDepthData() const;
|
||||
|
||||
static QString sourceTypeUiText( SourceType sourceType );
|
||||
|
||||
@@ -81,9 +84,10 @@ private:
|
||||
caf::PdmPointer<RimSummaryCaseCollection> m_ensemble;
|
||||
caf::PdmPointer<RimWellLogFile> m_wellLogFile;
|
||||
caf::PdmPointer<RimObservedFmuRftData> m_observedFmuRftData;
|
||||
caf::PdmPointer<RimPressureDepthData> m_pressureDepthData;
|
||||
};
|
||||
|
||||
bool operator==( const RifDataSourceForRftPlt& addr1, const RifDataSourceForRftPlt& addr2 );
|
||||
QTextStream& operator<<( QTextStream& str, const RifDataSourceForRftPlt& addr );
|
||||
QTextStream& operator>>( QTextStream& str, RifDataSourceForRftPlt& addr );
|
||||
bool operator<( const RifDataSourceForRftPlt& addr1, const RifDataSourceForRftPlt& addr2 );
|
||||
bool operator<( const RifDataSourceForRftPlt& addr1, const RifDataSourceForRftPlt& addr2 );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RifPressureDepthTextFileReader.h"
|
||||
|
||||
#include "RiaDateStringParser.h"
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RigPressureDepthData.h"
|
||||
@@ -52,12 +53,15 @@ std::pair<std::vector<RigPressureDepthData>, QString> RifPressureDepthTextFileRe
|
||||
{
|
||||
QStringList headerValues = RifFileParseTools::splitLineAndTrim( line, separator );
|
||||
RigPressureDepthData data;
|
||||
data.setWellName( headerValues[1] );
|
||||
data.setWellName( headerValues[1].replace( "'", "" ) );
|
||||
items.push_back( data );
|
||||
}
|
||||
else if ( isDateLine( line ) )
|
||||
{
|
||||
// TODO: parse date
|
||||
if ( std::optional<QDateTime> date = parseDateLine( line ) )
|
||||
{
|
||||
items.back().setTimeStep( date.value() );
|
||||
}
|
||||
}
|
||||
else if ( isPropertiesLine( line ) || isUnitsLine( line ) || isCommentLine( line ) )
|
||||
{
|
||||
@@ -135,3 +139,21 @@ std::optional<std::pair<double, double>> RifPressureDepthTextFileReader::parseDa
|
||||
|
||||
return std::make_pair( pressure, depth );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::optional<QDateTime> RifPressureDepthTextFileReader::parseDateLine( const QString& line )
|
||||
{
|
||||
// Expect two data values separated by one space
|
||||
QStringList values = RifFileParseTools::splitLineAndTrim( line, " " );
|
||||
if ( values.size() != 2 ) return {};
|
||||
|
||||
CAF_ASSERT( values[0] == "DATE" );
|
||||
|
||||
// Second value is depth
|
||||
QDateTime dateTime = RiaDateStringParser::parseDateString( values[1], RiaDateStringParser::OrderPreference::DAY_FIRST );
|
||||
if ( !dateTime.isValid() ) return {};
|
||||
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
@@ -42,4 +43,5 @@ private:
|
||||
static bool isUnitsLine( const QString& line );
|
||||
|
||||
static std::optional<std::pair<double, double>> parseDataLine( const QString& line );
|
||||
static std::optional<QDateTime> parseDateLine( const QString& line );
|
||||
};
|
||||
|
||||
221
ApplicationLibCode/FileInterface/RifReaderPressureDepthData.cpp
Normal file
221
ApplicationLibCode/FileInterface/RifReaderPressureDepthData.cpp
Normal file
@@ -0,0 +1,221 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RifReaderPressureDepthData.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RifPressureDepthTextFileReader.h"
|
||||
|
||||
#include "cafAssert.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderPressureDepthData::RifReaderPressureDepthData( const QString& filePath )
|
||||
: m_filePath( filePath )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RifReaderPressureDepthData::labels( const RifEclipseRftAddress& rftAddress )
|
||||
{
|
||||
std::vector<QString> formationLabels;
|
||||
|
||||
if ( m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
for ( const RigPressureDepthData& pressureDepthData : m_pressureDepthDataItems )
|
||||
{
|
||||
if ( rftAddress.wellName() == pressureDepthData.wellName() &&
|
||||
rftAddress.timeStep().date() == pressureDepthData.timeStep().date() )
|
||||
{
|
||||
formationLabels.push_back( QString( "%1 - Pressure: %2" )
|
||||
.arg( pressureDepthData.wellName() )
|
||||
.arg( pressureDepthData.timeStep().toString() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return formationLabels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseRftAddress> RifReaderPressureDepthData::eclipseRftAddresses()
|
||||
{
|
||||
if ( m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
std::set<RifEclipseRftAddress> allAddresses;
|
||||
for ( const RigPressureDepthData& pressureDepthData : m_pressureDepthDataItems )
|
||||
{
|
||||
const QString& wellName = pressureDepthData.wellName();
|
||||
const QDateTime& dateTime = pressureDepthData.timeStep();
|
||||
|
||||
RifEclipseRftAddress tvdAddress =
|
||||
RifEclipseRftAddress::createAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::TVD );
|
||||
RifEclipseRftAddress pressureAddress =
|
||||
RifEclipseRftAddress::createAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
|
||||
allAddresses.insert( tvdAddress );
|
||||
allAddresses.insert( pressureAddress );
|
||||
}
|
||||
|
||||
return allAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderPressureDepthData::values( const RifEclipseRftAddress& rftAddress, std::vector<double>* values )
|
||||
{
|
||||
CAF_ASSERT( values );
|
||||
|
||||
if ( m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
for ( const RigPressureDepthData& pressureDepthData : m_pressureDepthDataItems )
|
||||
{
|
||||
if ( rftAddress.wellName() == pressureDepthData.wellName() &&
|
||||
rftAddress.timeStep().date() == pressureDepthData.timeStep().date() )
|
||||
{
|
||||
switch ( rftAddress.wellLogChannel() )
|
||||
{
|
||||
case RifEclipseRftAddress::RftWellLogChannelType::TVD:
|
||||
*values = pressureDepthData.tvdmsl();
|
||||
break;
|
||||
case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE:
|
||||
*values = pressureDepthData.pressure();
|
||||
break;
|
||||
default:
|
||||
*values = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderPressureDepthData::load()
|
||||
{
|
||||
auto [pressureDepthDataItems, errorMsg] = RifPressureDepthTextFileReader::readFile( m_filePath );
|
||||
if ( !errorMsg.isEmpty() )
|
||||
{
|
||||
RiaLogging::error( errorMsg );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pressureDepthDataItems = pressureDepthDataItems;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QDateTime>
|
||||
RifReaderPressureDepthData::availableTimeSteps( const QString& wellName,
|
||||
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName )
|
||||
{
|
||||
if ( wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::TVD ||
|
||||
wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE )
|
||||
{
|
||||
return availableTimeSteps( wellName );
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QDateTime> RifReaderPressureDepthData::availableTimeSteps( const QString& wellName )
|
||||
{
|
||||
if ( m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
std::set<QDateTime> timeSteps;
|
||||
for ( const RigPressureDepthData& pressureDepthData : m_pressureDepthDataItems )
|
||||
{
|
||||
if ( wellName == pressureDepthData.wellName() )
|
||||
{
|
||||
timeSteps.insert( pressureDepthData.timeStep() );
|
||||
}
|
||||
}
|
||||
return timeSteps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QDateTime> RifReaderPressureDepthData::availableTimeSteps(
|
||||
const QString& wellName,
|
||||
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels )
|
||||
{
|
||||
if ( relevantChannels.count( RifEclipseRftAddress::RftWellLogChannelType::TVD ) ||
|
||||
relevantChannels.count( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) )
|
||||
{
|
||||
return availableTimeSteps( wellName );
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseRftAddress::RftWellLogChannelType>
|
||||
RifReaderPressureDepthData::availableWellLogChannels( const QString& wellName )
|
||||
{
|
||||
if ( m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
if ( !m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
return { RifEclipseRftAddress::RftWellLogChannelType::TVD, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE };
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RifReaderPressureDepthData::wellNames()
|
||||
{
|
||||
if ( m_pressureDepthDataItems.empty() )
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
std::set<QString> wellNames;
|
||||
for ( const RigPressureDepthData& pressureDepthData : m_pressureDepthDataItems )
|
||||
{
|
||||
wellNames.insert( pressureDepthData.wellName() );
|
||||
}
|
||||
return wellNames;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseRftAddress.h"
|
||||
#include "RifReaderRftInterface.h"
|
||||
|
||||
#include "RigPressureDepthData.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifReaderPressureDepthData : public RifReaderRftInterface, public cvf::Object
|
||||
{
|
||||
public:
|
||||
RifReaderPressureDepthData( const QString& filePath );
|
||||
~RifReaderPressureDepthData() override = default;
|
||||
|
||||
std::vector<QString> labels( const RifEclipseRftAddress& rftAddress );
|
||||
|
||||
std::set<RifEclipseRftAddress> eclipseRftAddresses() override;
|
||||
void values( const RifEclipseRftAddress& rftAddress, std::vector<double>* values ) override;
|
||||
|
||||
std::set<QDateTime>
|
||||
availableTimeSteps( const QString& wellName,
|
||||
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& relevantChannels ) override;
|
||||
std::set<QDateTime> availableTimeSteps( const QString& wellName ) override;
|
||||
std::set<QDateTime> availableTimeSteps( const QString& wellName,
|
||||
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) override;
|
||||
|
||||
std::set<RifEclipseRftAddress::RftWellLogChannelType> availableWellLogChannels( const QString& wellName ) override;
|
||||
std::set<QString> wellNames() override;
|
||||
|
||||
void load();
|
||||
|
||||
private:
|
||||
QString m_filePath;
|
||||
std::vector<RigPressureDepthData> m_pressureDepthDataItems;
|
||||
};
|
||||
Reference in New Issue
Block a user