mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support missing timesteps in statistics ensemble cases (#12155)
* Support missing timesteps in statistics ensemble cases * Adjust resolution values
This commit is contained in:
parent
e73cd624d1
commit
588ab0dc69
@ -90,7 +90,7 @@ RimContourMapProjection::RimContourMapProjection()
|
||||
CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resolution, "Resolution", "Sampling Resolution" );
|
||||
m_resolution.setValue( RimContourMapResolutionTools::SamplingResolution::FINE );
|
||||
m_resolution.setValue( RimContourMapResolutionTools::SamplingResolution::NORMAL );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation" );
|
||||
|
||||
|
@ -44,13 +44,13 @@ double RimContourMapResolutionTools::resolutionFromEnumValue( SamplingResolution
|
||||
case RimContourMapResolutionTools::SamplingResolution::EXTRA_FINE:
|
||||
return 0.5;
|
||||
case RimContourMapResolutionTools::SamplingResolution::FINE:
|
||||
return 1.0;
|
||||
case RimContourMapResolutionTools::SamplingResolution::COARSE:
|
||||
return 5.0;
|
||||
case RimContourMapResolutionTools::SamplingResolution::EXTRA_COARSE:
|
||||
return 8.0;
|
||||
return 0.7;
|
||||
case RimContourMapResolutionTools::SamplingResolution::NORMAL:
|
||||
default:
|
||||
return 0.9;
|
||||
case RimContourMapResolutionTools::SamplingResolution::COARSE:
|
||||
return 2.0;
|
||||
case RimContourMapResolutionTools::SamplingResolution::EXTRA_COARSE:
|
||||
return 5.0;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ RimStatisticsContourMap::RimStatisticsContourMap()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_oilFloodingType, "OilFloodingType", "Residual Oil Given By" );
|
||||
m_oilFloodingType.setValue( RigFloodingSettings::FloodingType::WATER_FLOODING );
|
||||
CAF_PDM_InitField( &m_userDefinedFloodingOil, "UserDefinedFloodingOil", 0.0, "User Defined Value" );
|
||||
CAF_PDM_InitField( &m_userDefinedFloodingOil, "UserDefinedFloodingOil", 0.0, "" );
|
||||
m_userDefinedFloodingOil.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_gasFloodingType, "GasFloodingType", RigFloodingSettings::FloodingType::GAS_FLOODING, "Residual Oil-in-Gas Given By" );
|
||||
@ -108,7 +108,7 @@ RimStatisticsContourMap::RimStatisticsContourMap()
|
||||
{ RigFloodingSettings::FloodingType::GAS_FLOODING,
|
||||
RigFloodingSettings::FloodingType::USER_DEFINED } );
|
||||
|
||||
CAF_PDM_InitField( &m_userDefinedFloodingGas, "UserDefinedFloodingGas", 0.0, "User Defined Value" );
|
||||
CAF_PDM_InitField( &m_userDefinedFloodingGas, "UserDefinedFloodingGas", 0.0, "" );
|
||||
m_userDefinedFloodingGas.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "SelectedTimeSteps", "Time Step Selection" );
|
||||
@ -569,11 +569,15 @@ void RimStatisticsContourMap::computeStatistics()
|
||||
|
||||
if ( m_resultDefinition()->hasDynamicResult() )
|
||||
{
|
||||
for ( auto ts : selectedTimeSteps() )
|
||||
std::vector<std::pair<int, int>> timeSteps = mapLocalToGlobalTimeSteps( eCase->timeStepDates() );
|
||||
|
||||
for ( auto [localTs, globalTs] : timeSteps )
|
||||
{
|
||||
std::vector<double> result =
|
||||
contourMapProjection.generateResults( m_resultDefinition()->eclipseResultAddress(), resultAggregation, ts, floodSettings );
|
||||
timestep_results[ts].push_back( result );
|
||||
std::vector<double> result = contourMapProjection.generateResults( m_resultDefinition()->eclipseResultAddress(),
|
||||
resultAggregation,
|
||||
localTs,
|
||||
floodSettings );
|
||||
timestep_results[globalTs].push_back( result );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -649,6 +653,47 @@ std::vector<int> RimStatisticsContourMap::selectedTimeSteps() const
|
||||
return steps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QDateTime> RimStatisticsContourMap::selectedTimeStepDates() const
|
||||
{
|
||||
std::vector<QDateTime> retDates;
|
||||
|
||||
auto eCase = eclipseCase();
|
||||
if ( eCase != nullptr )
|
||||
{
|
||||
auto allDates = eCase->timeStepDates();
|
||||
for ( auto i : selectedTimeSteps() )
|
||||
{
|
||||
if ( i < (int)allDates.size() ) retDates.push_back( allDates[i] );
|
||||
}
|
||||
}
|
||||
return retDates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// returns pair of (local date index, matching global date index)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<int, int>> RimStatisticsContourMap::mapLocalToGlobalTimeSteps( std::vector<QDateTime> localDates ) const
|
||||
{
|
||||
std::vector<std::pair<int, int>> indexSubset;
|
||||
|
||||
auto globalDates = selectedTimeStepDates();
|
||||
auto globalIndexes = selectedTimeSteps();
|
||||
|
||||
for ( int i = 0; i < (int)localDates.size(); i++ )
|
||||
{
|
||||
auto pos = std::find( globalDates.begin(), globalDates.end(), localDates[i] );
|
||||
if ( pos == globalDates.end() ) continue;
|
||||
|
||||
int foundIdx = (int)( pos - globalDates.begin() );
|
||||
indexSubset.emplace_back( i, globalIndexes[foundIdx] );
|
||||
}
|
||||
|
||||
return indexSubset;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultDefinition;
|
||||
@ -78,8 +80,9 @@ public:
|
||||
double sampleSpacingFactor() const;
|
||||
bool isColumnResult() const;
|
||||
|
||||
std::vector<int> selectedTimeSteps() const;
|
||||
QString timeStepName( int timeStep ) const;
|
||||
std::vector<int> selectedTimeSteps() const;
|
||||
std::vector<QDateTime> selectedTimeStepDates() const;
|
||||
QString timeStepName( int timeStep ) const;
|
||||
|
||||
std::vector<QString> selectedFormations() const;
|
||||
std::vector<std::vector<cvf::Vec3d>> selectedPolygons();
|
||||
@ -98,6 +101,8 @@ private:
|
||||
void computeStatistics();
|
||||
void doStatisticsCalculation( std::map<size_t, std::vector<std::vector<double>>>& timestep_results );
|
||||
|
||||
std::vector<std::pair<int, int>> mapLocalToGlobalTimeSteps( std::vector<QDateTime> localDates ) const;
|
||||
|
||||
caf::PdmField<double> m_boundingBoxExpPercent;
|
||||
caf::PdmField<RimContourMapProjection::ResultAggregation> m_resultAggregation;
|
||||
caf::PdmField<std::vector<int>> m_selectedTimeSteps;
|
||||
|
@ -195,7 +195,7 @@ size_t RimStatisticsContourMapView::onTimeStepCountRequested()
|
||||
{
|
||||
if ( statisticsContourMap() )
|
||||
{
|
||||
return (size_t)statisticsContourMap()->selectedTimeSteps().size();
|
||||
return statisticsContourMap()->selectedTimeSteps().size();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user