Merge pull request #5062 from OPM/bug-#5061-wap-depth

Bug #5061 wap depth
This commit is contained in:
Magne Sjaastad 2019-11-19 14:13:15 +01:00 committed by GitHub
commit c042aec22a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 283 additions and 290 deletions

View File

@ -48,6 +48,16 @@ void caf::AppEnum<RiaDefines::DepthUnitType>::setUp()
setDefault( RiaDefines::UNIT_METER ); setDefault( RiaDefines::UNIT_METER );
} }
template <>
void caf::AppEnum<RiaDefines::DepthTypeEnum>::setUp()
{
addItem( RiaDefines::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" );
addItem( RiaDefines::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" );
addItem( RiaDefines::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" );
addItem( RiaDefines::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" );
setDefault( RiaDefines::MEASURED_DEPTH );
}
template <> template <>
void caf::AppEnum<RiaDefines::PlotAxis>::setUp() void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
{ {

View File

@ -137,6 +137,15 @@ enum DepthUnitType
UNIT_NONE UNIT_NONE
}; };
// Depth types used for well log plots
enum DepthTypeEnum
{
MEASURED_DEPTH,
TRUE_VERTICAL_DEPTH,
PSEUDO_LENGTH,
CONNECTION_NUMBER
};
// Defines relate to plotting // Defines relate to plotting
enum PlotAxis enum PlotAxis
{ {

View File

@ -101,7 +101,7 @@ RimWellBoreStabilityPlot*
plot->setPlotTitleVisible( true ); plot->setPlotTitleVisible( true );
plot->setLegendsVisible( true ); plot->setLegendsVisible( true );
plot->setLegendsHorizontal( true ); plot->setLegendsHorizontal( true );
plot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH ); plot->setDepthType( RiaDefines::TRUE_VERTICAL_DEPTH );
plot->setAutoScaleYEnabled( true ); plot->setAutoScaleYEnabled( true );
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot ); RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );

View File

@ -99,7 +99,7 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden( true ); m_accumulatedWellFlowPlot.uiCapability()->setUiHidden( true );
m_accumulatedWellFlowPlot = new RimWellLogPlot; m_accumulatedWellFlowPlot = new RimWellLogPlot;
m_accumulatedWellFlowPlot->setDepthUnit( RiaDefines::UNIT_NONE ); m_accumulatedWellFlowPlot->setDepthUnit( RiaDefines::UNIT_NONE );
m_accumulatedWellFlowPlot->setDepthType( RimWellLogPlot::CONNECTION_NUMBER ); m_accumulatedWellFlowPlot->setDepthType( RiaDefines::CONNECTION_NUMBER );
m_accumulatedWellFlowPlot->setLegendsVisible( false ); m_accumulatedWellFlowPlot->setLegendsVisible( false );
m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" ); m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" );
@ -124,7 +124,7 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} ); m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} );
m_accumulatedWellFlowPlot->setAvailableDepthTypes( m_accumulatedWellFlowPlot->setAvailableDepthTypes(
{RimWellLogPlot::CONNECTION_NUMBER, RimWellLogPlot::TRUE_VERTICAL_DEPTH, RimWellLogPlot::PSEUDO_LENGTH} ); {RiaDefines::CONNECTION_NUMBER, RiaDefines::TRUE_VERTICAL_DEPTH, RiaDefines::PSEUDO_LENGTH} );
m_accumulatedWellFlowPlot->setCommonDataSourceEnabled( false ); m_accumulatedWellFlowPlot->setCommonDataSourceEnabled( false );
@ -264,7 +264,7 @@ void RimWellAllocationPlot::updateFromWell()
auto depthType = accumulatedWellFlowPlot()->depthType(); auto depthType = accumulatedWellFlowPlot()->depthType();
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return; if ( depthType == RiaDefines::MEASURED_DEPTH ) return;
// Create tracks and curves from the calculated data // Create tracks and curves from the calculated data
@ -282,11 +282,11 @@ void RimWellAllocationPlot::updateFromWell()
accumulatedWellFlowPlot()->addPlot( plotTrack ); accumulatedWellFlowPlot()->addPlot( plotTrack );
const std::vector<double>& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER const std::vector<double>& depthValues = depthType == RiaDefines::CONNECTION_NUMBER
? wfCalculator->connectionNumbersFromTop( brIdx ) ? wfCalculator->connectionNumbersFromTop( brIdx )
: depthType == RimWellLogPlot::PSEUDO_LENGTH : depthType == RiaDefines::PSEUDO_LENGTH
? wfCalculator->pseudoLengthFromTop( brIdx ) ? wfCalculator->pseudoLengthFromTop( brIdx )
: depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH : depthType == RiaDefines::TRUE_VERTICAL_DEPTH
? wfCalculator->trueVerticalDepth( brIdx ) ? wfCalculator->trueVerticalDepth( brIdx )
: std::vector<double>(); : std::vector<double>();
@ -295,13 +295,13 @@ void RimWellAllocationPlot::updateFromWell()
for ( const QString& tracerName : tracerNames ) for ( const QString& tracerName : tracerNames )
{ {
const std::vector<double>* accFlow = nullptr; const std::vector<double>* accFlow = nullptr;
if ( depthType == RimWellLogPlot::CONNECTION_NUMBER ) if ( depthType == RiaDefines::CONNECTION_NUMBER )
{ {
accFlow = &( m_flowType == ACCUMULATED accFlow = &( m_flowType == ACCUMULATED
? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx ) ? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx )
: wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) ); : wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) );
} }
else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::PSEUDO_LENGTH || depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
accFlow = &( m_flowType == ACCUMULATED accFlow = &( m_flowType == ACCUMULATED
? wfCalculator->accumulatedTracerFlowPrPseudoLength( tracerName, brIdx ) ? wfCalculator->accumulatedTracerFlowPrPseudoLength( tracerName, brIdx )
@ -310,7 +310,7 @@ void RimWellAllocationPlot::updateFromWell()
if ( accFlow ) if ( accFlow )
{ {
addStackedCurve( tracerName, depthValues, *accFlow, plotTrack ); addStackedCurve( tracerName, depthType, depthValues, *accFlow, plotTrack );
// TODO: THIs is the data to be plotted... // TODO: THIs is the data to be plotted...
} }
} }
@ -463,12 +463,13 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotT
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::addStackedCurve( const QString& tracerName, void RimWellAllocationPlot::addStackedCurve( const QString& tracerName,
RiaDefines::DepthTypeEnum depthType,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack ) RimWellLogTrack* plotTrack )
{ {
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue( tracerName, depthValues, accFlow ); curve->setFlowValuesPrDepthValue( tracerName, depthType, depthValues, accFlow );
if ( m_flowDiagSolution ) if ( m_flowDiagSolution )
{ {

View File

@ -115,6 +115,7 @@ private:
void updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack ); void updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack );
void addStackedCurve( const QString& tracerName, void addStackedCurve( const QString& tracerName,
RiaDefines::DepthTypeEnum depthType,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack ); RimWellLogTrack* plotTrack );

View File

@ -218,7 +218,8 @@ void RimWellFlowRateCurve::updateStackedPlotData()
bool isFirstTrack = ( wellLogTrack == wellLogPlot->plotByIndex( 0 ) ); bool isFirstTrack = ( wellLogTrack == wellLogPlot->plotByIndex( 0 ) );
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE; RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE;
std::vector<double> depthValues; std::vector<double> depthValues;
std::vector<double> stackedValues; std::vector<double> stackedValues;
@ -236,7 +237,7 @@ void RimWellFlowRateCurve::updateStackedPlotData()
stackedCurves = stackedCurveGroups[groupId()]; stackedCurves = stackedCurveGroups[groupId()];
} }
std::vector<double> allDepthValues = curveData()->measuredDepths(); std::vector<double> allDepthValues = curveData()->depths( depthType );
std::vector<double> allStackedValues( allDepthValues.size() ); std::vector<double> allStackedValues( allDepthValues.size() );
for ( RimWellFlowRateCurve* stCurve : stackedCurves ) for ( RimWellFlowRateCurve* stCurve : stackedCurves )
@ -256,9 +257,9 @@ void RimWellFlowRateCurve::updateStackedPlotData()
} }
RigWellLogCurveData tempCurveData; RigWellLogCurveData tempCurveData;
tempCurveData.setValuesAndMD( allStackedValues, allDepthValues, RiaDefines::UNIT_NONE, false ); tempCurveData.setValuesAndDepths( allStackedValues, allDepthValues, depthType, RiaDefines::UNIT_NONE, false );
depthValues = tempCurveData.measuredDepthPlotValues( displayUnit ); depthValues = tempCurveData.depthPlotValues( depthType, displayUnit );
stackedValues = tempCurveData.xPlotValues(); stackedValues = tempCurveData.xPlotValues();
polyLineStartStopIndices = tempCurveData.polylineStartStopIndices(); polyLineStartStopIndices = tempCurveData.polylineStartStopIndices();
} }
@ -321,7 +322,7 @@ bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
{ {
RimWellLogPlot* wellLogPlot; RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot ); firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::CONNECTION_NUMBER ) if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::CONNECTION_NUMBER )
{ {
return true; return true;
} }
@ -344,10 +345,11 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setFlowValuesPrDepthValue( const QString& curveName, void RimWellFlowRateCurve::setFlowValuesPrDepthValue( const QString& curveName,
RiaDefines::DepthTypeEnum depthType,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& flowRates ) const std::vector<double>& flowRates )
{ {
this->setValuesAndMD( flowRates, depthValues, RiaDefines::UNIT_NONE, false ); this->setValuesAndDepths( flowRates, depthValues, depthType, RiaDefines::UNIT_NONE, false );
m_curveAutoName = curveName; m_curveAutoName = curveName;
} }

