#8102 Ensemble Well Log Plot: Fix crash when using TVD

This commit is contained in:
Kristian Bendiksen 2021-10-21 09:55:33 +02:00
parent ccf2116d20
commit ea496072b8
8 changed files with 150 additions and 62 deletions

View File

@ -855,21 +855,24 @@ void RimEnsembleWellLogCurveSet::setLogScaleFromSelectedResult( const QString re
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::updateStatistics() bool RimEnsembleWellLogCurveSet::updateStatistics()
{ {
updateStatistics( std::vector<RimWellLogFile*>() ); return updateStatistics( std::vector<RimWellLogFile*>() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::updateStatistics( const std::vector<RimWellLogFile*>& sumCases ) bool RimEnsembleWellLogCurveSet::updateStatistics( const std::vector<RimWellLogFile*>& sumCases )
{ {
RimEnsembleWellLogs* ensembleWellLogs = m_ensembleWellLogs; RimEnsembleWellLogs* ensembleWellLogs = m_ensembleWellLogs;
QString wellLogChannelName = m_wellLogChannelName(); QString wellLogChannelName = m_wellLogChannelName();
if ( !isCurvesVisible() || m_disableStatisticCurves || !ensembleWellLogs || wellLogChannelName == "None" ) return; if ( !isCurvesVisible() || m_disableStatisticCurves || !ensembleWellLogs || wellLogChannelName == "None" )
{
m_ensembleWellLogStatistics->clearData();
return false;
}
// Calculate // Calculate
std::vector<RimWellLogFile*> wellLogFiles = sumCases; std::vector<RimWellLogFile*> wellLogFiles = sumCases;
if ( wellLogFiles.empty() ) if ( wellLogFiles.empty() )
@ -881,6 +884,7 @@ void RimEnsembleWellLogCurveSet::updateStatistics( const std::vector<RimWellLogF
} }
m_ensembleWellLogStatistics->calculate( wellLogFiles, wellLogChannelName, m_depthEqualization() ); m_ensembleWellLogStatistics->calculate( wellLogFiles, wellLogChannelName, m_depthEqualization() );
return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -888,7 +892,9 @@ void RimEnsembleWellLogCurveSet::updateStatistics( const std::vector<RimWellLogF
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector<RimWellLogFile*>& sumCases ) void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector<RimWellLogFile*>& sumCases )
{ {
updateStatistics( sumCases ); deleteStatisticsCurves();
if ( !updateStatistics( sumCases ) ) return;
RimWellLogPlot* plot = nullptr; RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfType( plot ); firstAncestorOrThisOfType( plot );
@ -919,7 +925,6 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector<RimWe
firstAncestorOrThisOfType( plotTrack ); firstAncestorOrThisOfType( plotTrack );
CVF_ASSERT( plotTrack ); CVF_ASSERT( plotTrack );
deleteStatisticsCurves();
for ( auto statisticsType : statisticsTypes ) for ( auto statisticsType : statisticsTypes )
{ {
auto curve = new RimEnsembleWellLogStatisticsCurve(); auto curve = new RimEnsembleWellLogStatisticsCurve();
@ -1258,8 +1263,8 @@ cvf::ref<RigWellPathFormations>
for ( int kLayer : offsets->sortedIndexes() ) for ( int kLayer : offsets->sortedIndexes() )
{ {
RigWellPathFormation wellPathFormation; RigWellPathFormation wellPathFormation;
wellPathFormation.mdTop = offsets->getTopDepth( kLayer ); wellPathFormation.mdTop = offsets->getTopMd( kLayer );
wellPathFormation.mdBase = offsets->getBottomDepth( kLayer ); wellPathFormation.mdBase = offsets->getBottomMd( kLayer );
wellPathFormation.formationName = formationNames->formationNameFromKLayerIdx( kLayer - 1 ); wellPathFormation.formationName = formationNames->formationNameFromKLayerIdx( kLayer - 1 );
wellPathFormationItems.push_back( wellPathFormation ); wellPathFormationItems.push_back( wellPathFormation );
} }

View File

@ -119,7 +119,7 @@ public:
RimEnsembleWellLogStatistics::DepthEqualization depthEqualization() const; RimEnsembleWellLogStatistics::DepthEqualization depthEqualization() const;
void setDepthEqualization( RimEnsembleWellLogStatistics::DepthEqualization depthEqualization ); void setDepthEqualization( RimEnsembleWellLogStatistics::DepthEqualization depthEqualization );
void updateStatistics(); bool updateStatistics();
void setEnsembleWellLogs( RimEnsembleWellLogs* ensembleWellLogs ); void setEnsembleWellLogs( RimEnsembleWellLogs* ensembleWellLogs );
void setWellLogChannelName( const QString& wellLogChannelName ); void setWellLogChannelName( const QString& wellLogChannelName );
@ -131,7 +131,7 @@ public:
private: private:
void updateEnsembleCurves( const std::vector<RimWellLogFile*>& curves ); void updateEnsembleCurves( const std::vector<RimWellLogFile*>& curves );
void updateStatisticsCurves( const std::vector<RimWellLogFile*>& curves ); void updateStatisticsCurves( const std::vector<RimWellLogFile*>& curves );
void updateStatistics( const std::vector<RimWellLogFile*>& sumCases ); bool updateStatistics( const std::vector<RimWellLogFile*>& sumCases );
caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override; caf::PdmFieldHandle* objectToggleField() override;

View File

@ -87,6 +87,7 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
const QString& wellLogChannelName ) const QString& wellLogChannelName )
{ {
RiaCurveMerger<double> curveMerger; RiaCurveMerger<double> curveMerger;
RiaCurveMerger<double> tvdCurveMerger;
RiaWeightedMeanCalculator<size_t> dataSetSizeCalc; RiaWeightedMeanCalculator<size_t> dataSetSizeCalc;
@ -112,11 +113,13 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
m_logChannelUnitString = logChannelUnitString; m_logChannelUnitString = logChannelUnitString;
std::vector<double> depths = fileData->depthValues(); std::vector<double> depths = fileData->depthValues();
std::vector<double> tvdMslValues = fileData->tvdMslValues();
std::vector<double> values = fileData->values( wellLogChannelName ); std::vector<double> values = fileData->values( wellLogChannelName );
if ( !depths.empty() && !values.empty() ) if ( !depths.empty() && !values.empty() && !tvdMslValues.empty() )
{ {
dataSetSizeCalc.addValueAndWeight( depths.size(), 1.0 ); dataSetSizeCalc.addValueAndWeight( depths.size(), 1.0 );
curveMerger.addCurveData( depths, values ); curveMerger.addCurveData( depths, values );
tvdCurveMerger.addCurveData( depths, tvdMslValues );
} }
} }
else else
@ -125,6 +128,7 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
} }
} }
curveMerger.computeInterpolatedValues( true ); curveMerger.computeInterpolatedValues( true );
tvdCurveMerger.computeInterpolatedValues( true );
clearData(); clearData();
@ -144,6 +148,7 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
const std::vector<double>& curveValues = curveMerger.interpolatedYValuesForAllXValues( curveIdx ); const std::vector<double>& curveValues = curveMerger.interpolatedYValuesForAllXValues( curveIdx );
valuesAtDepth.push_back( curveValues[depthIdx] ); valuesAtDepth.push_back( curveValues[depthIdx] );
} }
double p10, p50, p90, mean; double p10, p50, p90, mean;
RigStatisticsMath::calculateStatisticsCurves( valuesAtDepth, RigStatisticsMath::calculateStatisticsCurves( valuesAtDepth,
&p10, &p10,
@ -152,6 +157,30 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
&mean, &mean,
RigStatisticsMath::PercentileStyle::SWITCHED ); RigStatisticsMath::PercentileStyle::SWITCHED );
// TVD is the mean TVD at a given MD
std::vector<double> tvdsAtDepth;
tvdsAtDepth.reserve( tvdCurveMerger.curveCount() );
for ( size_t curveIdx = 0; curveIdx < tvdCurveMerger.curveCount(); ++curveIdx )
{
const std::vector<double>& curveValues = tvdCurveMerger.interpolatedYValuesForAllXValues( curveIdx );
tvdsAtDepth.push_back( curveValues[depthIdx] );
}
double sumTvds = 0.0;
int numTvds = 0;
for ( auto tvd : tvdsAtDepth )
{
if ( !std::isinf( tvd ) )
{
sumTvds += tvd;
numTvds++;
}
}
double meanTvd = sumTvds / numTvds;
m_tvDepths.push_back( meanTvd );
m_measuredDepths.push_back( allDepths[depthIdx] ); m_measuredDepths.push_back( allDepths[depthIdx] );
m_p10Data.push_back( p10 ); m_p10Data.push_back( p10 );
m_p50Data.push_back( p50 ); m_p50Data.push_back( p50 );
@ -217,8 +246,8 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
std::vector<int> kIndexes = offsets->sortedIndexes(); std::vector<int> kIndexes = offsets->sortedIndexes();
for ( auto kIndex : kIndexes ) for ( auto kIndex : kIndexes )
{ {
double topMean = -1.0; double topMean = 0.0;
double bottomMean = -2.3; double bottomMean = 0.0;
// Top first // Top first
{ {
std::vector<double> valuesAtDepth = topValues[kIndex]; std::vector<double> valuesAtDepth = topValues[kIndex];
@ -229,7 +258,8 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
&p90, &p90,
&mean, &mean,
RigStatisticsMath::PercentileStyle::SWITCHED ); RigStatisticsMath::PercentileStyle::SWITCHED );
m_measuredDepths.push_back( offsets->getTopDepth( kIndex ) ); m_measuredDepths.push_back( offsets->getTopMd( kIndex ) );
m_tvDepths.push_back( offsets->getTopTvd( kIndex ) );
m_p10Data.push_back( p10 ); m_p10Data.push_back( p10 );
m_p50Data.push_back( p50 ); m_p50Data.push_back( p50 );
m_p90Data.push_back( p90 ); m_p90Data.push_back( p90 );
@ -248,7 +278,8 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
&p90, &p90,
&mean, &mean,
RigStatisticsMath::PercentileStyle::SWITCHED ); RigStatisticsMath::PercentileStyle::SWITCHED );
m_measuredDepths.push_back( offsets->getBottomDepth( kIndex ) ); m_measuredDepths.push_back( offsets->getBottomMd( kIndex ) );
m_tvDepths.push_back( offsets->getBottomTvd( kIndex ) );
m_p10Data.push_back( p10 ); m_p10Data.push_back( p10 );
m_p50Data.push_back( p50 ); m_p50Data.push_back( p50 );
m_p90Data.push_back( p90 ); m_p90Data.push_back( p90 );
@ -259,8 +290,8 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
RiaLogging::debug( QString( "[%1] top: %2 bttom: %3 %4 %5" ) RiaLogging::debug( QString( "[%1] top: %2 bttom: %3 %4 %5" )
.arg( kIndex ) .arg( kIndex )
.arg( offsets->getTopDepth( kIndex ) ) .arg( offsets->getTopMd( kIndex ) )
.arg( offsets->getBottomDepth( kIndex ) ) .arg( offsets->getBottomMd( kIndex ) )
.arg( topMean ) .arg( topMean )
.arg( bottomMean ) ); .arg( bottomMean ) );
} }
@ -272,11 +303,13 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
std::shared_ptr<RigWellLogIndexDepthOffset> std::shared_ptr<RigWellLogIndexDepthOffset>
RimEnsembleWellLogStatistics::calculateIndexDepthOffset( const std::vector<RimWellLogFile*>& wellLogFiles ) RimEnsembleWellLogStatistics::calculateIndexDepthOffset( const std::vector<RimWellLogFile*>& wellLogFiles )
{ {
std::map<int, double> sumTopDepths; std::map<int, double> sumTopMds;
std::map<int, int> numTopDepths; std::map<int, double> sumTopTvds;
std::map<int, int> numTopMds;
std::map<int, double> sumBottomDepths; std::map<int, double> sumBottomMds;
std::map<int, int> numBottomDepths; std::map<int, double> sumBottomTvds;
std::map<int, int> numBottomMds;
int minLayerK = std::numeric_limits<int>::max(); int minLayerK = std::numeric_limits<int>::max();
int maxLayerK = -std::numeric_limits<int>::max(); int maxLayerK = -std::numeric_limits<int>::max();
@ -291,11 +324,12 @@ std::shared_ptr<RigWellLogIndexDepthOffset>
RigWellLogFile* fileData = wellLogFile->wellLogFileData(); RigWellLogFile* fileData = wellLogFile->wellLogFileData();
std::vector<double> depths = fileData->depthValues(); std::vector<double> depths = fileData->depthValues();
std::vector<double> tvdDepths = fileData->tvdMslValues();
std::vector<double> kIndexValues = fileData->values( RiaResultNames::indexKResultName() ); std::vector<double> kIndexValues = fileData->values( RiaResultNames::indexKResultName() );
std::set<int> seenTopIndexes; std::set<int> seenTopIndexes;
std::set<int> seenBottomIndexes; std::set<int> seenBottomIndexes;
if ( !depths.empty() && !kIndexValues.empty() ) if ( !depths.empty() && !tvdDepths.empty() && !kIndexValues.empty() )
{ {
// Find top indexes // Find top indexes
for ( size_t i = 0; i < kIndexValues.size(); i++ ) for ( size_t i = 0; i < kIndexValues.size(); i++ )
@ -307,8 +341,9 @@ std::shared_ptr<RigWellLogIndexDepthOffset>
// This is depth of the top of the index since the file is // This is depth of the top of the index since the file is
// sorted by increasing depth. // sorted by increasing depth.
seenTopIndexes.insert( kLayer ); seenTopIndexes.insert( kLayer );
sumTopDepths[kLayer] += depths[i]; sumTopMds[kLayer] += depths[i];
numTopDepths[kLayer] += 1; sumTopTvds[kLayer] += tvdDepths[i];
numTopMds[kLayer] += 1;
minLayerK = std::min( minLayerK, kLayer ); minLayerK = std::min( minLayerK, kLayer );
maxLayerK = std::max( maxLayerK, kLayer ); maxLayerK = std::max( maxLayerK, kLayer );
} }
@ -324,8 +359,9 @@ std::shared_ptr<RigWellLogIndexDepthOffset>
// This is depth of the bottom of the index since the file is // This is depth of the bottom of the index since the file is
// sorted by increasing depth. // sorted by increasing depth.
seenBottomIndexes.insert( kLayer ); seenBottomIndexes.insert( kLayer );
sumBottomDepths[kLayer] += depths[i]; sumBottomMds[kLayer] += depths[i];
numBottomDepths[kLayer] += 1; sumBottomTvds[kLayer] += tvdDepths[i];
numBottomMds[kLayer] += 1;
} }
} }
} }
@ -346,17 +382,19 @@ std::shared_ptr<RigWellLogIndexDepthOffset>
std::shared_ptr<RigWellLogIndexDepthOffset> offset = std::make_shared<RigWellLogIndexDepthOffset>(); std::shared_ptr<RigWellLogIndexDepthOffset> offset = std::make_shared<RigWellLogIndexDepthOffset>();
for ( int kLayer = minLayerK; kLayer <= maxLayerK; kLayer++ ) for ( int kLayer = minLayerK; kLayer <= maxLayerK; kLayer++ )
{ {
if ( numTopDepths[kLayer] > 0 && numBottomDepths[kLayer] > 0 ) if ( numTopMds[kLayer] > 0 && numBottomMds[kLayer] > 0 )
{ {
double topDepth = sumTopDepths[kLayer] / numTopDepths[kLayer]; double topMd = sumTopMds[kLayer] / numTopMds[kLayer];
double bottomDepth = sumBottomDepths[kLayer] / numBottomDepths[kLayer]; double bottomMd = sumBottomMds[kLayer] / numBottomMds[kLayer];
double topTvd = sumTopTvds[kLayer] / numBottomMds[kLayer];
double bottomTvd = sumBottomTvds[kLayer] / numBottomMds[kLayer];
RiaLogging::debug( QString( "K: %1 mean depth range: %2 - %3 Samples: %4 - %5" ) RiaLogging::debug( QString( "K: %1 mean depth range: %2 - %3 Samples: %4 - %5" )
.arg( kLayer ) .arg( kLayer )
.arg( topDepth ) .arg( topMd )
.arg( bottomDepth ) .arg( bottomMd )
.arg( numTopDepths[kLayer] ) .arg( numTopMds[kLayer] )
.arg( numBottomDepths[kLayer] ) ); .arg( numBottomMds[kLayer] ) );
offset->setIndexOffsetDepth( kLayer, topDepth, bottomDepth ); offset->setIndexOffsetDepth( kLayer, topMd, bottomMd, topTvd, bottomTvd );
} }
} }

