From eab4e33b0f8b544358910ccb12073fa4c3f80180 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 22 Sep 2023 19:13:16 +0200 Subject: [PATCH] working prototype --- .../Summary/RimEnsembleStatisticsCase.cpp | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index be52146794..c050943fb8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -307,16 +307,21 @@ void RimEnsembleStatisticsCase::calculate( const std::vector& s } else { - // Compute statistics on binnedYValues - double p10, p50, p90, mean; - RigStatisticsMath::calculateStatisticsCurves( binnedYValues, &p10, &p50, &p90, &mean, RigStatisticsMath::PercentileStyle::SWITCHED ); - m_p10Data.push_back( p10 ); - m_p50Data.push_back( p50 ); - m_p90Data.push_back( p90 ); - m_meanData.push_back( mean ); + const size_t minimumCount = 500; + + if ( binnedYValues.size() > minimumCount ) + { + double p10, p50, p90, mean; + RigStatisticsMath::calculateStatisticsCurves( binnedYValues, &p10, &p50, &p90, &mean, RigStatisticsMath::PercentileStyle::SWITCHED ); + m_p10Data.push_back( p10 ); + m_p50Data.push_back( p50 ); + m_p90Data.push_back( p90 ); + m_meanData.push_back( mean ); + + m_binnedXValues.emplace_back( currentX ); + } currentX += deltaRangeX; - m_binnedXValues.emplace_back( currentX ); binnedYValues.clear(); } }