#8232 Ensemble Fracture Statistics: Swap min/max and P90/P10 for Beta (#8243)

For property Beta, low values are high (max, P10) case and high values are
low (min, P90) case. Calculation of statistical Beta values now uses
inverted logic.

Fixes #8232.
This commit is contained in:
Kristian Bendiksen 2021-11-05 20:00:22 +01:00 committed by GitHub
parent 0c25794518
commit 7747f822bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -446,6 +446,10 @@ std::vector<QString> RimEnsembleFractureStatistics::computeStatistics()
std::shared_ptr<RigSlice2D> distanceGrid = std::make_shared<RigSlice2D>( gridXs.size(), gridYs.size() ); std::shared_ptr<RigSlice2D> distanceGrid = std::make_shared<RigSlice2D>( gridXs.size(), gridYs.size() );
sampleAllGrids( fractureGrids, gridXs, gridYs, samples, areaGrid, distanceGrid ); sampleAllGrids( fractureGrids, gridXs, gridYs, samples, areaGrid, distanceGrid );
// Beta should be reported inverted: low values are high, high values are low.
bool swapLowAndHigh = result.first.contains( "BETA", Qt::CaseInsensitive );
if ( swapLowAndHigh ) RiaLogging::info( QString( "Inverting statistics for: %1" ).arg( result.first ) );
std::map<RimEnsembleFractureStatistics::StatisticsType, std::shared_ptr<RigSlice2D>> statisticsGrids; std::map<RimEnsembleFractureStatistics::StatisticsType, std::shared_ptr<RigSlice2D>> statisticsGrids;
generateStatisticsGrids( samples, generateStatisticsGrids( samples,
gridXs.size(), gridXs.size(),
@ -455,7 +459,8 @@ std::vector<QString> RimEnsembleFractureStatistics::computeStatistics()
selectedStatistics, selectedStatistics,
areaHistogramData, areaHistogramData,
areaGrid, areaGrid,
distanceGrid ); distanceGrid,
swapLowAndHigh );
for ( auto [statType, slice] : statisticsGrids ) for ( auto [statType, slice] : statisticsGrids )
{ {
@ -1138,7 +1143,8 @@ void RimEnsembleFractureStatistics::generateStatisticsGrids(
const std::vector<caf::AppEnum<RimEnsembleFractureStatistics::StatisticsType>>& statisticsTypes, const std::vector<caf::AppEnum<RimEnsembleFractureStatistics::StatisticsType>>& statisticsTypes,
const RigHistogramData& areaHistogram, const RigHistogramData& areaHistogram,
std::shared_ptr<RigSlice2D> areaGrid, std::shared_ptr<RigSlice2D> areaGrid,
std::shared_ptr<RigSlice2D> distanceGrid ) std::shared_ptr<RigSlice2D> distanceGrid,
bool swapLowAndHigh )
{ {
for ( auto t : statisticsTypes ) for ( auto t : statisticsTypes )
{ {
@ -1193,6 +1199,8 @@ void RimEnsembleFractureStatistics::generateStatisticsGrids(
double dev; double dev;
RigStatisticsMath::calculateBasicStatistics( values, &min, &max, &sum, &range, &mean, &dev ); RigStatisticsMath::calculateBasicStatistics( values, &min, &max, &sum, &range, &mean, &dev );
if ( swapLowAndHigh ) std::swap( min, max );
if ( calculateMean ) if ( calculateMean )
setValueNoInf( statisticsGrids[RimEnsembleFractureStatistics::StatisticsType::MEAN], x, y, mean ); setValueNoInf( statisticsGrids[RimEnsembleFractureStatistics::StatisticsType::MEAN], x, y, mean );
@ -1216,6 +1224,8 @@ void RimEnsembleFractureStatistics::generateStatisticsGrids(
&mean, &mean,
RigStatisticsMath::PercentileStyle::SWITCHED ); RigStatisticsMath::PercentileStyle::SWITCHED );
if ( swapLowAndHigh ) std::swap( p10, p90 );
if ( calculateP10 ) if ( calculateP10 )
setValueNoInf( statisticsGrids[RimEnsembleFractureStatistics::StatisticsType::P10], x, y, p10 ); setValueNoInf( statisticsGrids[RimEnsembleFractureStatistics::StatisticsType::P10], x, y, p10 );

View File

@ -197,7 +197,8 @@ protected:
const std::vector<caf::AppEnum<RimEnsembleFractureStatistics::StatisticsType>>& statisticsTypes, const std::vector<caf::AppEnum<RimEnsembleFractureStatistics::StatisticsType>>& statisticsTypes,
const RigHistogramData& areaHistogram, const RigHistogramData& areaHistogram,
std::shared_ptr<RigSlice2D> areaGrid, std::shared_ptr<RigSlice2D> areaGrid,
std::shared_ptr<RigSlice2D> distanceGrid ); std::shared_ptr<RigSlice2D> distanceGrid,
bool highIsLow );
static bool writeStatisticsToCsv( const QString& filePath, const RigSlice2D& samples ); static bool writeStatisticsToCsv( const QString& filePath, const RigSlice2D& samples );