View File

@ -39,6 +39,7 @@ public:
~RimWellFlowRateCurve() override; ~RimWellFlowRateCurve() override;
void setFlowValuesPrDepthValue( const QString& curveName, void setFlowValuesPrDepthValue( const QString& curveName,
RiaDefines::DepthTypeEnum depthType,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& flowRates ); const std::vector<double>& flowRates );
void updateStackedPlotData(); void updateStackedPlotData();

View File

@ -139,7 +139,7 @@ RimWellPltPlot::RimWellPltPlot()
m_doInitAfterLoad = false; m_doInitAfterLoad = false;
m_isOnLoad = true; m_isOnLoad = true;
setAvailableDepthTypes( {RimWellLogPlot::MEASURED_DEPTH} ); setAvailableDepthTypes( {RiaDefines::MEASURED_DEPTH} );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -725,7 +725,7 @@ void RimWellPltPlot::addStackedCurve( const QString& curveName,
bool doFillCurve ) bool doFillCurve )
{ {
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue( curveName, depthValues, accFlow ); curve->setFlowValuesPrDepthValue( curveName, depthType(), depthValues, accFlow );
curve->setColor( color ); curve->setColor( color );
curve->setGroupId( curveGroupId ); curve->setGroupId( curveGroupId );

View File

@ -88,7 +88,7 @@ RimWellRftPlot::RimWellRftPlot()
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true ); m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true );
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false ); m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
m_depthType = RimWellLogPlot::TRUE_VERTICAL_DEPTH; m_depthType = RiaDefines::TRUE_VERTICAL_DEPTH;
CAF_PDM_InitFieldNoDefault( &m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", "" );
CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "" ); CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "" );
@ -620,7 +620,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
} }
} }
if ( depthType() == RimWellLogPlot::MEASURED_DEPTH ) if ( depthType() == RiaDefines::MEASURED_DEPTH )
{ {
assignWellPathToExtractionCurves(); assignWellPathToExtractionCurves();
} }
@ -1038,7 +1038,7 @@ void RimWellRftPlot::onLoadDataAndUpdate()
updateMdiWindowVisibility(); updateMdiWindowVisibility();
updateFormationsOnPlot(); updateFormationsOnPlot();
if ( depthType() == RimWellLogPlot::MEASURED_DEPTH ) if ( depthType() == RiaDefines::MEASURED_DEPTH )
{ {
assignWellPathToExtractionCurves(); assignWellPathToExtractionCurves();
} }

View File

