mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6237 Implement creation of correlation plot from ensemble plots
This commit is contained in:
@@ -80,12 +80,20 @@ void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSumma
|
||||
m_analysisPlotDataSelection.push_back( dataEntry );
|
||||
}
|
||||
auto timeSteps = allAvailableTimeSteps();
|
||||
if ( !timeSteps.empty() )
|
||||
if ( m_timeStep().isNull() && !timeSteps.empty() )
|
||||
{
|
||||
m_timeStep = QDateTime::fromTime_t( *timeSteps.rbegin() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::setTimeStep( std::time_t timeStep )
|
||||
{
|
||||
m_timeStep = QDateTime::fromTime_t( timeStep );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <ctime>
|
||||
|
||||
class RiaSummaryCurveDefinition;
|
||||
class RiaSummaryCurveDefinitionAnalyser;
|
||||
class RimAnalysisPlotDataEntry;
|
||||
@@ -43,6 +45,7 @@ public:
|
||||
public:
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||
void setTimeStep( std::time_t timeStep );
|
||||
std::set<RimSummaryCaseCollection*> ensembles();
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
void detachAllCurves() override;
|
||||
|
||||
@@ -64,6 +64,24 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool de
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSummaryCaseCollection* ensemble,
|
||||
const QString& quantityName,
|
||||
std::time_t timeStep )
|
||||
{
|
||||
RimCorrelationPlot* plot = new RimCorrelationPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -79,6 +97,22 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble,
|
||||
std::time_t timeStep )
|
||||
{
|
||||
RimCorrelationMatrixPlot* plot = new RimCorrelationMatrixPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, "", timeStep );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -92,6 +126,23 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResultCrossPlot( RimSummaryCaseCollection* ensemble,
|
||||
const QString& paramName,
|
||||
const QString& quantityName,
|
||||
std::time_t timeStep )
|
||||
{
|
||||
RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot;
|
||||
plot->setAsPlotMdiWindow();
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||
plot->setEnsembleParameter( paramName );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -102,6 +153,23 @@ RimCorrelationReportPlot*
|
||||
report->setAsPlotMdiWindow();
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToReport( report, "FOPT" );
|
||||
report->matrixPlot()->selectAllParameters();
|
||||
report->correlationPlot()->selectAllParameters();
|
||||
m_correlationReports.push_back( report );
|
||||
return report;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportPlot( RimSummaryCaseCollection* ensemble,
|
||||
const QString& quantityName,
|
||||
std::time_t timeStep )
|
||||
{
|
||||
RimCorrelationReportPlot* report = new RimCorrelationReportPlot;
|
||||
report->setAsPlotMdiWindow();
|
||||
applyEnsembleFieldAndTimeStepToReport( report, ensemble, quantityName.toStdString(), timeStep );
|
||||
report->matrixPlot()->selectAllParameters();
|
||||
report->correlationPlot()->selectAllParameters();
|
||||
m_correlationReports.push_back( report );
|
||||
return report;
|
||||
}
|
||||
@@ -171,6 +239,33 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAb
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstractCorrelationPlot* plot,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
const std::string& quantityName,
|
||||
std::time_t timeStep )
|
||||
{
|
||||
if ( ensemble )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||
for ( auto address : allAddresses )
|
||||
{
|
||||
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD )
|
||||
{
|
||||
if ( quantityName.empty() || quantityName == address.quantityName() )
|
||||
{
|
||||
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
plot->setCurveDefinitions( curveDefs );
|
||||
plot->setTimeStep( timeStep );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -199,6 +294,40 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
|
||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->crossPlot()->setEnsembleParameter( ensembles.front()->alphabeticEnsembleParameters().front().name );
|
||||
plot->crossPlot()->setEnsembleParameter( ensembles.front()->variationSortedEnsembleParameters().front().name );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
const std::string& quantityName,
|
||||
std::time_t timeStep )
|
||||
{
|
||||
if ( ensemble )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefsMatrix;
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefsTornadoAndCrossPlot;
|
||||
for ( auto address : allAddresses )
|
||||
{
|
||||
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD )
|
||||
{
|
||||
curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
|
||||
if ( quantityName.empty() || quantityName == address.quantityName() )
|
||||
{
|
||||
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||
plot->matrixPlot()->setTimeStep( timeStep );
|
||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->correlationPlot()->setTimeStep( timeStep );
|
||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->crossPlot()->setTimeStep( timeStep );
|
||||
plot->crossPlot()->setEnsembleParameter( ensemble->variationSortedEnsembleParameters().front().name );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,14 @@
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
class RimAbstractCorrelationPlot;
|
||||
class RimCorrelationPlot;
|
||||
class RimCorrelationMatrixPlot;
|
||||
class RimCorrelationReportPlot;
|
||||
class RimParameterResultCrossPlot;
|
||||
class RimSummaryCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -39,12 +42,26 @@ public:
|
||||
RimCorrelationPlotCollection();
|
||||
~RimCorrelationPlotCollection() override;
|
||||
|
||||
RimCorrelationPlot* createCorrelationPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( bool defaultToFirstEnsembleField = true );
|
||||
RimCorrelationPlot* createCorrelationPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
RimCorrelationPlot*
|
||||
createCorrelationPlot( RimSummaryCaseCollection* ensemble, const QString& quantityName, std::time_t timeStep );
|
||||
|
||||
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( bool defaultToFirstEnsembleField = true );
|
||||
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble, std::time_t timeStep );
|
||||
|
||||
RimParameterResultCrossPlot* createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
RimCorrelationReportPlot* createCorrelationReportPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
|
||||
void removeReport( RimCorrelationReportPlot* correlationReport );
|
||||
RimParameterResultCrossPlot* createParameterResultCrossPlot( RimSummaryCaseCollection* ensemble,
|
||||
const QString& paramName,
|
||||
const QString& quantityName,
|
||||
std::time_t timeStep );
|
||||
|
||||
RimCorrelationReportPlot* createCorrelationReportPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
RimCorrelationReportPlot* createCorrelationReportPlot( RimSummaryCaseCollection* ensemble,
|
||||
const QString& quantityName,
|
||||
std::time_t timeStep );
|
||||
|
||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
|
||||
void removeReport( RimCorrelationReportPlot* correlationReport );
|
||||
|
||||
std::vector<RimAbstractCorrelationPlot*> plots();
|
||||
std::vector<RimCorrelationReportPlot*> reports();
|
||||
@@ -53,7 +70,15 @@ public:
|
||||
|
||||
private:
|
||||
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, const std::string& quantityName = "" );
|
||||
void applyEnsembleFieldAndTimeStepToPlot( RimAbstractCorrelationPlot* plot,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
const std::string& quantityName,
|
||||
std::time_t timeStep );
|
||||
void applyFirstEnsembleFieldAddressesToReport( RimCorrelationReportPlot* plot, const std::string& quantityName = "" );
|
||||
void applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
const std::string& quantityName,
|
||||
std::time_t timeStep );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimAbstractCorrelationPlot*> m_correlationPlots;
|
||||
|
||||
Reference in New Issue
Block a user