#9620 Pressure/depth data: add user interface.

This commit is contained in:
Kristian Bendiksen 2023-01-13 15:26:39 +01:00
parent 10187a934c
commit 1eac9f8a1f
24 changed files with 883 additions and 15 deletions

View File

@ -86,6 +86,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteUncheckedSubItemsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRenameSummaryCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportPressureDepthDataFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -175,6 +176,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteUncheckedSubItemsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRenameSummaryCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportPressureDepthDataFeature.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@ -0,0 +1,100 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicImportPressureDepthDataFeature.h"
#include "RiaApplication.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RicImportFormationNamesFeature.h"
#include "RifReaderFmuRft.h"
#include "RimFormationNames.h"
#include "RimObservedDataCollection.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h"
#include "RimPressureDepthData.h"
#include "RimProject.h"
#include "RiuFileDialogTools.h"
#include "RiuPlotMainWindowTools.h"
#include "cafPdmObject.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QDir>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT( RicImportPressureDepthDataFeature, "RicImportPressureDepthDataFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportPressureDepthDataFeature::selectPressureDepthDataPathInDialog()
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "SUMMARY_CASE_DIR" );
QString filePath = RiuFileDialogTools::getOpenFileName( nullptr, "Import Pressure/Depth Data", defaultDir );
RimProject* proj = app->project();
RimObservedDataCollection* observedDataCollection =
proj->activeOilField() ? proj->activeOilField()->observedDataCollection() : nullptr;
if ( !observedDataCollection ) return;
const RimPressureDepthData* importedData = observedDataCollection->createAndAddPressureDepthDataFromPath( filePath );
if ( importedData != nullptr )
{
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( importedData );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportPressureDepthDataFeature::isCommandEnabled()
{
std::vector<RimObservedDataCollection*> selectionObservedDataCollection;
caf::SelectionManager::instance()->objectsByType( &selectionObservedDataCollection );
std::vector<RimObservedSummaryData*> selectionObservedData;
caf::SelectionManager::instance()->objectsByType( &selectionObservedData );
return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportPressureDepthDataFeature::onActionTriggered( bool isChecked )
{
selectPressureDepthDataPathInDialog();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportPressureDepthDataFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/ObservedDataFile16x16.png" ) );
actionToSetup->setText( "Import Pressure Depth Data" );
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicImportPressureDepthDataFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void selectPressureDepthDataPathInDialog();
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -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})

View File

@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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,6 +84,7 @@ 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 );

View File

@ -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;
}

View File

@ -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 );
};

View 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;
}

View File

@ -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;
};

View File