View File

@ -72,12 +72,12 @@ public:
static std::shared_ptr<RigWellLogIndexDepthOffset> static std::shared_ptr<RigWellLogIndexDepthOffset>
calculateIndexDepthOffset( const std::vector<RimWellLogFile*>& wellLogFiles ); calculateIndexDepthOffset( const std::vector<RimWellLogFile*>& wellLogFiles );
void clearData();
private: private:
void calculate( const std::vector<RimWellLogFile*>& sumCases, const QString& wellLogChannelName ); void calculate( const std::vector<RimWellLogFile*>& sumCases, const QString& wellLogChannelName );
void calculateByKLayer( const std::vector<RimWellLogFile*>& sumCases, const QString& wellLogChannelName ); void calculateByKLayer( const std::vector<RimWellLogFile*>& sumCases, const QString& wellLogChannelName );
void clearData();
QString m_logChannelUnitString; QString m_logChannelUnitString;
RiaDefines::DepthUnitType m_depthUnit; RiaDefines::DepthUnitType m_depthUnit;
std::vector<double> m_measuredDepths; std::vector<double> m_measuredDepths;

View File

@ -108,36 +108,49 @@ void RimEnsembleWellLogStatisticsCurve::performDataExtraction( bool* isUsingPseu
{ {
values = ensembleWellLogStatistics->mean(); values = ensembleWellLogStatistics->mean();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths(); measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
tvDepthValues = ensembleWellLogStatistics->tvDepths();
} }
else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P10 ) else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P10 )
{ {
values = ensembleWellLogStatistics->p10(); values = ensembleWellLogStatistics->p10();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths(); measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
tvDepthValues = ensembleWellLogStatistics->tvDepths();
} }
else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P50 ) else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P50 )
{ {
values = ensembleWellLogStatistics->p50(); values = ensembleWellLogStatistics->p50();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths(); measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
tvDepthValues = ensembleWellLogStatistics->tvDepths();
} }
else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P90 ) else if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P90 )
{ {
values = ensembleWellLogStatistics->p90(); values = ensembleWellLogStatistics->p90();
measuredDepthValues = ensembleWellLogStatistics->measuredDepths(); measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
tvDepthValues = ensembleWellLogStatistics->tvDepths();
} }
bool performDataSmoothing = false;
if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() ) if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() )
{ {
if ( m_ensembleWellLogCurveSet->depthEqualization() == RimEnsembleWellLogStatistics::DepthEqualization::NONE ) if ( m_ensembleWellLogCurveSet->depthEqualization() == RimEnsembleWellLogStatistics::DepthEqualization::NONE )
{
std::vector<double> dummyValues( values.begin(), values.end() );
addDatapointsForBottomOfSegment( measuredDepthValues, values ); addDatapointsForBottomOfSegment( measuredDepthValues, values );
// Pass copy of values vector to avoid adding bottom segments twice
addDatapointsForBottomOfSegment( tvDepthValues, dummyValues );
}
this->setValuesAndDepths( values, std::map<RiaDefines::DepthTypeEnum, std::vector<double>> validDepths;
measuredDepthValues, if ( values.size() == measuredDepthValues.size() )
RiaDefines::DepthTypeEnum::MEASURED_DEPTH, {
rkbDiff, validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, measuredDepthValues ) );
depthUnit, }
!performDataSmoothing, if ( values.size() == tvDepthValues.size() )
xUnits ); {
validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, tvDepthValues ) );
validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB, tvDepthValues ) );
}
this->setValuesAndDepths( values, validDepths, rkbDiff, depthUnit, false );
} }
} }
} }

