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(); } }