From 56a86eee5f9df3a5cc4442599d93564cdc3a187e Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 16 Aug 2021 19:50:52 +0200 Subject: [PATCH] #7871 StimPlan Model: resample well log data when not from static case --- .../RimStimPlanModelPressureCalculator.h | 12 +++---- .../RimStimPlanModelWellLogCalculator.cpp | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h index b18a79ee39..25f71d3d25 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h @@ -45,6 +45,12 @@ public: static double pressureDifferenceInterpolationOffset(); + static std::tuple, std::vector, std::vector> + interpolateMissingValues( const std::vector& staticTvDepthValues, + const std::vector& staticMeasuredDepthValues, + const std::vector& measuredDepthValues, + const std::vector& values ); + protected: bool extractValuesForProperty( RiaDefines::CurveProperty curveProperty, const RimStimPlanModel* stimPlanModel, @@ -78,12 +84,6 @@ protected: const std::vector& faciesValues, std::vector& values ) const; - static std::tuple, std::vector, std::vector> - interpolateMissingValues( const std::vector& staticTvDepthValues, - const std::vector& staticMeasuredDepthValues, - const std::vector& measuredDepthValues, - const std::vector& values ); - typedef std::pair DepthValuePair; typedef std::vector DepthValuePairVector; typedef std::map EqlNumToDepthValuePairMap; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp index 1e879cec20..3014a44d31 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp @@ -42,6 +42,7 @@ #include "RimNonNetLayers.h" #include "RimStimPlanModel.h" #include "RimStimPlanModelCalculator.h" +#include "RimStimPlanModelPressureCalculator.h" #include "RimStimPlanModelTemplate.h" #include "RimWellPath.h" @@ -203,6 +204,36 @@ bool RimStimPlanModelWellLogCalculator::calculate( RiaDefines::CurveProperty cur scaleByNetToGross( stimPlanModel, netToGross, values ); } + // Extracted well log needs to be sampled at same depths as well logs from static grid. + // If the well log is extracted from a different model it needs to be resampled. + if ( curveProperty != RiaDefines::CurveProperty::FACIES ) + { + std::vector targetMds; + std::vector targetTvds; + std::vector faciesValues; + if ( !stimPlanModel->calculator()->extractCurveData( RiaDefines::CurveProperty::FACIES, + timeStep, + faciesValues, + targetMds, + targetTvds, + rkbDiff ) ) + { + return false; + } + + if ( targetMds.size() != measuredDepthValues.size() ) + { + RiaLogging::info( "Resampling data to fit static case." ); + auto [tvds, mds, results] = RimStimPlanModelPressureCalculator::interpolateMissingValues( targetTvds, + targetMds, + measuredDepthValues, + values ); + tvDepthValues = tvds; + measuredDepthValues = mds; + values = results; + } + } + RiaLogging::debug( QString( "Well log for '%1' done. Size: %2." ) .arg( caf::AppEnum( curveProperty ).uiText() ) .arg( values.size() ) );