mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Logarithmic curve support and renaming (#8546)
* Add test for both positive and negative numbers * Remove redundant sample count from parameter list * Propagate useLogarithmicScale * Renaming
This commit is contained in:
@@ -31,11 +31,13 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellLogCurveData::RigWellLogCurveData()
|
||||
: m_isExtractionCurve( false )
|
||||
, m_rkbDiff( 0.0 )
|
||||
, m_useLogarithmicScale( false )
|
||||
, m_depthUnit( RiaDefines::DepthUnitType::UNIT_METER )
|
||||
, m_propertyValueUnitString( RiaWellLogUnitTools<double>::noUnitString() )
|
||||
|
||||
{
|
||||
m_isExtractionCurve = false;
|
||||
m_rkbDiff = 0.0;
|
||||
m_depthUnit = RiaDefines::DepthUnitType::UNIT_METER;
|
||||
m_xUnitString = RiaWellLogUnitTools<double>::noUnitString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -61,14 +63,16 @@ void RigWellLogCurveData::setValuesAndDepths( const std::vector<double>& xValues
|
||||
RiaDefines::DepthTypeEnum depthType,
|
||||
double rkbDiff,
|
||||
RiaDefines::DepthUnitType depthUnit,
|
||||
bool isExtractionCurve )
|
||||
bool isExtractionCurve,
|
||||
bool useLogarithmicScale )
|
||||
{
|
||||
CVF_ASSERT( xValues.size() == depths.size() );
|
||||
|
||||
m_xValues = xValues;
|
||||
m_depths[depthType] = depths;
|
||||
m_depthUnit = depthUnit;
|
||||
m_rkbDiff = rkbDiff;
|
||||
m_propertyValues = xValues;
|
||||
m_depths[depthType] = depths;
|
||||
m_depthUnit = depthUnit;
|
||||
m_rkbDiff = rkbDiff;
|
||||
m_useLogarithmicScale = useLogarithmicScale;
|
||||
|
||||
// Disable depth value filtering is intended to be used for
|
||||
// extraction curve data
|
||||
@@ -84,17 +88,19 @@ void RigWellLogCurveData::setValuesAndDepths( const std::vector<double>&
|
||||
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
|
||||
double rkbDiff,
|
||||
RiaDefines::DepthUnitType depthUnit,
|
||||
bool isExtractionCurve )
|
||||
bool isExtractionCurve,
|
||||
bool useLogarithmicScale )
|
||||
{
|
||||
for ( auto it = depths.begin(); it != depths.end(); ++it )
|
||||
{
|
||||
CVF_ASSERT( xValues.size() == it->second.size() );
|
||||
}
|
||||
|
||||
m_xValues = xValues;
|
||||
m_depths = depths;
|
||||
m_depthUnit = depthUnit;
|
||||
m_rkbDiff = rkbDiff;
|
||||
m_propertyValues = xValues;
|
||||
m_depths = depths;
|
||||
m_depthUnit = depthUnit;
|
||||
m_rkbDiff = rkbDiff;
|
||||
m_useLogarithmicScale = useLogarithmicScale;
|
||||
|
||||
// Disable depth value filtering is intended to be used for
|
||||
// extraction curve data
|
||||
@@ -106,43 +112,43 @@ void RigWellLogCurveData::setValuesAndDepths( const std::vector<double>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellLogCurveData::setXUnits( const QString& xUnitString )
|
||||
void RigWellLogCurveData::setPropertyValueUnit( const QString& propertyValueUnitString )
|
||||
{
|
||||
m_xUnitString = xUnitString;
|
||||
m_propertyValueUnitString = propertyValueUnitString;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigWellLogCurveData::xValues() const
|
||||
std::vector<double> RigWellLogCurveData::propertyValues() const
|
||||
{
|
||||
return m_xValues;
|
||||
return m_propertyValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigWellLogCurveData::xValues( const QString& units ) const
|
||||
std::vector<double> RigWellLogCurveData::propertyValues( const QString& units ) const
|
||||
{
|
||||
std::vector<double> convertedValues;
|
||||
if ( units != m_xUnitString &&
|
||||
if ( units != m_propertyValueUnitString &&
|
||||
RiaWellLogUnitTools<double>::convertValues( depths( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB ),
|
||||
m_xValues,
|
||||
m_propertyValues,
|
||||
&convertedValues,
|
||||
m_xUnitString,
|
||||
m_propertyValueUnitString,
|
||||
units ) )
|
||||
{
|
||||
return convertedValues;
|
||||
}
|
||||
return m_xValues;
|
||||
return m_propertyValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigWellLogCurveData::xUnits() const
|
||||
QString RigWellLogCurveData::propertyValueUnit() const
|
||||
{
|
||||
return m_xUnitString;
|
||||
return m_propertyValueUnitString;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -212,10 +218,10 @@ std::set<RiaDefines::DepthTypeEnum> RigWellLogCurveData::availableDepthTypes() c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigWellLogCurveData::xPlotValues() const
|
||||
std::vector<double> RigWellLogCurveData::propertyValuesByIntervals() const
|
||||
{
|
||||
std::vector<double> filteredValues;
|
||||
RiaCurveDataTools::getValuesByIntervals( m_xValues, m_intervalsOfContinousValidValues, &filteredValues );
|
||||
RiaCurveDataTools::getValuesByIntervals( m_propertyValues, m_intervalsOfContinousValidValues, &filteredValues );
|
||||
|
||||
return filteredValues;
|
||||
}
|
||||
@@ -223,8 +229,8 @@ std::vector<double> RigWellLogCurveData::xPlotValues() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigWellLogCurveData::depthPlotValues( RiaDefines::DepthTypeEnum depthType,
|
||||
RiaDefines::DepthUnitType destinationDepthUnit ) const
|
||||
std::vector<double> RigWellLogCurveData::depthValuesByIntervals( RiaDefines::DepthTypeEnum depthType,
|
||||
RiaDefines::DepthUnitType destinationDepthUnit ) const
|
||||
{
|
||||
std::vector<double> filteredValues;
|
||||
|
||||
@@ -279,8 +285,8 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
|
||||
{
|
||||
double segmentStartMd = mdIt->second[segmentStartIdx];
|
||||
double segmentEndMd = mdIt->second[segmentStartIdx + 1];
|
||||
double segmentStartX = m_xValues[segmentStartIdx];
|
||||
double segmentEndX = m_xValues[segmentStartIdx + 1];
|
||||
double segmentStartX = m_propertyValues[segmentStartIdx];
|
||||
double segmentEndX = m_propertyValues[segmentStartIdx + 1];
|
||||
|
||||
double segmentStartTvd = 0.0;
|
||||
double segmentEndTvd = 0.0;
|
||||
@@ -318,7 +324,7 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
|
||||
std::map<RiaDefines::DepthTypeEnum, std::vector<double>> resampledDepths =
|
||||
{ { RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, tvDepths },
|
||||
{ RiaDefines::DepthTypeEnum::MEASURED_DEPTH, measuredDepths } };
|
||||
reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true );
|
||||
reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true, m_useLogarithmicScale );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -327,7 +333,8 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
|
||||
RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
|
||||
0.0,
|
||||
m_depthUnit,
|
||||
m_isExtractionCurve );
|
||||
m_isExtractionCurve,
|
||||
m_useLogarithmicScale );
|
||||
}
|
||||
|
||||
return reSampledData;
|
||||
@@ -346,8 +353,8 @@ void RigWellLogCurveData::interpolateSegment( RiaDefines::DepthTypeEnum resampli
|
||||
|
||||
double depth0 = depthIt->second[firstIndex];
|
||||
double depth1 = depthIt->second[secondIndex];
|
||||
double x0 = m_xValues[firstIndex];
|
||||
double x1 = m_xValues[secondIndex];
|
||||
double x0 = m_propertyValues[firstIndex];
|
||||
double x1 = m_propertyValues[secondIndex];
|
||||
double slope = 0.0;
|
||||
if ( std::fabs( depth1 - depth0 ) > eps )
|
||||
{
|
||||
@@ -412,7 +419,7 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
|
||||
if ( std::fabs( depthIt->second[segmentStartIdx] - depth ) < eps ) // already have this depth point,
|
||||
// reuse it
|
||||
{
|
||||
xValues.push_back( m_xValues[segmentStartIdx] );
|
||||
xValues.push_back( m_propertyValues[segmentStartIdx] );
|
||||
// Copy all depth types for this segment
|
||||
for ( auto depthTypeValuesPair : m_depths )
|
||||
{
|
||||
@@ -458,7 +465,7 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
|
||||
CAF_ASSERT( foundPoint );
|
||||
}
|
||||
|
||||
reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true );
|
||||
reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true, m_useLogarithmicScale );
|
||||
return reSampledData;
|
||||
}
|
||||
|
||||
@@ -468,7 +475,7 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(
|
||||
void RigWellLogCurveData::calculateIntervalsOfContinousValidValues()
|
||||
{
|
||||
std::vector<std::pair<size_t, size_t>> intervalsOfValidValues =
|
||||
RiaCurveDataTools::calculateIntervalsOfValidValues( m_xValues, false );
|
||||
RiaCurveDataTools::calculateIntervalsOfValidValues( m_propertyValues, m_useLogarithmicScale );
|
||||
|
||||
m_intervalsOfContinousValidValues.clear();
|
||||
|
||||
@@ -557,7 +564,7 @@ bool RigWellLogCurveData::calculateDepthRange( RiaDefines::DepthTypeEnum depthTy
|
||||
double minValue = HUGE_VAL;
|
||||
double maxValue = -HUGE_VAL;
|
||||
|
||||
std::vector<double> depthValues = depthPlotValues( depthType, depthUnit );
|
||||
std::vector<double> depthValues = depthValuesByIntervals( depthType, depthUnit );
|
||||
for ( size_t vIdx = 0; vIdx < depthValues.size(); vIdx++ )
|
||||
{
|
||||
double value = depthValues[vIdx];
|
||||
|
||||
Reference in New Issue
Block a user