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:
@@ -60,9 +60,9 @@ public:
|
||||
{
|
||||
CVF_ASSERT( lasFile );
|
||||
|
||||
if ( !m_curveData->xValues().empty() )
|
||||
if ( !m_curveData->propertyValues().empty() )
|
||||
{
|
||||
std::vector<double> wellLogValues = m_curveData->xValues( QString::fromStdString( m_unit ) );
|
||||
std::vector<double> wellLogValues = m_curveData->propertyValues( QString::fromStdString( m_unit ) );
|
||||
for ( size_t vIdx = 0; vIdx < wellLogValues.size(); vIdx++ )
|
||||
{
|
||||
double value = wellLogValues[vIdx];
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
{
|
||||
m_logCurveData.push_back( SingleChannelData( channelName, unit, comment, curveData ) );
|
||||
|
||||
for ( double xValue : curveData->xValues() )
|
||||
for ( double xValue : curveData->propertyValues() )
|
||||
{
|
||||
if ( xValue < m_minimumCurveValue )
|
||||
{
|
||||
@@ -536,7 +536,7 @@ void RigLasFileExporter::appendLasFileDescriptions( const std::vector<RimWellLog
|
||||
{
|
||||
curveData = curve->curveData();
|
||||
}
|
||||
QString units = curve->curveData()->xUnits();
|
||||
QString units = curve->curveData()->propertyValueUnit();
|
||||
|
||||
if ( convertCurveUnits || units == RiaWellLogUnitTools<double>::barX100UnitString() )
|
||||
{
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -43,22 +43,26 @@ public:
|
||||
|
||||
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
|
||||
|
||||
void setValuesAndDepths( const std::vector<double>& xValues,
|
||||
void setValuesAndDepths( const std::vector<double>& propertyValues,
|
||||
const std::vector<double>& depths,
|
||||
RiaDefines::DepthTypeEnum depthType,
|
||||
double rkbDiff,
|
||||
RiaDefines::DepthUnitType depthUnit,
|
||||
bool isExtractionCurve );
|
||||
void setValuesAndDepths( const std::vector<double>& xValues,
|
||||
bool isExtractionCurve,
|
||||
bool useLogarithmicScale );
|
||||
|
||||
void setValuesAndDepths( const std::vector<double>& propertyValues,
|
||||
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
|
||||
double rkbDiff,
|
||||
RiaDefines::DepthUnitType depthUnit,
|
||||
bool isExtractionCurve );
|
||||
void setXUnits( const QString& xUnitString );
|
||||
bool isExtractionCurve,
|
||||
bool useLogarithmicScale );
|
||||
|
||||
std::vector<double> xValues() const;
|
||||
std::vector<double> xValues( const QString& units ) const;
|
||||
QString xUnits() const;
|
||||
void setPropertyValueUnit( const QString& propertyValueUnitString );
|
||||
|
||||
std::vector<double> propertyValues() const;
|
||||
std::vector<double> propertyValues( const QString& units ) const;
|
||||
QString propertyValueUnit() const;
|
||||
|
||||
std::vector<double> depths( RiaDefines::DepthTypeEnum depthType ) const;
|
||||
|
||||
@@ -71,9 +75,9 @@ public:
|
||||
|
||||
RiaDefines::DepthUnitType depthUnit() const;
|
||||
|
||||
std::vector<double> xPlotValues() const;
|
||||
std::vector<double> depthPlotValues( RiaDefines::DepthTypeEnum depthType,
|
||||
RiaDefines::DepthUnitType destinationDepthUnit ) const;
|
||||
std::vector<double> propertyValuesByIntervals() const;
|
||||
std::vector<double> depthValuesByIntervals( RiaDefines::DepthTypeEnum depthType,
|
||||
RiaDefines::DepthUnitType destinationDepthUnit ) const;
|
||||
std::vector<std::pair<size_t, size_t>> polylineStartStopIndices() const;
|
||||
|
||||
cvf::ref<RigWellLogCurveData> calculateResampledCurveData( double newMeasuredDepthStepSize ) const;
|
||||
@@ -95,13 +99,14 @@ private:
|
||||
std::vector<std::pair<size_t, size_t>>* intervals );
|
||||
|
||||
private:
|
||||
std::vector<double> m_xValues;
|
||||
std::vector<double> m_propertyValues;
|
||||
std::map<RiaDefines::DepthTypeEnum, std::vector<double>> m_depths;
|
||||
bool m_isExtractionCurve;
|
||||
double m_rkbDiff;
|
||||
bool m_useLogarithmicScale;
|
||||
|
||||
std::vector<std::pair<size_t, size_t>> m_intervalsOfContinousValidValues;
|
||||
|
||||
RiaDefines::DepthUnitType m_depthUnit;
|
||||
QString m_xUnitString;
|
||||
QString m_propertyValueUnitString;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user