#906 Computed datum elevation if measured depth is close to zero

This commit is contained in:
Magne Sjaastad
2016-10-26 07:26:53 +02:00
parent 9eb6ae88ff
commit 5302655dc0

View File

@@ -50,6 +50,8 @@
#include "cafPdmUiTreeOrdering.h"
#include <cmath>
//==================================================================================================
///
///
@@ -642,14 +644,25 @@ double RimWellLogExtractionCurve::rkbDiff() const
if (m_wellPath && m_wellPath->wellPathGeometry())
{
RigWellPath* geo = m_wellPath->wellPathGeometry();
if (geo->hasDatumElevation())
{
return geo->datumElevation();
}
// If measured depth is zero, use the z-value of the well path points
if (geo->m_wellPathPoints.size() > 0 && geo->m_measuredDepths.size() > 0)
{
double diff = cvf::Math::abs(cvf::Math::abs(geo->m_wellPathPoints[0].z()) - geo->m_measuredDepths[0]);
return diff;
double epsilon = 1e-3;
if (cvf::Math::abs(geo->m_measuredDepths[0]) < epsilon)
{
double diff = geo->m_measuredDepths[0] - (-geo->m_wellPathPoints[0].z());
return diff;
}
}
}
return -1.0;
return HUGE_VAL;
}