@ -80,7 +80,7 @@ void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector<double>* values, std::
// These values are for a simulation well // These values are for a simulation well
*values = curveData->xValues(); *values = curveData->xValues();
*measuredDepthValues = curveData->measuredDepths(); *measuredDepthValues = curveData->depths( RiaDefines::MEASURED_DEPTH );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -52,12 +52,8 @@ RimWellLogCurve::RimWellLogCurve()
m_curveData = new RigWellLogCurveData; m_curveData = new RigWellLogCurveData;
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(), m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() ); -std::numeric_limits<double>::infinity() );
m_curveDataMDRange = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() );
m_curveDataTVDRange = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -104,28 +100,19 @@ bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumVa
RimWellLogPlot* wellLogPlot = nullptr; RimWellLogPlot* wellLogPlot = nullptr;
firstAncestorOrThisOfTypeAsserted( wellLogPlot ); firstAncestorOrThisOfTypeAsserted( wellLogPlot );
if ( wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) auto depthRangeIt = m_curveDataDepthRange.find( wellLogPlot->depthType() );
if ( depthRangeIt == m_curveDataDepthRange.end() )
{ {
if ( m_curveDataTVDRange.first == -std::numeric_limits<double>::infinity() || return false;
m_curveDataTVDRange.second == std::numeric_limits<double>::infinity() )
{
return false;
}
*minimumValue = m_curveDataTVDRange.first;
*maximumValue = m_curveDataTVDRange.second;
} }
else // MD, Connection number and Pseudo length.
if ( depthRangeIt->second.first == -std::numeric_limits<double>::infinity() ||
depthRangeIt->second.second == std::numeric_limits<double>::infinity() )
{ {
if ( m_curveDataMDRange.first == -std::numeric_limits<double>::infinity() || return false;
m_curveDataMDRange.second == std::numeric_limits<double>::infinity() )
{
return false;
}
*minimumValue = m_curveDataMDRange.first;
*maximumValue = m_curveDataMDRange.second;
} }
*minimumValue = depthRangeIt->second.first;
*maximumValue = depthRangeIt->second.second;
return true; return true;
} }
@ -133,12 +120,25 @@ bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumVa
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setValuesAndMD( const std::vector<double>& xValues, void RimWellLogCurve::setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::vector<double>& measuredDepths,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthTypeEnum depthType,
bool isExtractionCurve ) RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve )
{ {
m_curveData->setValuesAndMD( xValues, measuredDepths, depthUnit, isExtractionCurve ); m_curveData->setValuesAndDepths( xValues, measuredDepths, depthType, depthUnit, isExtractionCurve );
calculateCurveDataRanges();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setValuesAndDepths( const std::vector<double>& xValues,
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve )
{
m_curveData->setValuesAndDepths( xValues, depths, depthUnit, isExtractionCurve );
calculateCurveDataRanges(); calculateCurveDataRanges();
} }
@ -151,8 +151,9 @@ void RimWellLogCurve::setValuesWithTVD( const std::vector<double>& xValues,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve ) bool isExtractionCurve )
{ {
m_curveData->setValuesWithTVD( xValues, measuredDepths, tvDepths, depthUnit, isExtractionCurve ); std::map<RiaDefines::DepthTypeEnum, std::vector<double>> depths = {{RiaDefines::MEASURED_DEPTH, measuredDepths},
calculateCurveDataRanges(); {RiaDefines::TRUE_VERTICAL_DEPTH, tvDepths}};
setValuesAndDepths( xValues, depths, depthUnit, isExtractionCurve );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -204,15 +205,18 @@ void RimWellLogCurve::setOverrideCurveDataXRange( double minimumValue, double ma
void RimWellLogCurve::calculateCurveDataRanges() void RimWellLogCurve::calculateCurveDataRanges()
{ {
// Invalidate range first // Invalidate range first
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(), m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() ); -std::numeric_limits<double>::infinity() );
m_curveDataMDRange = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() );
m_curveDataTVDRange = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() );
m_curveData->calculateMDRange( &m_curveDataMDRange.first, &m_curveDataMDRange.second ); for ( auto depthType : m_curveData->availableDepthTypes() )
m_curveData->calculateTVDRange( &m_curveDataTVDRange.first, &m_curveDataTVDRange.second ); {
m_curveDataDepthRange[depthType] = std::make_pair( std::numeric_limits<double>::infinity(),
-std::numeric_limits<double>::infinity() );
m_curveData->calculateDepthRange( depthType,
&m_curveDataDepthRange[depthType].first,
&m_curveDataDepthRange[depthType].second );
}
for ( double xValue : m_curveData->xValues() ) for ( double xValue : m_curveData->xValues() )
{ {

View File

@ -42,16 +42,20 @@ public:
bool xValueRangeInData( double* minimumValue, double* maximumValue ) const; bool xValueRangeInData( double* minimumValue, double* maximumValue ) const;
bool yValueRangeInData( double* minimumValue, double* maximumValue ) const; bool yValueRangeInData( double* minimumValue, double* maximumValue ) const;
void setValuesAndMD( const std::vector<double>& xValues, void setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::vector<double>& depths,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthTypeEnum depthType,
bool isExtractionCurve ); RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve );
void setValuesWithTVD( const std::vector<double>& xValues, void setValuesWithTVD( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths, const std::vector<double>& tvDepths,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve ); bool isExtractionCurve );
void setValuesAndDepths( const std::vector<double>& xValues,
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve );
const RigWellLogCurveData* curveData() const; const RigWellLogCurveData* curveData() const;
@ -71,8 +75,7 @@ private:
void calculateCurveDataRanges(); void calculateCurveDataRanges();
private: private:
cvf::ref<RigWellLogCurveData> m_curveData; cvf::ref<RigWellLogCurveData> m_curveData;
std::pair<double, double> m_curveDataXRange; std::pair<double, double> m_curveDataXRange;
std::pair<double, double> m_curveDataMDRange; std::map<RiaDefines::DepthTypeEnum, std::pair<double, double>> m_curveDataDepthRange;
std::pair<double, double> m_curveDataTVDRange;
}; };

View File

