mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Better defaults for Correlation Cross Plots and shorten legend entries
This commit is contained in:
parent
9b9a6f2947
commit
e292b8a297
@ -60,9 +60,10 @@ public:
|
|||||||
int axisTitleFontSize() const;
|
int axisTitleFontSize() const;
|
||||||
int axisValueFontSize() const;
|
int axisValueFontSize() const;
|
||||||
|
|
||||||
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
|
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
|
||||||
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
|
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
|
||||||
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
|
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
|
||||||
|
std::set<time_t> allAvailableTimeSteps();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
@ -76,7 +77,6 @@ protected:
|
|||||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||||
bool* useOptionsOnly ) override;
|
bool* useOptionsOnly ) override;
|
||||||
|
|
||||||
std::set<time_t> allAvailableTimeSteps();
|
|
||||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||||
|
|
||||||
std::set<RifEclipseSummaryAddress> addresses();
|
std::set<RifEclipseSummaryAddress> addresses();
|
||||||
|
@ -270,16 +270,26 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstr
|
|||||||
{
|
{
|
||||||
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
||||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||||
|
std::vector<QString> highestCorrelationParameters;
|
||||||
for ( auto address : allAddresses )
|
for ( auto address : allAddresses )
|
||||||
{
|
{
|
||||||
auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) );
|
auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) );
|
||||||
if ( it != quantityNames.end() || quantityNames.empty() )
|
if ( it != quantityNames.end() || quantityNames.empty() )
|
||||||
{
|
{
|
||||||
curveDefs.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
|
curveDefs.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
|
||||||
|
auto correlationSortedEnsembleParameters =
|
||||||
|
ensemble->correlationSortedEnsembleParameters( address, timeStep );
|
||||||
|
highestCorrelationParameters.push_back( correlationSortedEnsembleParameters.front().first.name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plot->setCurveDefinitions( curveDefs );
|
plot->setCurveDefinitions( curveDefs );
|
||||||
plot->setTimeStep( timeStep );
|
plot->setTimeStep( timeStep );
|
||||||
|
|
||||||
|
auto crossPlot = dynamic_cast<RimParameterResultCrossPlot*>( plot );
|
||||||
|
if ( crossPlot && !highestCorrelationParameters.empty() )
|
||||||
|
{
|
||||||
|
crossPlot->setEnsembleParameter( highestCorrelationParameters.front() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +327,17 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
|
|||||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
plot->crossPlot()->setEnsembleParameter( ensembles.front()->variationSortedEnsembleParameters().front().name );
|
|
||||||
|
time_t timeStep = *( plot->matrixPlot()->allAvailableTimeSteps().rbegin() );
|
||||||
|
auto correlationSortedEnsembleParameters =
|
||||||
|
ensembles.front()->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(),
|
||||||
|
timeStep );
|
||||||
|
if ( !correlationSortedEnsembleParameters.empty() )
|
||||||
|
{
|
||||||
|
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
|
||||||
|
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
|
||||||
|
}
|
||||||
|
plot->matrixPlot()->setTimeStep( timeStep );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,12 +371,17 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCor
|
|||||||
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
|
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||||
plot->matrixPlot()->setTimeStep( timeStep );
|
plot->matrixPlot()->setTimeStep( timeStep );
|
||||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
plot->correlationPlot()->setTimeStep( timeStep );
|
plot->correlationPlot()->setTimeStep( timeStep );
|
||||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
plot->crossPlot()->setTimeStep( timeStep );
|
plot->crossPlot()->setTimeStep( timeStep );
|
||||||
plot->crossPlot()->setEnsembleParameter( ensemble->variationSortedEnsembleParameters().front().name );
|
|
||||||
|
auto correlationSortedEnsembleParameters =
|
||||||
|
ensemble->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(), timeStep );
|
||||||
|
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
|
||||||
|
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "RiaPreferences.h"
|
#include "RiaPreferences.h"
|
||||||
#include "RiaQDateTimeTools.h"
|
#include "RiaQDateTimeTools.h"
|
||||||
#include "RiaStatisticsTools.h"
|
#include "RiaStatisticsTools.h"
|
||||||
|
#include "RiaTextStringTools.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
#include "RiuSummaryQwtPlot.h"
|
#include "RiuSummaryQwtPlot.h"
|
||||||
#include "RiuSummaryVectorSelectionDialog.h"
|
#include "RiuSummaryVectorSelectionDialog.h"
|
||||||
@ -30,6 +32,7 @@
|
|||||||
|
|
||||||
#include "RimDerivedSummaryCase.h"
|
#include "RimDerivedSummaryCase.h"
|
||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
|
#include "RimMultiPlot.h"
|
||||||
#include "RimPlotAxisProperties.h"
|
#include "RimPlotAxisProperties.h"
|
||||||
#include "RimPlotAxisPropertiesInterface.h"
|
#include "RimPlotAxisPropertiesInterface.h"
|
||||||
#include "RimPlotDataFilterCollection.h"
|
#include "RimPlotDataFilterCollection.h"
|
||||||
@ -166,7 +169,7 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate()
|
|||||||
if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
|
if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
|
||||||
{
|
{
|
||||||
createPoints();
|
createPoints();
|
||||||
if ( m_showPlotLegends && !isSubPlot() )
|
if ( m_showPlotLegends && !isSubPlot<RimMultiPlot>() )
|
||||||
{
|
{
|
||||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||||
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
||||||
@ -231,6 +234,19 @@ void RimParameterResultCrossPlot::createPoints()
|
|||||||
EnsembleParameter parameter = ensembleParameter( m_ensembleParameter );
|
EnsembleParameter parameter = ensembleParameter( m_ensembleParameter );
|
||||||
if ( !( parameter.isNumeric() && parameter.isValid() ) ) return;
|
if ( !( parameter.isNumeric() && parameter.isValid() ) ) return;
|
||||||
|
|
||||||
|
QStringList caseNames;
|
||||||
|
for ( size_t caseIdx = 0u; caseIdx < ensemble->allSummaryCases().size(); ++caseIdx )
|
||||||
|
{
|
||||||
|
auto summaryCase = ensemble->allSummaryCases()[caseIdx];
|
||||||
|
|
||||||
|
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
||||||
|
if ( !reader ) continue;
|
||||||
|
|
||||||
|
if ( !summaryCase->caseRealizationParameters() ) continue;
|
||||||
|
caseNames.push_back( summaryCase->displayCaseName() );
|
||||||
|
}
|
||||||
|
QString commonCaseRoot = RiaTextStringTools::findCommonRoot( caseNames );
|
||||||
|
|
||||||
for ( size_t caseIdx = 0u; caseIdx < ensemble->allSummaryCases().size(); ++caseIdx )
|
for ( size_t caseIdx = 0u; caseIdx < ensemble->allSummaryCases().size(); ++caseIdx )
|
||||||
{
|
{
|
||||||
auto summaryCase = ensemble->allSummaryCases()[caseIdx];
|
auto summaryCase = ensemble->allSummaryCases()[caseIdx];
|
||||||
@ -281,7 +297,7 @@ void RimParameterResultCrossPlot::createPoints()
|
|||||||
plotCurve->setSymbol( symbol );
|
plotCurve->setSymbol( symbol );
|
||||||
QStringList curveName;
|
QStringList curveName;
|
||||||
if ( showEnsembleName ) curveName += ensemble->name();
|
if ( showEnsembleName ) curveName += ensemble->name();
|
||||||
curveName += summaryCase->displayCaseName();
|
curveName += summaryCase->displayCaseName().replace( commonCaseRoot, "" );
|
||||||
if ( showAddressName ) curveName += QString::fromStdString( address.uiText() );
|
if ( showAddressName ) curveName += QString::fromStdString( address.uiText() );
|
||||||
|
|
||||||
plotCurve->setTitle( curveName.join( " - " ) );
|
plotCurve->setTitle( curveName.join( " - " ) );
|
||||||
|
@ -282,13 +282,3 @@ void RimPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
|||||||
{
|
{
|
||||||
loadDataAndUpdate();
|
loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
/// Is this inside another plot window?
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RimPlot::isSubPlot() const
|
|
||||||
{
|
|
||||||
RimPlotWindow* parentPlotWindow = nullptr;
|
|
||||||
firstAncestorOfType( parentPlotWindow );
|
|
||||||
return parentPlotWindow != nullptr;
|
|
||||||
}
|
|
||||||
|
@ -91,7 +91,13 @@ public:
|
|||||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||||
|
|
||||||
bool isSubPlot() const;
|
template <typename PlotWindowType = RimPlotWindow>
|
||||||
|
bool isSubPlot() const
|
||||||
|
{
|
||||||
|
PlotWindowType* parentPlotWindow = nullptr;
|
||||||
|
firstAncestorOfType( parentPlotWindow );
|
||||||
|
return parentPlotWindow != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
|
@ -1131,13 +1131,7 @@ std::vector<std::pair<EnsembleParameter, double>> RimEnsembleCurveSet::correlati
|
|||||||
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
||||||
if ( ensemble )
|
if ( ensemble )
|
||||||
{
|
{
|
||||||
auto parameters = ensemble->parameterCorrelationsAllTimeSteps( summaryAddress() );
|
return ensemble->correlationSortedEnsembleParameters( summaryAddress() );
|
||||||
std::sort( parameters.begin(),
|
|
||||||
parameters.end(),
|
|
||||||
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
|
|
||||||
return std::abs( lhs.second ) > std::abs( rhs.second );
|
|
||||||
} );
|
|
||||||
return parameters;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -473,6 +473,37 @@ const std::vector<EnsembleParameter>&
|
|||||||
return m_cachedSortedEnsembleParameters;
|
return m_cachedSortedEnsembleParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<std::pair<EnsembleParameter, double>>
|
||||||
|
RimSummaryCaseCollection::correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address ) const
|
||||||
|
{
|
||||||
|
auto parameters = parameterCorrelationsAllTimeSteps( address );
|
||||||
|
std::sort( parameters.begin(),
|
||||||
|
parameters.end(),
|
||||||
|
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
|
||||||
|
return std::abs( lhs.second ) > std::abs( rhs.second );
|
||||||
|
} );
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<std::pair<EnsembleParameter, double>>
|
||||||
|
RimSummaryCaseCollection::correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address,
|
||||||
|
time_t selectedTimeStep ) const
|
||||||
|
{
|
||||||
|
auto parameters = parameterCorrelations( address, selectedTimeStep );
|
||||||
|
std::sort( parameters.begin(),
|
||||||
|
parameters.end(),
|
||||||
|
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
|
||||||
|
return std::abs( lhs.second ) > std::abs( rhs.second );
|
||||||
|
} );
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
time_t timeDiff( time_t lhs, time_t rhs )
|
time_t timeDiff( time_t lhs, time_t rhs )
|
||||||
{
|
{
|
||||||
if ( lhs >= rhs )
|
if ( lhs >= rhs )
|
||||||
|
@ -115,6 +115,10 @@ public:
|
|||||||
int ensembleId() const;
|
int ensembleId() const;
|
||||||
|
|
||||||
const std::vector<EnsembleParameter>& variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
|
const std::vector<EnsembleParameter>& variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
|
||||||
|
std::vector<std::pair<EnsembleParameter, double>>
|
||||||
|
correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address ) const;
|
||||||
|
std::vector<std::pair<EnsembleParameter, double>>
|
||||||
|
correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address, time_t selectedTimeStep ) const;
|
||||||
std::vector<std::pair<EnsembleParameter, double>>
|
std::vector<std::pair<EnsembleParameter, double>>
|
||||||
parameterCorrelations( const RifEclipseSummaryAddress& address,
|
parameterCorrelations( const RifEclipseSummaryAddress& address,
|
||||||
time_t selectedTimeStep,
|
time_t selectedTimeStep,
|
||||||
|
Loading…
Reference in New Issue
Block a user