mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Ensemble RFT: reduce number of points in statistics curves -> makes them less squiggly
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "RifReaderEnsembleStatisticsRft.h"
|
||||
|
||||
#include "RiaCurveMerger.h"
|
||||
#include "RiaWeightedMeanCalculator.h"
|
||||
#include "RigStatisticsMath.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
@@ -198,6 +199,8 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics(const RifEclipseRftAddr
|
||||
|
||||
RiaCurveMerger<double> curveMerger;
|
||||
|
||||
RiaWeightedMeanCalculator<size_t> dataSetSizeCalc;
|
||||
|
||||
for (RimSummaryCase* summaryCase : m_summaryCaseCollection->allSummaryCases())
|
||||
{
|
||||
RifReaderRftInterface* reader = summaryCase->rftReader();
|
||||
@@ -207,8 +210,9 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics(const RifEclipseRftAddr
|
||||
std::vector<double> pressures;
|
||||
reader->values(depthAddress, &depths);
|
||||
reader->values(pressAddress, &pressures);
|
||||
|
||||
dataSetSizeCalc.addValueAndWeight(depths.size(), 1.0);
|
||||
curveMerger.addCurveData(depths, pressures);
|
||||
|
||||
}
|
||||
}
|
||||
curveMerger.computeInterpolatedValues(false);
|
||||
@@ -218,8 +222,9 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics(const RifEclipseRftAddr
|
||||
const std::vector<double>& allDepths = curveMerger.allXValues();
|
||||
if (!allDepths.empty())
|
||||
{
|
||||
m_cachedValues[depthAddress] = allDepths;
|
||||
for (size_t depthIdx = 0; depthIdx < allDepths.size(); ++depthIdx)
|
||||
// Make sure we end up with approximately the same amount of points as originally
|
||||
size_t sizeMultiplier = allDepths.size() / dataSetSizeCalc.weightedMean();
|
||||
for (size_t depthIdx = 0; depthIdx < allDepths.size(); depthIdx += sizeMultiplier)
|
||||
{
|
||||
std::vector<double> pressuresAtDepth;
|
||||
pressuresAtDepth.reserve(curveMerger.curveCount());
|
||||
@@ -231,6 +236,8 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics(const RifEclipseRftAddr
|
||||
double p10, p50, p90, mean;
|
||||
RigStatisticsMath::calculateStatisticsCurves(pressuresAtDepth, &p10, &p50, &p90, &mean);
|
||||
|
||||
m_cachedValues[depthAddress].push_back(allDepths[depthIdx]);
|
||||
|
||||
if (p10 != HUGE_VAL) m_cachedValues[p10Address].push_back(p10);
|
||||
if (p50 != HUGE_VAL) m_cachedValues[p50Address].push_back(p50);
|
||||
if (p90 != HUGE_VAL) m_cachedValues[p90Address].push_back(p90);
|
||||
|
||||
Reference in New Issue
Block a user