#8240 Use correct measured depth for the generated path point at sea level

This commit is contained in:
Magne Sjaastad 2021-11-05 12:29:21 +01:00
parent b2433bf185
commit 0c25794518

View File

@ -315,16 +315,19 @@ void RimFileWellPath::ensureWellPathStartAtSeaLevel( RigWellPath* wellPath )
newPoints.insert( newPoints.end(), wellPathPoints.begin(), wellPathPoints.end() );
wellPath->setWellPathPoints( newPoints );
// Give the new point zero measured depth.
std::vector<double> newMeasuredDepths = { 0.0 };
// And adjust measured depths of the read data
// with the diff between the old and new first point.
double diffMd = std::abs( newPoints[1].z() - newPoints[0].z() );
for ( double originalMd : measuredDepths )
// Use rkbDiff as MD for the point at sea level
double mdAtSeaLevel = 0.0;
if ( wellPath->datumElevation() > 0.0 )
{
newMeasuredDepths.push_back( originalMd + diffMd );
mdAtSeaLevel = wellPath->datumElevation();
}
else if ( this->airGap() != std::numeric_limits<double>::infinity() && this->airGap() > 0.0 )
{
mdAtSeaLevel = this->airGap();
}
std::vector<double> newMeasuredDepths = { mdAtSeaLevel };
newMeasuredDepths.insert( newMeasuredDepths.end(), measuredDepths.begin(), measuredDepths.end() );
wellPath->setMeasuredDepths( newMeasuredDepths );
}