View File

@ -242,11 +242,11 @@ std::pair<std::vector<double>, std::vector<double>>
if ( firstIndex != kIndexValues.size() && lastIndex != kIndexValues.size() ) if ( firstIndex != kIndexValues.size() && lastIndex != kIndexValues.size() )
{ {
// Add top // Add top
measuredDepthValuesAdjusted.push_back( m_indexDepthOffsets->getTopDepth( kLayer ) ); measuredDepthValuesAdjusted.push_back( m_indexDepthOffsets->getTopMd( kLayer ) );
valuesAdjusted.push_back( values[firstIndex] ); valuesAdjusted.push_back( values[firstIndex] );
// Add bottom of layer // Add bottom of layer
measuredDepthValuesAdjusted.push_back( m_indexDepthOffsets->getBottomDepth( kLayer ) ); measuredDepthValuesAdjusted.push_back( m_indexDepthOffsets->getBottomMd( kLayer ) );
valuesAdjusted.push_back( values[lastIndex] ); valuesAdjusted.push_back( values[lastIndex] );
} }
} }

View File

@ -23,18 +23,19 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogIndexDepthOffset::setIndexOffsetDepth( int kIndex, double topDepth, double bottomDepth ) void RigWellLogIndexDepthOffset::setIndexOffsetDepth( int kIndex, double topMd, double bottomMd, double topTvd, double bottomTvd )
{ {
m_depthOffsets[kIndex] = std::pair<double, double>( topDepth, bottomDepth ); m_mdOffsets[kIndex] = std::pair<double, double>( topMd, bottomMd );
m_tvdOffsets[kIndex] = std::pair<double, double>( topTvd, bottomTvd );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RigWellLogIndexDepthOffset::getTopDepth( int kIndex ) const double RigWellLogIndexDepthOffset::getTopMd( int kIndex ) const
{ {
auto hit = m_depthOffsets.find( kIndex ); auto hit = m_mdOffsets.find( kIndex );
if ( hit != m_depthOffsets.end() ) if ( hit != m_mdOffsets.end() )
{ {
return hit->second.first; return hit->second.first;
} }
@ -45,10 +46,38 @@ double RigWellLogIndexDepthOffset::getTopDepth( int kIndex ) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RigWellLogIndexDepthOffset::getBottomDepth( int kIndex ) const double RigWellLogIndexDepthOffset::getBottomMd( int kIndex ) const
{ {
auto hit = m_depthOffsets.find( kIndex ); auto hit = m_mdOffsets.find( kIndex );
if ( hit != m_depthOffsets.end() ) if ( hit != m_mdOffsets.end() )
{
return hit->second.second;
}
return std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigWellLogIndexDepthOffset::getTopTvd( int kIndex ) const
{
auto hit = m_tvdOffsets.find( kIndex );
if ( hit != m_tvdOffsets.end() )
{
return hit->second.first;
}
return std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigWellLogIndexDepthOffset::getBottomTvd( int kIndex ) const
{
auto hit = m_tvdOffsets.find( kIndex );
if ( hit != m_tvdOffsets.end() )
{ {
return hit->second.second; return hit->second.second;
} }
@ -62,7 +91,7 @@ double RigWellLogIndexDepthOffset::getBottomDepth( int kIndex ) const
std::vector<int> RigWellLogIndexDepthOffset::sortedIndexes() const std::vector<int> RigWellLogIndexDepthOffset::sortedIndexes() const
{ {
std::vector<int> indexes; std::vector<int> indexes;
for ( auto m : m_depthOffsets ) for ( auto m : m_mdOffsets )
{ {
indexes.push_back( m.first ); indexes.push_back( m.first );
} }

View File

@ -28,11 +28,14 @@ public:
RigWellLogIndexDepthOffset() = default; RigWellLogIndexDepthOffset() = default;
~RigWellLogIndexDepthOffset() override = default; ~RigWellLogIndexDepthOffset() override = default;
void setIndexOffsetDepth( int kIndex, double topDepth, double bottomDepth ); void setIndexOffsetDepth( int kIndex, double topMd, double bottomMd, double topTvd, double bottomTvd );
double getTopDepth( int kIndex ) const; double getTopMd( int kIndex ) const;
double getBottomDepth( int kIndex ) const; double getBottomMd( int kIndex ) const;
double getTopTvd( int kIndex ) const;
double getBottomTvd( int kIndex ) const;
std::vector<int> sortedIndexes() const; std::vector<int> sortedIndexes() const;
private: private:
std::map<int, std::pair<double, double>> m_depthOffsets; std::map<int, std::pair<double, double>> m_mdOffsets;
std::map<int, std::pair<double, double>> m_tvdOffsets;
}; };