Summary observed data

* #9966 Summary calculations: add support for imported vectors.
* #9966 Summary Calculation: add support for imported and observed data.
* Summary Address: avoid extra level in tree for imported data.
* #9966 Update observed data when calculation is updated.
This commit is contained in:
Kristian Bendiksen
2023-03-15 13:39:57 +01:00
committed by GitHub
parent 26416c8937
commit 245d483036
11 changed files with 90 additions and 23 deletions

View File

@@ -24,6 +24,7 @@
#include "RifEclipseSummaryAddress.h"
#include "RimMainPlotCollection.h"
#include "RimObservedDataCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimSummaryAddress.h"
@@ -81,6 +82,15 @@ RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection()
return summaryCaseMainCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimObservedDataCollection* RiaSummaryTools::observedDataCollection()
{
RimProject* project = RimProject::current();
return project->activeOilField()->observedDataCollection();
}
//--------------------------------------------------------------------------------------------------
/// Update the summary curves referencing this curve, as the curve is identified by the name
//--------------------------------------------------------------------------------------------------

View File

@@ -19,6 +19,7 @@
#pragma once
#include "RiaDateTimeDefines.h"
#include "RimObservedDataCollection.h"
#include <QString>
@@ -32,6 +33,7 @@ class RimSummaryCrossPlotCollection;
class RimSummaryCaseMainCollection;
class RimSummaryCase;
class RimSummaryCaseCollection;
class RimObservedDataCollection;
class RifEclipseSummaryAddress;
@@ -52,6 +54,7 @@ public:
static RimSummaryCrossPlotCollection* summaryCrossPlotCollection();
static RimSummaryCaseMainCollection* summaryCaseMainCollection();
static RimSummaryMultiPlotCollection* summaryMultiPlotCollection();
static RimObservedDataCollection* observedDataCollection();
static std::vector<RimSummaryCase*> singleTopLevelSummaryCases();

View File

@@ -411,11 +411,12 @@ RifEclipseSummaryAddress
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RifEclipseSummaryAddress::importedAddress( const std::string& vectorName )
RifEclipseSummaryAddress RifEclipseSummaryAddress::importedAddress( const std::string& vectorName, int calculationId )
{
RifEclipseSummaryAddress addr;
addr.m_variableCategory = SUMMARY_IMPORTED;
addr.m_vectorName = vectorName;
addr.m_id = calculationId;
return addr;
}

View File