@ -129,6 +129,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimRoffCase.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.h
${CMAKE_CURRENT_LIST_DIR}/RimMultipleEclipseResults.h
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -257,6 +258,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimRoffCase.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultipleEclipseResults.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@ -32,6 +32,7 @@
#include "RimObservedDataCollection.h"
#include "RimObservedFmuRftData.h"
#include "RimOilField.h"
#include "RimPressureDepthData.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
@ -486,6 +487,39 @@ std::vector<RimObservedFmuRftData*> RimWellPlotTools::observedFmuRftData()
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPressureDepthData*> RimWellPlotTools::pressureDepthDataForWell( const QString& simWellName )
{
std::vector<RimPressureDepthData*> observedDataForWell;
std::vector<RimPressureDepthData*> allObservedData = pressureDepthData();
for ( RimPressureDepthData* observedData : allObservedData )
{
if ( observedData->hasWell( simWellName ) )
{
observedDataForWell.push_back( observedData );
}
}
return observedDataForWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPressureDepthData*> RimWellPlotTools::pressureDepthData()
{
const RimProject* project = RimProject::current();
RimObservedDataCollection* observedDataCollection =
project->activeOilField() ? project->activeOilField()->observedDataCollection() : nullptr;
if ( observedDataCollection )
{
return observedDataCollection->allPressureDepthData();
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -588,6 +622,7 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
RimSummaryCase* rftSummaryCase = rftCurve->summaryCase();
RimSummaryCaseCollection* rftEnsemble = rftCurve->ensemble();
RimObservedFmuRftData* rftFmuData = rftCurve->observedFmuRftData();
RimPressureDepthData* pressureDepthData = rftCurve->pressureDepthData();
const RifEclipseRftAddress rftAddress = rftCurve->rftAddress();
const QString& wellName = rftAddress.wellName();
@ -620,6 +655,13 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
wellName,
timeStep );
}
else if ( pressureDepthData != nullptr )
{
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED_FMU_RFT,
pressureDepthData ),
wellName,
timeStep );
}
}
else if ( gridCurve != nullptr )
{
@ -765,6 +807,20 @@ std::set<RiaRftPltCurveDefinition>
}
}
}
RimPressureDepthData* pressureDepthData = addr.pressureDepthData();
if ( pressureDepthData && pressureDepthData->rftReader() )
{
std::set<QDateTime> timeSteps =
pressureDepthData->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
for ( const QDateTime& time : timeSteps )
{
if ( selectedTimeStepSet.count( time ) )
{
curveDefs.insert( RiaRftPltCurveDefinition( addr, wellPathNameOrSimWellName, time ) );
}
}
}
}
else if ( addr.ensemble() )
{
@ -1082,7 +1138,10 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::calculat
{
observedTimeStepsWithSources[source.wellLogFile()->date()].insert( source );
}
else if ( source.sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT && source.observedFmuRftData() )
else if ( source.sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT )
{
{
if ( source.observedFmuRftData() )
{
std::set<QDateTime> rftFmuTimes =
source.observedFmuRftData()->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
@ -1091,6 +1150,17 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::calculat
observedTimeStepsWithSources[date].insert( source );
}
}
else if ( source.pressureDepthData() )
{
std::set<QDateTime> rftFmuTimes =
source.pressureDepthData()->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
for ( const QDateTime& date : rftFmuTimes )
{
observedTimeStepsWithSources[date].insert( source );
}
}
}
}
}
}

View File

@ -39,6 +39,7 @@ class RimWellLogCurve;
class RimWellLogFileChannel;
class RimWellLogPlot;
class RimWellPath;
class RimPressureDepthData;
class RiuWellRftPlot;
class RigEclipseCaseData;
class RigEclipseResultAddress;
@ -134,6 +135,9 @@ public:
static bool hasFlowData( const RimWellPath* wellPath );
static std::vector<RimPressureDepthData*> pressureDepthData();
static std::vector<RimPressureDepthData*> pressureDepthDataForWell( const QString& simWellName );
private:
friend class StaticFieldsInitializer;
static const std::set<QString> PRESSURE_DATA_NAMES;

View File

