#6227 Filter out zero values in logarithmic plot.

This commit is contained in:
Kristian Bendiksen 2021-01-18 13:40:44 +01:00 committed by Magne Sjaastad
parent 55034759c5
commit ad07b18781
6 changed files with 41 additions and 1 deletions

View File

@ -69,4 +69,10 @@ double defaultPermeability()
{ {
return 1.0e-5; return 1.0e-5;
} }
double zeroReplacementForLogarithmicPlot()
{
return 1.0e-5;
}
}; // namespace RiaDefines }; // namespace RiaDefines

View File

@ -56,5 +56,6 @@ enum class CurveProperty
double defaultPorosity(); double defaultPorosity();
double defaultPermeability(); double defaultPermeability();
double zeroReplacementForLogarithmicPlot();
}; // namespace RiaDefines }; // namespace RiaDefines

View File

@ -591,7 +591,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_explicitTickIntervals.uiCapability()->setUiHidden( m_isLogarithmicScaleEnabled() ); m_explicitTickIntervals.uiCapability()->setUiHidden( m_isLogarithmicScaleEnabled() );
updateXZoom(); updateXZoom();
m_plotWidget->scheduleReplot(); loadDataAndUpdate();
} }
else if ( changedField == &m_regionAnnotationType || changedField == &m_regionAnnotationDisplay || else if ( changedField == &m_regionAnnotationType || changedField == &m_regionAnnotationDisplay ||
changedField == &m_formationSource || changedField == &m_colorShadingTransparency || changedField == &m_formationSource || changedField == &m_colorShadingTransparency ||
@ -2065,6 +2065,14 @@ void RimWellLogTrack::setLogarithmicScale( bool enable )
computeAndSetXRangeMinForLogarithmicScale(); computeAndSetXRangeMinForLogarithmicScale();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::isLogarithmicScale() const
{
return m_isLogarithmicScaleEnabled;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -190,6 +190,7 @@ public:
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
void setLogarithmicScale( bool enable ); void setLogarithmicScale( bool enable );
bool isLogarithmicScale() const;
std::map<int, std::vector<RimWellLogCurve*>> visibleStackedCurves(); std::map<int, std::vector<RimWellLogCurve*>> visibleStackedCurves();

View File

@ -32,6 +32,7 @@
#include "RimStimPlanModel.h" #include "RimStimPlanModel.h"
#include "RimStimPlanModelCalculator.h" #include "RimStimPlanModelCalculator.h"
#include "RimStimPlanModelPlot.h" #include "RimStimPlanModelPlot.h"
#include "RimWellLogTrack.h"
#include "RiuQwtPlotCurve.h" #include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotWidget.h" #include "RiuQwtPlotWidget.h"
@ -158,6 +159,13 @@ void RimStimPlanModelCurve::performDataExtraction( bool* isUsingPseudoLength )
bool performDataSmoothing = false; bool performDataSmoothing = false;
if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() ) if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() )
{ {
RimWellLogTrack* track = nullptr;
firstAncestorOfType( track );
if ( track && track->isLogarithmicScale() )
{
filterInvalidValuesForLogarithmicScale( values );
}
this->setValuesWithMdAndTVD( values, measuredDepthValues, tvDepthValues, rkbDiff, depthUnit, !performDataSmoothing, xUnits ); this->setValuesWithMdAndTVD( values, measuredDepthValues, tvDepthValues, rkbDiff, depthUnit, !performDataSmoothing, xUnits );
} }
} }
@ -172,3 +180,17 @@ QString RimStimPlanModelCurve::createCurveAutoName()
return textWithLineFeed; return textWithLineFeed;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanModelCurve::filterInvalidValuesForLogarithmicScale( std::vector<double>& values )
{
for ( double& v : values )
{
if ( v <= 0.0 )
{
v = RiaDefines::zeroReplacementForLogarithmicPlot();
}
}
}

View File

@ -53,6 +53,8 @@ protected:
QString createCurveAutoName(); QString createCurveAutoName();
static void filterInvalidValuesForLogarithmicScale( std::vector<double>& values );
caf::PdmPtrField<RimStimPlanModel*> m_stimPlanModel; caf::PdmPtrField<RimStimPlanModel*> m_stimPlanModel;
caf::PdmField<caf::AppEnum<RiaDefines::CurveProperty>> m_curveProperty; caf::PdmField<caf::AppEnum<RiaDefines::CurveProperty>> m_curveProperty;
}; };