diff --git a/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp index 76dde37784..e711ac95a8 100644 --- a/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp @@ -758,7 +758,7 @@ RimRegularGridCase* RigWellTargetCandidatesGenerator::generateEnsembleCandidates targetCase->setCellCount( resultGridCellCount ); targetCase->createModel( "" ); - std::vector occupancy; + std::vector occurrence; std::map>> resultNamesAndSamples; resultNamesAndSamples["TOTAL_PORV_SOIL"] = {}; @@ -771,10 +771,23 @@ RimRegularGridCase* RigWellTargetCandidatesGenerator::generateEnsembleCandidates { auto task = progInfo.task( "Accumulating results.", 1 ); - accumulateResultsForSingleCase( *eclipseCase, *targetCase, resultNamesAndSamples, occupancy ); + accumulateResultsForSingleCase( *eclipseCase, *targetCase, resultNamesAndSamples, occurrence ); } - createResultVector( *targetCase, "OCCUPANCY", occupancy ); + auto createFractionVector = []( const std::vector& occurrence, int maxOccurrence ) -> std::vector + { + std::vector fractions( occurrence.size() ); + std::transform( occurrence.begin(), + occurrence.end(), + fractions.begin(), + [maxOccurrence]( int value ) { return static_cast( value ) / maxOccurrence; } ); + + return fractions; + }; + + createResultVector( *targetCase, "OCCURRENCE", occurrence ); + std::vector probability = createFractionVector( occurrence, ensemble.cases().size() ); + createResultVector( *targetCase, "PROBABILITY", probability ); for ( auto [resultName, vec] : resultNamesAndSamples ) { @@ -830,12 +843,12 @@ void RigWellTargetCandidatesGenerator::computeStatisticsAndCreateVectors( RimEcl if ( RiaStatisticsTools::isValidNumber( maxValue ) && maxValue > -std::numeric_limits::max() ) maxResults[i] = maxValue; } - createResultVector( targetCase, "ENSEMBLE_" + resultName + "_P10", p10Results ); - createResultVector( targetCase, "ENSEMBLE_" + resultName + "_P50", p50Results ); - createResultVector( targetCase, "ENSEMBLE_" + resultName + "_P90", p90Results ); - createResultVector( targetCase, "ENSEMBLE_" + resultName + "_MEAN", meanResults ); - createResultVector( targetCase, "ENSEMBLE_" + resultName + "_MIN", minResults ); - createResultVector( targetCase, "ENSEMBLE_" + resultName + "_MAX", maxResults ); + createResultVector( targetCase, resultName + "_P10", p10Results ); + createResultVector( targetCase, resultName + "_P50", p50Results ); + createResultVector( targetCase, resultName + "_P90", p90Results ); + createResultVector( targetCase, resultName + "_MEAN", meanResults ); + createResultVector( targetCase, resultName + "_MIN", minResults ); + createResultVector( targetCase, resultName + "_MAX", maxResults ); } //--------------------------------------------------------------------------------------------------