@ -38,6 +38,7 @@
#include "RimEnsembleCurveSetColorManager.h"
#include "RimObservedFmuRftData.h"
#include "RimOilField.h"
#include "RimPressureDepthData.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "RimSummaryCaseCollection.h"
@ -516,11 +517,18 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
else if ( curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT )
{
auto curve = new RimWellLogRftCurve();
curve->setErrorBarsVisible( m_showErrorInObservedData );
plotTrack->addCurve( curve );
auto observedFmuRftData = curveDefToAdd.address().observedFmuRftData();
if ( auto observedFmuRftData = curveDefToAdd.address().observedFmuRftData() )
{
curve->setErrorBarsVisible( m_showErrorInObservedData );
curve->setObservedFmuRftData( observedFmuRftData );
}
else if ( auto pressureDepthData = curveDefToAdd.address().pressureDepthData() )
{
curve->setPressureDepthData( pressureDepthData );
}
RifEclipseRftAddress address =
RifEclipseRftAddress::createAddress( m_wellPathNameOrSimWellName,
curveDefToAdd.timeStep(),
@ -851,6 +859,22 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions( const caf::
options.push_back( item );
}
}
const std::vector<RimPressureDepthData*> pressureDepthData =
RimWellPlotTools::pressureDepthDataForWell( m_wellPathNameOrSimWellName );
if ( !pressureDepthData.empty() )
{
options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText(
RifDataSourceForRftPlt::OBSERVED_FMU_RFT ),
true ) );
for ( const auto& pd : pressureDepthData )
{
auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED_FMU_RFT, pd );
auto item = caf::PdmOptionItemInfo( pd->name(), QVariant::fromValue( addr ) );
item.setLevel( 1 );
options.push_back( item );
}
}
}
else if ( fieldNeedingOptions == &m_selectedTimeSteps )
{

View File

@ -1131,6 +1131,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicImportObservedDataFeature";
menuBuilder << "RicImportObservedFmuDataFeature";
menuBuilder << "RicImportPressureDepthDataFeature";
menuBuilder << "RicRenameSummaryCaseFeature";
menuBuilder << "RicReloadSummaryCaseFeature";
menuBuilder << "RicReplaceSummaryCaseFeature";

View File

@ -29,6 +29,7 @@
#include "RimObservedEclipseUserData.h"
#include "RimObservedFmuRftData.h"
#include "RimObservedSummaryData.h"
#include "RimPressureDepthData.h"
#include "RimProject.h"
#include "RimSummaryObservedDataFile.h"
@ -53,8 +54,10 @@ RimObservedDataCollection::RimObservedDataCollection()
CAF_PDM_InitFieldNoDefault( &m_observedDataArray, "ObservedDataArray", "" );
CAF_PDM_InitFieldNoDefault( &m_observedFmuRftArray, "ObservedFmuRftDataArray", "" );
CAF_PDM_InitFieldNoDefault( &m_observedPressureDepthArray, "PressureDepthDataArray", "" );
m_observedDataArray.uiCapability()->setUiTreeHidden( true );
m_observedFmuRftArray.uiCapability()->setUiTreeHidden( true );
m_observedPressureDepthArray.uiCapability()->setUiTreeHidden( true );
}
//--------------------------------------------------------------------------------------------------
@ -64,6 +67,7 @@ RimObservedDataCollection::~RimObservedDataCollection()
{
m_observedDataArray.deleteChildren();
m_observedFmuRftArray.deleteChildren();
m_observedPressureDepthArray.deleteChildren();
}
//--------------------------------------------------------------------------------------------------
@ -100,6 +104,14 @@ std::vector<RimObservedFmuRftData*> RimObservedDataCollection::allObservedFmuRft
return m_observedFmuRftArray.children();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPressureDepthData*> RimObservedDataCollection::allPressureDepthData() const
{
return m_observedPressureDepthArray.children();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -249,3 +261,22 @@ RimObservedFmuRftData* RimObservedDataCollection::createAndAddFmuRftDataFromPath
return fmuRftData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureDepthData* RimObservedDataCollection::createAndAddPressureDepthDataFromPath( const QString& filePath )
{
QString name = QString( "Imported Pressure/Depth Data %1" ).arg( m_observedPressureDepthArray.size() + 1 );
RimPressureDepthData* data = new RimPressureDepthData;
data->setFilePath( filePath );
data->createRftReaderInterface();
data->setName( name );
m_observedPressureDepthArray.push_back( data );
updateNewObservedDataCreated( data );
this->updateConnectedEditors();
return data;
}

View File

@ -23,7 +23,7 @@
class RimObservedFmuRftData;
class RimObservedSummaryData;
class QFile;
class RimPressureDepthData;
//--------------------------------------------------------------------------------------------------
///
@ -44,8 +44,10 @@ public:
bool useSavedFieldsValuesInDialog,
QString* errorText = nullptr );
RimObservedFmuRftData* createAndAddFmuRftDataFromPath( const QString& directoryPath );
RimPressureDepthData* createAndAddPressureDepthDataFromPath( const QString& fileName );
std::vector<RimObservedSummaryData*> allObservedSummaryData() const;
std::vector<RimObservedFmuRftData*> allObservedFmuRftData() const;
std::vector<RimPressureDepthData*> allPressureDepthData() const;
private:
bool fileExists( const QString& fileName, QString* errorText = nullptr );
@ -53,4 +55,5 @@ private:
private:
caf::PdmChildArrayField<RimObservedSummaryData*> m_observedDataArray;
caf::PdmChildArrayField<RimObservedFmuRftData*> m_observedFmuRftArray;
caf::PdmChildArrayField<RimPressureDepthData*> m_observedPressureDepthArray;
};

View File