@@ -124,7 +124,7 @@ public:
static RifEclipseSummaryAddress blockAddress( const std::string& vectorName, int i, int j, int k, int calculationId = -1 );
static RifEclipseSummaryAddress
blockLgrAddress( const std::string& vectorName, const std::string& lgrName, int i, int j, int k, int calculationId = -1 );
static RifEclipseSummaryAddress importedAddress( const std::string& vectorName );
static RifEclipseSummaryAddress importedAddress( const std::string& vectorName, int calculationId = -1 );
static RifEclipseSummaryAddress ensembleStatisticsAddress( const std::string& vectorName, const std::string& datavectorName );
static std::string generateStringFromAddresses( const std::vector<RifEclipseSummaryAddress>& addressVector,

View File

@@ -27,6 +27,8 @@
#include "RifSummaryReaderInterface.h"
#include "RimDataSourceSteppingTools.h"
#include "RimObservedDataCollection.h"
#include "RimObservedSummaryData.h"
#include "RimProject.h"
#include "RimSummaryAddress.h"
#include "RimSummaryCalculationCollection.h"
@@ -267,7 +269,8 @@ void RimSummaryCalculation::substituteVariables( std::vector<SummaryCalculationV
newValue = QString::fromStdString( address.blockAsString() );
isHandledBySteppingTools = true;
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_MISC || category == RifEclipseSummaryAddress::SUMMARY_FIELD )
else if ( category == RifEclipseSummaryAddress::SUMMARY_MISC || category == RifEclipseSummaryAddress::SUMMARY_FIELD ||
category == RifEclipseSummaryAddress::SUMMARY_IMPORTED )
{
// No need to do anything for these types
return;
@@ -412,6 +415,15 @@ void RimSummaryCalculation::updateDependentObjects()
summaryCase->refreshMetaData();
}
RimObservedDataCollection* observedDataCollection = RiaSummaryTools::observedDataCollection();
auto observedData = observedDataCollection->allObservedSummaryData();
for ( auto obs : observedData )
{
obs->createSummaryReaderInterface();
obs->createRftReaderInterface();
obs->refreshMetaData();
}
auto summaryCaseCollections = summaryCaseCollection->summaryCaseCollections();
for ( RimSummaryCaseCollection* summaryCaseCollection : summaryCaseCollections )
{
@@ -559,6 +571,10 @@ std::vector<RimSummaryCalculationAddress>
addresses.push_back( RimSummaryCalculationAddress( RifEclipseSummaryAddress::regionToRegionAddress( name, r1, r2, m_id ) ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_IMPORTED )
{
addresses.push_back( RimSummaryCalculationAddress( RifEclipseSummaryAddress::importedAddress( name, m_id ) ) );
}
return addresses;
}
@@ -603,6 +619,10 @@ RimSummaryCalculationAddress RimSummaryCalculation::singleAddressesForCategory(
{
return RifEclipseSummaryAddress::regionToRegionAddress( name, address.regionNumber(), address.regionNumber2(), m_id );
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_IMPORTED )
{
return RifEclipseSummaryAddress::importedAddress( name, m_id );
}
return RifEclipseSummaryAddress();
}

View File

@@ -23,7 +23,13 @@
#include "RifColumnBasedUserDataParser.h"
#include "RifCsvUserData.h"
#include "RifKeywordVectorUserData.h"
#include "RifMultipleSummaryReaders.h"
#include "RifSummaryReaderInterface.h"
#include "RifSummaryReaderMultipleFiles.h"
#include "RimCalculatedSummaryCurveReader.h"
#include "RimProject.h"
#include "RimSummaryCalculationCollection.h"
#include "cafUtils.h"
@@ -57,7 +63,7 @@ RimCsvUserData::~RimCsvUserData()
//--------------------------------------------------------------------------------------------------
void RimCsvUserData::createSummaryReaderInterface()
{
m_summaryReader = nullptr;
m_multiSummaryReader = nullptr;
if ( caf::Utils::fileExists( this->summaryHeaderFilename() ) )
{
@@ -65,12 +71,16 @@ void RimCsvUserData::createSummaryReaderInterface()
if ( csvUserData->parse( this->summaryHeaderFilename(), m_parseOptions->parseOptions(), &m_errorText ) )
{
m_summaryReader = csvUserData;
m_multiSummaryReader = new RifMultipleSummaryReaders;
m_multiSummaryReader->addReader( m_summaryReader.p() );
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
}
}
else
{
m_summaryReader = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
@@ -78,11 +88,11 @@ void RimCsvUserData::createSummaryReaderInterface()
//--------------------------------------------------------------------------------------------------
RifSummaryReaderInterface* RimCsvUserData::summaryReader()
{
if ( m_summaryReader.isNull() )
if ( m_multiSummaryReader.isNull() )
{
createSummaryReaderInterface();
}
return m_summaryReader.p();
return m_multiSummaryReader.p();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -28,6 +28,8 @@
#include "cvfObject.h"
class RifSummaryReaderInterface;
class RifCalculatedSummaryCurveReader;
class RifMultipleSummaryReaders;
//==================================================================================================
//
@@ -51,5 +53,7 @@ public:
private:
caf::PdmChildField<RicPasteAsciiDataToSummaryPlotFeatureUi*> m_parseOptions;
cvf::ref<RifSummaryReaderInterface> m_summaryReader;
cvf::ref<RifCalculatedSummaryCurveReader> m_calculatedSummaryReader;
cvf::ref<RifMultipleSummaryReaders> m_multiSummaryReader;
QString m_errorText;
};

View File

@@ -24,8 +24,13 @@
#include "RifColumnBasedUserDataParser.h"
#include "RifKeywordVectorParser.h"
#include "RifKeywordVectorUserData.h"
#include "RifMultipleSummaryReaders.h"
#include "RifSummaryReaderInterface.h"
#include "RimCalculatedSummaryCurveReader.h"
#include "RimProject.h"
#include "RimSummaryCalculationCollection.h"
#include "cafUtils.h"
#include <QFile>
@@ -53,7 +58,8 @@ RimObservedEclipseUserData::~RimObservedEclipseUserData()
//--------------------------------------------------------------------------------------------------
void RimObservedEclipseUserData::createSummaryReaderInterface()
{
m_summeryReader = nullptr;
m_multiSummaryReader = nullptr;
m_summaryReader = nullptr;
if ( caf::Utils::fileExists( this->summaryHeaderFilename() ) )
{
@@ -74,7 +80,7 @@ void RimObservedEclipseUserData::createSummaryReaderInterface()
RifKeywordVectorUserData* keywordVectorUserData = new RifKeywordVectorUserData();
if ( keywordVectorUserData->parse( fileContents, customWellName() ) )
{
m_summeryReader = keywordVectorUserData;
m_summaryReader = keywordVectorUserData;
}
}
else
@@ -82,13 +88,20 @@ void RimObservedEclipseUserData::createSummaryReaderInterface()
RifColumnBasedUserData* columnBaseUserData = new RifColumnBasedUserData();
if ( columnBaseUserData->parse( fileContents, &m_errorText ) )
{
m_summeryReader = columnBaseUserData;
m_summaryReader = columnBaseUserData;
}
}
}
else
{
m_summeryReader = nullptr;
if ( m_summaryReader.notNull() )
{
m_multiSummaryReader = new RifMultipleSummaryReaders;
m_multiSummaryReader->addReader( m_summaryReader.p() );
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
}
}
}
@@ -97,11 +110,11 @@ void RimObservedEclipseUserData::createSummaryReaderInterface()
//--------------------------------------------------------------------------------------------------
RifSummaryReaderInterface* RimObservedEclipseUserData::summaryReader()
{
if ( m_summeryReader.isNull() )
if ( m_multiSummaryReader.isNull() )
{
createSummaryReaderInterface();
}
return m_summeryReader.p();
return m_multiSummaryReader.p();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -25,6 +25,8 @@
#include "cvfObject.h"
class RifSummaryReaderInterface;
class RifCalculatedSummaryCurveReader;
class RifMultipleSummaryReaders;
//==================================================================================================
//
@@ -44,6 +46,8 @@ public:
QString errorMessagesFromReader() override;
private:
cvf::ref<RifSummaryReaderInterface> m_summeryReader;
QString m_errorText;
cvf::ref<RifSummaryReaderInterface> m_summaryReader;
cvf::ref<RifCalculatedSummaryCurveReader> m_calculatedSummaryReader;
cvf::ref<RifMultipleSummaryReaders> m_multiSummaryReader;
QString m_errorText;
};

View File

@@ -289,7 +289,7 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set<RifEclip
break;
case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_IMPORTED:
imported->addToSubfolder( QString::fromStdString( address.itemUiText() ), CollectionContentType::IMPORTED, address, caseId, ensembleId );
imported->addAddress( address, caseId, ensembleId );
break;
default:

View File

@@ -1404,8 +1404,10 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForCategories( QList<caf::Pdm
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_LGR );
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_COMPLETION_LGR );
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_BLOCK_LGR );
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_IMPORTED );
}
sortedCategoriesForUi.push_back( RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_IMPORTED );
// NB SUMMARY_ENSEMBLE_STATISTICS is intentionally excluded
// categoriesForUiDisplay.push_back(RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_ENSEMBLE_STATISTICS);