@ -338,27 +338,16 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
bool isUsingPseudoLength = false; bool isUsingPseudoLength = false;
performDataExtraction( &isUsingPseudoLength ); performDataExtraction( &isUsingPseudoLength );
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
RimWellLogPlot* wellLogPlot; RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot ); firstAncestorOrThisOfType( wellLogPlot );
if ( !wellLogPlot ) return; if ( !wellLogPlot ) return;
displayUnit = wellLogPlot->depthUnit(); RiaDefines::DepthTypeEnum depthType = wellLogPlot->depthType();
RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit();
if ( wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) m_qwtPlotCurve->setSamples( curveData()->xPlotValues().data(),
{ curveData()->depthPlotValues( depthType, displayUnit ).data(),
m_qwtPlotCurve->setSamples( curveData()->xPlotValues().data(), static_cast<int>( curveData()->xPlotValues().size() ) );
curveData()->trueDepthPlotValues( displayUnit ).data(),
static_cast<int>( curveData()->xPlotValues().size() ) );
isUsingPseudoLength = false;
}
else if ( wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH )
{
m_qwtPlotCurve->setSamples( curveData()->xPlotValues().data(),
curveData()->measuredDepthPlotValues( displayUnit ).data(),
static_cast<int>( curveData()->xPlotValues().size() ) );
}
m_qwtPlotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); m_qwtPlotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
@ -523,7 +512,11 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength,
{ {
if ( !tvDepthValues.size() ) if ( !tvDepthValues.size() )
{ {
this->setValuesAndMD( values, measuredDepthValues, depthUnit, !performDataSmoothing ); this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::MEASURED_DEPTH,
depthUnit,
!performDataSmoothing );
} }
else else
{ {

View File

@ -89,7 +89,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
std::vector<double> values = wellLogFile->values( m_wellLogChannnelName ); std::vector<double> values = wellLogFile->values( m_wellLogChannnelName );
std::vector<double> measuredDepthValues = wellLogFile->depthValues(); std::vector<double> measuredDepthValues = wellLogFile->depthValues();
if ( wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
bool canUseTvd = false; bool canUseTvd = false;
if ( wellLogFile->hasTvdChannel() ) if ( wellLogFile->hasTvdChannel() )
@ -112,21 +112,21 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry(); RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
if ( rigWellPath ) if ( rigWellPath )
{ {
std::vector<double> trueVerticeldepthValues; std::vector<double> trueVerticalDepthValues;
for ( double measuredDepthValue : measuredDepthValues ) for ( double measuredDepthValue : measuredDepthValues )
{ {
trueVerticeldepthValues.push_back( trueVerticalDepthValues.push_back(
-rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() ); -rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() );
} }
if ( values.size() == trueVerticeldepthValues.size() && if ( values.size() == trueVerticalDepthValues.size() &&
values.size() == measuredDepthValues.size() ) values.size() == measuredDepthValues.size() )
{ {
this->setValuesWithTVD( values, this->setValuesAndDepths( values,
measuredDepthValues, measuredDepthValues,
trueVerticeldepthValues, RiaDefines::MEASURED_DEPTH,
wellLogFile->depthUnit(), wellLogFile->depthUnit(),
false ); false );
canUseTvd = true; canUseTvd = true;
} }
} }
@ -150,7 +150,11 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
{ {
if ( values.size() == measuredDepthValues.size() ) if ( values.size() == measuredDepthValues.size() )
{ {
this->setValuesAndMD( values, measuredDepthValues, wellLogFile->depthUnit(), false ); this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::MEASURED_DEPTH,
wellLogFile->depthUnit(),
false );
} }
} }
} }
@ -166,16 +170,18 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
{ {
displayUnit = wellLogPlot->depthUnit(); displayUnit = wellLogPlot->depthUnit();
} }
if ( wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::TRUE_VERTICAL_DEPTH &&
this->curveData()->availableDepthTypes().count( RiaDefines::TRUE_VERTICAL_DEPTH ) )
{ {
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(), m_qwtPlotCurve
this->curveData()->trueDepthPlotValues( displayUnit ).data(), ->setSamples( this->curveData()->xPlotValues().data(),
static_cast<int>( this->curveData()->xPlotValues().size() ) ); this->curveData()->depthPlotValues( RiaDefines::TRUE_VERTICAL_DEPTH, displayUnit ).data(),
static_cast<int>( this->curveData()->xPlotValues().size() ) );
} }
else else
{ {
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(), m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(),
this->curveData()->measuredDepthPlotValues( displayUnit ).data(), this->curveData()->depthPlotValues( RiaDefines::MEASURED_DEPTH, displayUnit ).data(),
static_cast<int>( this->curveData()->xPlotValues().size() ) ); static_cast<int>( this->curveData()->xPlotValues().size() ) );
} }
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );

View File