@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimPressureDepthData.h"
//==================================================================================================
//
//
//
//==================================================================================================
CAF_PDM_SOURCE_INIT( RimPressureDepthData, "ObservedPressureDepthData" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureDepthData::RimPressureDepthData()
{
CAF_PDM_InitObject( "Observed Pressure/Depth Data", ":/ObservedRFTDataFile16x16.png" );
CAF_PDM_InitFieldNoDefault( &m_filePath, "File", "File" );
m_filePath.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_wells, "Wells", "Wells" );
m_wells.xmlCapability()->disableIO();
m_wells.uiCapability()->setUiReadOnly( true );
m_wells.registerGetMethod( this, &RimPressureDepthData::wells );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureDepthData::setFilePath( const QString& path )
{
m_filePath = path;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureDepthData::createRftReaderInterface()
{
m_fmuRftReader = new RifReaderPressureDepthData( m_filePath );
m_fmuRftReader->load();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderRftInterface* RimPressureDepthData::rftReader()
{
if ( m_fmuRftReader.isNull() )
{
createRftReaderInterface();
}
return m_fmuRftReader.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPressureDepthData::hasWell( const QString& wellPathName ) const
{
std::vector<QString> allWells = wells();
for ( const QString& well : allWells )
{
if ( well == wellPathName )
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimPressureDepthData::wells() const
{
if ( m_fmuRftReader.p() )
{
std::set<QString> wellNames = const_cast<RifReaderPressureDepthData*>( m_fmuRftReader.p() )->wellNames();
return std::vector<QString>( wellNames.begin(), wellNames.end() );
}
return std::vector<QString>();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimPressureDepthData::labels( const RifEclipseRftAddress& rftAddress )
{
if ( m_fmuRftReader.p() )
{
return const_cast<RifReaderPressureDepthData*>( m_fmuRftReader.p() )->labels( rftAddress );
}
return {};
}

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifReaderFmuRft.h"
#include "RimNamedObject.h"
#include "RifReaderPressureDepthData.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
class RimPressureDepthData : public RimNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimPressureDepthData();
void setFilePath( const QString& path );
void createRftReaderInterface();
RifReaderRftInterface* rftReader();
bool hasWell( const QString& wellPathName ) const;
std::vector<QString> wells() const;
std::vector<QString> labels( const RifEclipseRftAddress& rftAddress );
private:
cvf::ref<RifReaderPressureDepthData> m_fmuRftReader;
caf::PdmField<QString> m_filePath;
caf::PdmProxyValueField<std::vector<QString>> m_wells;
};

View File

@ -161,6 +161,9 @@ RimWellLogRftCurve::RimWellLogRftCurve()
CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU RFT Data" );
m_observedFmuRftData.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_pressureDepthData, "PressureDepthData", "Pressure Depth Data" );
m_pressureDepthData.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step" );
CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" );
@ -320,6 +323,22 @@ RimObservedFmuRftData* RimWellLogRftCurve::observedFmuRftData() const
return m_observedFmuRftData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setPressureDepthData( RimPressureDepthData* observedFmuRftData )
{
m_pressureDepthData = observedFmuRftData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureDepthData* RimWellLogRftCurve::pressureDepthData() const
{
return m_pressureDepthData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -671,6 +690,12 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC;
perPointLabels = this->perPointLabels();
}
else if ( m_pressureDepthData )
{
// TODO: Read unit system for pressure data
unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC;
// perPointLabels = this->perPointLabels();
}
else
{
CVF_ASSERT( false && "Need to have either an eclipse result case, a summary case or an ensemble" );
@ -1002,6 +1027,11 @@ RifReaderRftInterface* RimWellLogRftCurve::rftReader() const
return m_observedFmuRftData()->rftReader();
}
if ( m_pressureDepthData() )
{
return m_pressureDepthData()->rftReader();
}
return nullptr;
}
@ -1278,6 +1308,12 @@ std::vector<double> RimWellLogRftCurve::measuredDepthValues()
return values;
}
if ( m_pressureDepthData && !m_ensemble && !m_summaryCase )
{
// Pressure depth data does not have MD
return {};
}
std::vector<double> measuredDepthForCells;
RigEclipseWellLogExtractor* eclExtractor = extractor();

View File

@ -18,6 +18,7 @@
#pragma once
#include "RimPressureDepthData.h"
#include "RimWellLogCurve.h"
#include "RifEclipseRftAddress.h"
@ -38,6 +39,7 @@ class RimObservedFmuRftData;
class RimSummaryCase;
class RimSummaryCaseCollection;
class RimWellPath;
class RimPressureDepthData;
//==================================================================================================
///
@ -91,6 +93,9 @@ public:
void setObservedFmuRftData( RimObservedFmuRftData* observedFmuRftData );
RimObservedFmuRftData* observedFmuRftData() const;
void setPressureDepthData( RimPressureDepthData* observedFmuRftData );
RimPressureDepthData* pressureDepthData() const;
void setRftAddress( RifEclipseRftAddress address );
RifEclipseRftAddress rftAddress() const;
@ -149,6 +154,7 @@ private:
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
caf::PdmPtrField<RimObservedFmuRftData*> m_observedFmuRftData;
caf::PdmPtrField<RimPressureDepthData*> m_pressureDepthData;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_branchIndex;

View File

@ -48,6 +48,22 @@ QString RigPressureDepthData::wellName() const
return m_wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigPressureDepthData::setTimeStep( const QDateTime& timeStep )
{
m_timeStep = timeStep;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QDateTime RigPressureDepthData::timeStep() const
{
return m_timeStep;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -63,3 +79,27 @@ std::vector<std::pair<double, double>> RigPressureDepthData::getPressureDepthVal
{
return m_values;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigPressureDepthData::tvdmsl() const
{
std::vector<double> vals;
std::transform( std::begin( m_values ), std::end( m_values ), std::back_inserter( vals ), []( auto const& v ) {
return v.second;
} );
return vals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigPressureDepthData::pressure() const
{
std::vector<double> vals;
std::transform( std::begin( m_values ), std::end( m_values ), std::back_inserter( vals ), []( auto const& v ) {
return v.first;
} );
return vals;
}

View File

@ -20,6 +20,7 @@
#include "RiaDefines.h"
#include <QDateTime>
#include <QString>
#include <vector>
@ -36,10 +37,17 @@ public:
void setWellName( const QString& name );
QString wellName() const;
void setTimeStep( const QDateTime& timeStep );
QDateTime timeStep() const;
void addPressureAtDepth( double pressure, double depth );
std::vector<std::pair<double, double>> getPressureDepthValues() const;
std::vector<double> tvdmsl() const;
std::vector<double> pressure() const;
private:
QString m_wellName;
QDateTime m_timeStep;
std::vector<std::pair<double, double>> m_values;
};

View File

@ -23,14 +23,17 @@ TEST( RifPressureDepthTextFileReaderTest, LoadFile )
EXPECT_TRUE( errorMessage.isEmpty() );
ASSERT_EQ( 3u, items.size() );
EXPECT_EQ( "'G-14'", items[0].wellName().toStdString() );
EXPECT_EQ( "G-14", items[0].wellName().toStdString() );
EXPECT_EQ( 28, items[0].timeStep().date().day() );
EXPECT_EQ( 12, items[0].timeStep().date().month() );
EXPECT_EQ( 1995, items[0].timeStep().date().year() );
std::vector<std::pair<double, double>> values0 = items[0].getPressureDepthValues();
EXPECT_EQ( 4u, values0.size() );
double delta = 0.001;
EXPECT_NEAR( 418.88, values0[0].first, delta );
EXPECT_NEAR( 2726.91, values0[0].second, delta );
EXPECT_EQ( "'G-14'", items[1].wellName().toStdString() );
EXPECT_EQ( "G-14", items[1].wellName().toStdString() );
EXPECT_EQ( 28, items[1].timeStep().date().day() );
EXPECT_EQ( 12, items[1].timeStep().date().month() );
EXPECT_EQ( 1996, items[1].timeStep().date().year() );
@ -38,7 +41,7 @@ TEST( RifPressureDepthTextFileReaderTest, LoadFile )
EXPECT_NEAR( 418.88, values1[0].first, delta );
EXPECT_NEAR( 2726.91, values1[0].second, delta );
EXPECT_EQ( "'F-56'", items[2].wellName().toStdString() );
EXPECT_EQ( "F-56", items[2].wellName().toStdString() );
EXPECT_EQ( 15, items[2].timeStep().date().day() );
EXPECT_EQ( 1, items[2].timeStep().date().month() );
EXPECT_EQ( 2012, items[2].timeStep().date().year() );