@ -26,6 +26,7 @@
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h" #include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h" #include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
@ -48,16 +49,6 @@
namespace caf namespace caf
{ {
template <>
void caf::AppEnum<RimWellLogPlot::DepthTypeEnum>::setUp()
{
addItem( RimWellLogPlot::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" );
addItem( RimWellLogPlot::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" );
addItem( RimWellLogPlot::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" );
addItem( RimWellLogPlot::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" );
setDefault( RimWellLogPlot::MEASURED_DEPTH );
}
template <> template <>
void RimWellLogPlot::AxisGridEnum::setUp() void RimWellLogPlot::AxisGridEnum::setUp()
{ {
@ -89,7 +80,7 @@ RimWellLogPlot::RimWellLogPlot()
m_commonDataSource.xmlCapability()->disableIO(); m_commonDataSource.xmlCapability()->disableIO();
m_commonDataSource = new RimWellLogCurveCommonDataSource; m_commonDataSource = new RimWellLogCurveCommonDataSource;
caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = MEASURED_DEPTH; caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = RiaDefines::MEASURED_DEPTH;
CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" ); CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" );
caf::AppEnum<RiaDefines::DepthUnitType> depthUnit = RiaDefines::UNIT_METER; caf::AppEnum<RiaDefines::DepthUnitType> depthUnit = RiaDefines::UNIT_METER;
@ -107,7 +98,7 @@ RimWellLogPlot::RimWellLogPlot()
m_nameConfig = new RimWellLogPlotNameConfig(); m_nameConfig = new RimWellLogPlotNameConfig();
m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET}; m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET};
m_availableDepthTypes = {MEASURED_DEPTH, TRUE_VERTICAL_DEPTH}; m_availableDepthTypes = {RiaDefines::MEASURED_DEPTH, RiaDefines::TRUE_VERTICAL_DEPTH};
m_minAvailableDepth = HUGE_VAL; m_minAvailableDepth = HUGE_VAL;
m_maxAvailableDepth = -HUGE_VAL; m_maxAvailableDepth = -HUGE_VAL;
@ -576,8 +567,17 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
} }
else if ( changedField == &m_depthType ) else if ( changedField == &m_depthType )
{ {
m_isAutoScaleDepthEnabled = true; m_isAutoScaleDepthEnabled = true;
loadDataAndUpdate(); RimWellAllocationPlot* parentWellAllocation = nullptr;
this->firstAncestorOrThisOfType( parentWellAllocation );
if ( parentWellAllocation )
{
parentWellAllocation->loadDataAndUpdate();
}
else
{
loadDataAndUpdate();
}
} }
else if ( changedField == &m_depthUnit ) else if ( changedField == &m_depthUnit )
{ {
@ -731,24 +731,24 @@ QString RimWellLogPlot::depthAxisTitle() const
switch ( m_depthType.value() ) switch ( m_depthType.value() )
{ {
case MEASURED_DEPTH: case RiaDefines::MEASURED_DEPTH:
depthTitle = "MD"; depthTitle = "MD";
break; break;
case TRUE_VERTICAL_DEPTH: case RiaDefines::TRUE_VERTICAL_DEPTH:
depthTitle = "TVDMSL"; depthTitle = "TVDMSL";
break; break;
case PSEUDO_LENGTH: case RiaDefines::PSEUDO_LENGTH:
depthTitle = "PL"; depthTitle = "PL";
break; break;
case CONNECTION_NUMBER: case RiaDefines::CONNECTION_NUMBER:
depthTitle = "Connection"; depthTitle = "Connection";
break; break;
} }
if ( m_depthType() == CONNECTION_NUMBER ) return depthTitle; if ( m_depthType() == RiaDefines::CONNECTION_NUMBER ) return depthTitle;
if ( m_depthUnit == RiaDefines::UNIT_METER ) if ( m_depthUnit == RiaDefines::UNIT_METER )
{ {

View File

@ -48,14 +48,6 @@ class RimWellLogPlot : public RimGridPlotWindow, public RimNameConfigHolderInter
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
enum DepthTypeEnum
{
MEASURED_DEPTH,
TRUE_VERTICAL_DEPTH,
PSEUDO_LENGTH,
CONNECTION_NUMBER
};
enum AxisGridVisibility enum AxisGridVisibility
{ {
AXIS_GRID_NONE = 0x00, AXIS_GRID_NONE = 0x00,
@ -65,6 +57,7 @@ public:
}; };
typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum; typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum;
using DepthTypeEnum = RiaDefines::DepthTypeEnum;
public: public:
RimWellLogPlot(); RimWellLogPlot();
@ -106,7 +99,7 @@ public:
void setCommonDataSourceEnabled( bool enable ); void setCommonDataSourceEnabled( bool enable );
void setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits ); void setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits );
void setAvailableDepthTypes( const std::set<RimWellLogPlot::DepthTypeEnum>& depthTypes ); void setAvailableDepthTypes( const std::set<DepthTypeEnum>& depthTypes );
void onPlotAdditionOrRemoval() override; void onPlotAdditionOrRemoval() override;
@ -146,8 +139,8 @@ protected:
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig; caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits; std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;
std::set<RimWellLogPlot::DepthTypeEnum> m_availableDepthTypes; std::set<DepthTypeEnum> m_availableDepthTypes;
double m_minAvailableDepth; double m_minAvailableDepth;
double m_maxAvailableDepth; double m_maxAvailableDepth;

View File

@ -445,12 +445,13 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
displayUnit = wellLogPlot->depthUnit(); displayUnit = wellLogPlot->depthUnit();
} }
if ( wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH ) if ( wellLogPlot->depthType() == RiaDefines::MEASURED_DEPTH )
{ {
m_qwtPlotCurve->showErrorBars( showErrorBarsInObservedData ); m_qwtPlotCurve->showErrorBars( showErrorBarsInObservedData );
m_qwtPlotCurve->setPerPointLabels( perPointLabels ); m_qwtPlotCurve->setPerPointLabels( perPointLabels );
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(), m_qwtPlotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(),
this->curveData()->measuredDepthPlotValues( displayUnit ), this->curveData()->depthPlotValues( RiaDefines::MEASURED_DEPTH,
displayUnit ),
errors, errors,
false, false,
RiuQwtPlotCurve::ERROR_ALONG_X_AXIS ); RiuQwtPlotCurve::ERROR_ALONG_X_AXIS );
@ -485,7 +486,8 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
m_qwtPlotCurve->showErrorBars( showErrorBarsInObservedData ); m_qwtPlotCurve->showErrorBars( showErrorBarsInObservedData );
m_qwtPlotCurve->setPerPointLabels( perPointLabels ); m_qwtPlotCurve->setPerPointLabels( perPointLabels );
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(), m_qwtPlotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(),
this->curveData()->trueDepthPlotValues( displayUnit ), this->curveData()->depthPlotValues( RiaDefines::TRUE_VERTICAL_DEPTH,
displayUnit ),
errors, errors,
false, false,
RiuQwtPlotCurve::ERROR_ALONG_X_AXIS ); RiuQwtPlotCurve::ERROR_ALONG_X_AXIS );

View File

@ -781,14 +781,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
if ( curveNames.size() == 1 ) if ( curveNames.size() == 1 )
{ {
if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) curveDepths = curveData->depthPlotValues( depthType, depthUnit );
{
curveDepths = curveData->trueDepthPlotValues( depthUnit );
}
else
{
curveDepths = curveData->measuredDepthPlotValues( depthUnit );
}
} }
std::vector<double> xPlotValues = curveData->xPlotValues(); std::vector<double> xPlotValues = curveData->xPlotValues();
@ -809,13 +802,13 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
{ {
if ( i == 0 ) if ( i == 0 )
{ {
if ( depthType == RimWellLogPlot::CONNECTION_NUMBER ) if ( depthType == RiaDefines::CONNECTION_NUMBER )
out += "Connection"; out += "Connection";
else if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) else if ( depthType == RiaDefines::MEASURED_DEPTH )
out += "MD "; out += "MD ";
else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH ) else if ( depthType == RiaDefines::PSEUDO_LENGTH )
out += "PL "; out += "PL ";
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
out += "TVD "; out += "TVD ";
for ( QString name : curveNames ) for ( QString name : curveNames )
out += " \t" + name; out += " \t" + name;
@ -1971,11 +1964,11 @@ void RimWellLogTrack::findRegionNamesToPlot( const CurveSamplingPointData&
std::vector<double> depthVector; std::vector<double> depthVector;
if ( depthType == RimWellLogPlot::MEASURED_DEPTH || depthType == RimWellLogPlot::PSEUDO_LENGTH ) if ( depthType == RiaDefines::MEASURED_DEPTH || depthType == RiaDefines::PSEUDO_LENGTH )
{ {
depthVector = curveData.md; depthVector = curveData.md;
} }
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
depthVector = curveData.tvd; depthVector = curveData.tvd;
} }
@ -2171,8 +2164,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
{ {
if ( m_formationWellPathForSourceWellPath == nullptr ) return; if ( m_formationWellPathForSourceWellPath == nullptr ) return;
if ( !( plot->depthType() == RimWellLogPlot::MEASURED_DEPTH || if ( !( plot->depthType() == RiaDefines::MEASURED_DEPTH || plot->depthType() == RiaDefines::TRUE_VERTICAL_DEPTH ) )
plot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) )
{ {
return; return;
} }

View File

@ -202,26 +202,32 @@ public:
if ( firstCurveData->depthUnit() == RiaDefines::UNIT_METER ) if ( firstCurveData->depthUnit() == RiaDefines::UNIT_METER )
{ {
lasFile->AddLog( "DEPTH", "M", "Depth in meters", firstCurveData->measuredDepths() ); lasFile->AddLog( "DEPTH", "M", "Depth in meters", firstCurveData->depths( RiaDefines::MEASURED_DEPTH ) );
} }
else if ( firstCurveData->depthUnit() == RiaDefines::UNIT_FEET ) else if ( firstCurveData->depthUnit() == RiaDefines::UNIT_FEET )
{ {
lasFile->AddLog( "DEPTH", "FT", "Depth in feet", firstCurveData->measuredDepths() ); lasFile->AddLog( "DEPTH", "FT", "Depth in feet", firstCurveData->depths( RiaDefines::MEASURED_DEPTH ) );
} }
else if ( firstCurveData->depthUnit() == RiaDefines::UNIT_NONE ) else if ( firstCurveData->depthUnit() == RiaDefines::UNIT_NONE )
{ {
CVF_ASSERT( false ); CVF_ASSERT( false );
lasFile->AddLog( "DEPTH", "", "Depth in Connection number", firstCurveData->measuredDepths() ); lasFile->AddLog( "DEPTH",
"",
"Depth in Connection number",
firstCurveData->depths( RiaDefines::MEASURED_DEPTH ) );
} }
if ( firstCurveData->tvDepths().size() ) if ( firstCurveData->depths( RiaDefines::TRUE_VERTICAL_DEPTH ).size() )
{ {
lasFile->AddLog( "TVDMSL", "M", "True vertical depth in meters", firstCurveData->tvDepths() ); lasFile->AddLog( "TVDMSL",
"M",
"True vertical depth in meters",
firstCurveData->depths( RiaDefines::TRUE_VERTICAL_DEPTH ) );
if ( m_exportTvdrkb && m_rkbDiff != -1.0 ) if ( m_exportTvdrkb && m_rkbDiff != -1.0 )
{ {
// Export True Vertical Depth Rotary Kelly Bushing - TVDRKB // Export True Vertical Depth Rotary Kelly Bushing - TVDRKB
std::vector<double> tvdrkbValues = firstCurveData->tvDepths(); std::vector<double> tvdrkbValues = firstCurveData->depths( RiaDefines::TRUE_VERTICAL_DEPTH );
for ( auto& value : tvdrkbValues ) for ( auto& value : tvdrkbValues )
{ {
value += m_rkbDiff; value += m_rkbDiff;
@ -245,7 +251,7 @@ public:
double minDepth = 0.0; double minDepth = 0.0;
double maxDepth = 0.0; double maxDepth = 0.0;
firstCurveData->calculateMDRange( &minDepth, &maxDepth ); firstCurveData->calculateDepthRange( RiaDefines::MEASURED_DEPTH, &minDepth, &maxDepth );
lasFile->setStartDepth( minDepth ); lasFile->setStartDepth( minDepth );
lasFile->setStopDepth( maxDepth ); lasFile->setStopDepth( maxDepth );

View File

@ -45,17 +45,17 @@ RigWellLogCurveData::~RigWellLogCurveData() {}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setValuesAndMD( const std::vector<double>& xValues, void RigWellLogCurveData::setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::vector<double>& depths,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthTypeEnum depthType,
bool isExtractionCurve ) RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve )
{ {
CVF_ASSERT( xValues.size() == measuredDepths.size() ); CVF_ASSERT( xValues.size() == depths.size() );
m_xValues = xValues; m_xValues = xValues;
m_measuredDepths = measuredDepths; m_depths[depthType] = depths;
m_tvDepths.clear(); m_depthUnit = depthUnit;
m_depthUnit = depthUnit;
// Disable depth value filtering is intended to be used for // Disable depth value filtering is intended to be used for
// extraction curve data // extraction curve data
@ -67,19 +67,22 @@ void RigWellLogCurveData::setValuesAndMD( const std::vector<double>& xValues,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setValuesWithTVD( const std::vector<double>& xValues, void RigWellLogCurveData::setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
const std::vector<double>& tvDepths, RiaDefines::DepthUnitType depthUnit,
RiaDefines::DepthUnitType depthUnit, bool isExtractionCurve )
bool isExtractionCurve )
{ {
CVF_ASSERT( xValues.size() == measuredDepths.size() ); for ( auto it = depths.begin(); it != depths.end(); ++it )
{
CVF_ASSERT( xValues.size() == it->second.size() );
}
m_xValues = xValues; m_xValues = xValues;
m_measuredDepths = measuredDepths; m_depths = depths;
m_tvDepths = tvDepths; m_depthUnit = depthUnit;
m_depthUnit = depthUnit;
// Disable depth value filtering is intended to be used for
// extraction curve data
m_isExtractionCurve = isExtractionCurve; m_isExtractionCurve = isExtractionCurve;
calculateIntervalsOfContinousValidValues(); calculateIntervalsOfContinousValidValues();
@ -96,17 +99,24 @@ const std::vector<double>& RigWellLogCurveData::xValues() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<double>& RigWellLogCurveData::measuredDepths() const std::vector<double> RigWellLogCurveData::depths( RiaDefines::DepthTypeEnum depthType ) const
{ {
return m_measuredDepths; auto it = m_depths.find( depthType );
return it != m_depths.end() ? it->second : std::vector<double>();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<double>& RigWellLogCurveData::tvDepths() const std::set<RiaDefines::DepthTypeEnum> RigWellLogCurveData::availableDepthTypes() const
{ {
return m_tvDepths; std::set<RiaDefines::DepthTypeEnum> depthTypes;
for ( auto depthValuePair : m_depths )
{
depthTypes.insert( depthValuePair.first );
}
return depthTypes;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -123,18 +133,21 @@ std::vector<double> RigWellLogCurveData::xPlotValues() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogCurveData::trueDepthPlotValues( RiaDefines::DepthUnitType destinationDepthUnit ) const std::vector<double> RigWellLogCurveData::depthPlotValues( RiaDefines::DepthTypeEnum depthType,
RiaDefines::DepthUnitType destinationDepthUnit ) const
{ {
std::vector<double> filteredValues; std::vector<double> filteredValues;
if ( m_tvDepths.size() )
const std::vector<double> depthValues = depths( depthType );
if ( !depthValues.empty() )
{ {
if ( destinationDepthUnit == m_depthUnit ) if ( destinationDepthUnit == m_depthUnit )
{ {
RiaCurveDataTools::getValuesByIntervals( m_tvDepths, m_intervalsOfContinousValidValues, &filteredValues ); RiaCurveDataTools::getValuesByIntervals( depthValues, m_intervalsOfContinousValidValues, &filteredValues );
} }
else else
{ {
std::vector<double> convertedValues = convertDepthValues( destinationDepthUnit, m_tvDepths ); std::vector<double> convertedValues = convertDepthValues( destinationDepthUnit, depthValues );
RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues ); RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues );
} }
} }
@ -142,26 +155,6 @@ std::vector<double> RigWellLogCurveData::trueDepthPlotValues( RiaDefines::DepthU
return filteredValues; return filteredValues;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogCurveData::measuredDepthPlotValues( RiaDefines::DepthUnitType destinationDepthUnit ) const
{
std::vector<double> filteredValues;
if ( destinationDepthUnit == m_depthUnit )
{
RiaCurveDataTools::getValuesByIntervals( m_measuredDepths, m_intervalsOfContinousValidValues, &filteredValues );
}
else
{
std::vector<double> convertedValues = convertDepthValues( destinationDepthUnit, m_measuredDepths );
RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues );
}
return filteredValues;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -181,17 +174,20 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
bool isTvDepthsAvailable = false; bool isTvDepthsAvailable = false;
std::vector<double> tvDepths; std::vector<double> tvDepths;
if ( m_tvDepths.size() > 0 ) isTvDepthsAvailable = true; auto mdIt = m_depths.find( RiaDefines::MEASURED_DEPTH );
auto tvdIt = m_depths.find( RiaDefines::TRUE_VERTICAL_DEPTH );
if ( m_measuredDepths.size() > 0 ) if ( tvdIt != m_depths.end() && !tvdIt->second.empty() ) isTvDepthsAvailable = true;
if ( mdIt != m_depths.end() && !mdIt->second.empty() )
{ {
double currentMd = m_measuredDepths[0]; double currentMd = mdIt->second.front();
size_t segmentStartIdx = 0; size_t segmentStartIdx = 0;
while ( segmentStartIdx < m_measuredDepths.size() - 1 ) while ( segmentStartIdx < mdIt->second.size() - 1 )
{ {
double segmentStartMd = m_measuredDepths[segmentStartIdx]; double segmentStartMd = mdIt->second[segmentStartIdx];
double segmentEndMd = m_measuredDepths[segmentStartIdx + 1]; double segmentEndMd = mdIt->second[segmentStartIdx + 1];
double segmentStartX = m_xValues[segmentStartIdx]; double segmentStartX = m_xValues[segmentStartIdx];
double segmentEndX = m_xValues[segmentStartIdx + 1]; double segmentEndX = m_xValues[segmentStartIdx + 1];
@ -199,8 +195,8 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
double segmentEndTvd = 0.0; double segmentEndTvd = 0.0;
if ( isTvDepthsAvailable ) if ( isTvDepthsAvailable )
{ {
segmentStartTvd = m_tvDepths[segmentStartIdx]; segmentStartTvd = tvdIt->second[segmentStartIdx];
segmentEndTvd = m_tvDepths[segmentStartIdx + 1]; segmentEndTvd = tvdIt->second[segmentStartIdx + 1];
} }
while ( currentMd <= segmentEndMd ) while ( currentMd <= segmentEndMd )
@ -228,11 +224,17 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
if ( isTvDepthsAvailable ) if ( isTvDepthsAvailable )
{ {
reSampledData->setValuesWithTVD( xValues, measuredDepths, tvDepths, m_depthUnit, true ); std::map<RiaDefines::DepthTypeEnum, std::vector<double>> resampledDepths =
{{RiaDefines::TRUE_VERTICAL_DEPTH, tvDepths}, {RiaDefines::MEASURED_DEPTH, measuredDepths}};
reSampledData->setValuesAndDepths( xValues, resampledDepths, m_depthUnit, true );
} }
else else
{ {
reSampledData->setValuesAndMD( xValues, measuredDepths, m_depthUnit, m_isExtractionCurve ); reSampledData->setValuesAndDepths( xValues,
measuredDepths,
RiaDefines::MEASURED_DEPTH,
m_depthUnit,
m_isExtractionCurve );
} }
return reSampledData; return reSampledData;
@ -258,7 +260,7 @@ void RigWellLogCurveData::calculateIntervalsOfContinousValidValues()
for ( size_t intIdx = 0; intIdx < intervalsCount; intIdx++ ) for ( size_t intIdx = 0; intIdx < intervalsCount; intIdx++ )
{ {
std::vector<std::pair<size_t, size_t>> depthValuesIntervals; std::vector<std::pair<size_t, size_t>> depthValuesIntervals;
splitIntervalAtEmptySpace( m_measuredDepths, splitIntervalAtEmptySpace( m_depths[RiaDefines::MEASURED_DEPTH],
intervalsOfValidValues[intIdx].first, intervalsOfValidValues[intIdx].first,
intervalsOfValidValues[intIdx].second, intervalsOfValidValues[intIdx].second,
&depthValuesIntervals ); &depthValuesIntervals );
@ -323,16 +325,18 @@ void RigWellLogCurveData::splitIntervalAtEmptySpace( const std::vector<double>&
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RigWellLogCurveData::calculateMDRange( double* minimumDepth, double* maximumDepth ) const bool RigWellLogCurveData::calculateDepthRange( RiaDefines::DepthTypeEnum depthType,
double* minimumDepth,
double* maximumDepth ) const
{ {
CVF_ASSERT( minimumDepth && maximumDepth ); CVF_ASSERT( minimumDepth && maximumDepth );
double minValue = HUGE_VAL; double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL; double maxValue = -HUGE_VAL;
for ( size_t vIdx = 0; vIdx < m_measuredDepths.size(); vIdx++ ) for ( size_t vIdx = 0; vIdx < depths( depthType ).size(); vIdx++ )
{ {
double value = m_measuredDepths[vIdx]; double value = depths( depthType )[vIdx];
if ( value < minValue ) if ( value < minValue )
{ {
@ -356,42 +360,6 @@ bool RigWellLogCurveData::calculateMDRange( double* minimumDepth, double* maximu
return false; return false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellLogCurveData::calculateTVDRange( double* minTVD, double* maxTVD ) const
{
CVF_ASSERT( minTVD && maxTVD );
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
for ( size_t vIdx = 0; vIdx < m_tvDepths.size(); vIdx++ )
{
double value = m_tvDepths[vIdx];
if ( value < minValue )
{
minValue = value;
}
if ( value > maxValue )
{
maxValue = value;
}
}
if ( maxValue >= minValue )
{
*minTVD = minValue;
*maxTVD = maxValue;
return true;
}
return false;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,8 @@
#include "cvfObject.h" #include "cvfObject.h"
#include <map>
#include <set>
#include <vector> #include <vector>
class RigWellLogCurveDataTestInterface; class RigWellLogCurveDataTestInterface;
@ -36,28 +38,29 @@ public:
RigWellLogCurveData(); RigWellLogCurveData();
~RigWellLogCurveData() override; ~RigWellLogCurveData() override;
void setValuesAndMD( const std::vector<double>& xValues, void setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::vector<double>& depths,
RiaDefines::DepthUnitType depthUnit, RiaDefines::DepthTypeEnum depthType,
bool isExtractionCurve ); RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve );
void setValuesWithTVD( const std::vector<double>& xValues, void setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths, const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
const std::vector<double>& tvDepths, RiaDefines::DepthUnitType depthUnit,
RiaDefines::DepthUnitType depthUnit, bool isExtractionCurve );
bool isExtractionCurve );
const std::vector<double>& xValues() const; const std::vector<double>& xValues() const;
const std::vector<double>& measuredDepths() const;
const std::vector<double>& tvDepths() const; std::vector<double> depths( RiaDefines::DepthTypeEnum depthType ) const;
bool calculateMDRange( double* minMD, double* maxMD ) const;
bool calculateTVDRange( double* minTVD, double* maxTVD ) const; std::set<RiaDefines::DepthTypeEnum> availableDepthTypes() const;
bool calculateDepthRange( RiaDefines::DepthTypeEnum depthType, double* minMD, double* maxMD ) const;
RiaDefines::DepthUnitType depthUnit() const; RiaDefines::DepthUnitType depthUnit() const;
std::vector<double> xPlotValues() const; std::vector<double> xPlotValues() const;
std::vector<double> trueDepthPlotValues( RiaDefines::DepthUnitType destinationDepthUnit ) const; std::vector<double> depthPlotValues( RiaDefines::DepthTypeEnum depthType,
std::vector<double> measuredDepthPlotValues( RiaDefines::DepthUnitType destinationDepthUnit ) const; RiaDefines::DepthUnitType destinationDepthUnit ) const;
std::vector<std::pair<size_t, size_t>> polylineStartStopIndices() const; std::vector<std::pair<size_t, size_t>> polylineStartStopIndices() const;
cvf::ref<RigWellLogCurveData> calculateResampledCurveData( double newMeasuredDepthStepSize ) const; cvf::ref<RigWellLogCurveData> calculateResampledCurveData( double newMeasuredDepthStepSize ) const;
@ -77,10 +80,9 @@ private:
static std::vector<double> convertFromFeetToMeter( const std::vector<double>& valuesInFeet ); static std::vector<double> convertFromFeetToMeter( const std::vector<double>& valuesInFeet );
private: private:
std::vector<double> m_xValues; std::vector<double> m_xValues;
std::vector<double> m_measuredDepths; std::map<RiaDefines::DepthTypeEnum, std::vector<double>> m_depths;
std::vector<double> m_tvDepths; bool m_isExtractionCurve;
bool m_isExtractionCurve;
std::vector<std::pair<size_t, size_t>> m_intervalsOfContinousValidValues; std::vector<std::pair<size_t, size_t>> m_intervalsOfContinousValidValues;

View File

@ -55,7 +55,7 @@ void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth( std:
{ {
std::map<double, bool, DepthComp> tempMakeVectorUniqueOnMeasuredDepth; std::map<double, bool, DepthComp> tempMakeVectorUniqueOnMeasuredDepth;
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) if ( depthType == RiaDefines::MEASURED_DEPTH )
{ {
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations ) for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations )
{ {
@ -77,7 +77,7 @@ void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth( std:
} }
} }
} }
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations ) for ( const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations )
{ {
@ -106,11 +106,11 @@ void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth( std:
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop)) if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop))
{ {
double depth; double depth;
if (depthType == RimWellLogPlot::MEASURED_DEPTH) if (depthType == RiaDefines::MEASURED_DEPTH)
{ {
depth = formation.first.mdTop; depth = formation.first.mdTop;
} }
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) else if (depthType == RiaDefines::TRUE_VERTICAL_DEPTH)
{ {
depth = formation.first.tvdTop; depth = formation.first.tvdTop;
} }
@ -125,11 +125,11 @@ void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth( std:
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations) for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
{ {
double depth; double depth;
if (depthType == RimWellLogPlot::MEASURED_DEPTH) if (depthType == RiaDefines::MEASURED_DEPTH)
{ {
depth = formation.first.mdBase; depth = formation.first.mdBase;
} }
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) else if (depthType == RiaDefines::TRUE_VERTICAL_DEPTH)
{ {
depth = formation.first.tvdBase; depth = formation.first.tvdBase;
} }
@ -169,7 +169,7 @@ void RigWellPathFormations::evaluateFormationsForOnePosition(
{ {
double depth; double depth;
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) if ( depthType == RiaDefines::MEASURED_DEPTH )
{ {
if ( position == TOP ) if ( position == TOP )
{ {
@ -180,7 +180,7 @@ void RigWellPathFormations::evaluateFormationsForOnePosition(
depth = formation.first.mdBase; depth = formation.first.mdBase;
} }
} }
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
if ( position == TOP ) if ( position == TOP )
{ {
@ -237,11 +237,11 @@ void RigWellPathFormations::evaluateFluids( const std::vector<RigWellPathFormati
for ( const RigWellPathFormation& formation : fluidFormations ) for ( const RigWellPathFormation& formation : fluidFormations )
{ {
double depthBase; double depthBase;
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) if ( depthType == RiaDefines::MEASURED_DEPTH )
{ {
depthBase = formation.mdBase; depthBase = formation.mdBase;
} }
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
depthBase = formation.tvdBase; depthBase = formation.tvdBase;
} }
@ -254,11 +254,11 @@ void RigWellPathFormations::evaluateFluids( const std::vector<RigWellPathFormati
for ( const RigWellPathFormation& formation : fluidFormations ) for ( const RigWellPathFormation& formation : fluidFormations )
{ {
double depthTop; double depthTop;
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) if ( depthType == RiaDefines::MEASURED_DEPTH )
{ {
depthTop = formation.mdTop; depthTop = formation.mdTop;
} }
else if ( depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
depthTop = formation.tvdTop; depthTop = formation.tvdTop;
} }

View File

@ -48,7 +48,7 @@ RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem( const RimWellPath* w
: m_wellPath( wellPath ) : m_wellPath( wellPath )
, m_componentType( RiaDefines::WELL_PATH ) , m_componentType( RiaDefines::WELL_PATH )
, m_columnOffset( 0.0 ) , m_columnOffset( 0.0 )
, m_depthType( RimWellLogPlot::MEASURED_DEPTH ) , m_depthType( RiaDefines::MEASURED_DEPTH )
, m_maxColumnOffset( 0.0 ) , m_maxColumnOffset( 0.0 )
, m_showLabel( false ) , m_showLabel( false )
{ {
@ -68,7 +68,7 @@ RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem( const RimWellPath*
const RimWellPathComponentInterface* component ) const RimWellPathComponentInterface* component )
: m_wellPath( wellPath ) : m_wellPath( wellPath )
, m_columnOffset( 0.0 ) , m_columnOffset( 0.0 )
, m_depthType( RimWellLogPlot::MEASURED_DEPTH ) , m_depthType( RiaDefines::MEASURED_DEPTH )
, m_maxColumnOffset( 0.0 ) , m_maxColumnOffset( 0.0 )
, m_showLabel( false ) , m_showLabel( false )
{ {
@ -333,7 +333,7 @@ std::pair<double, double> RiuWellPathComponentPlotItem::depthsOfDepthType() cons
double startDepth = m_startMD; double startDepth = m_startMD;
double endDepth = m_endMD; double endDepth = m_endMD;
if ( m_depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ) if ( m_depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
cvf::Vec3d startPoint = m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_startMD ); cvf::Vec3d startPoint = m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_startMD );
cvf::Vec3d endPoint = m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_endMD ); cvf::Vec3d endPoint = m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_endMD );