Skip to content

Commit

Permalink
Well Log CSV: fix interpolation of CSV data.
Browse files Browse the repository at this point in the history
The TVD measurements from the well path were used to interpolate the CSV data.
The typically well path is too coarsely sampled which would lead unwanted
smoothing of the data.

Fixed by resampling the well path to a one meter sampling interval.
  • Loading branch information
kriben committed Apr 5, 2024
1 parent 59a03cc commit 20926fa
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
44 changes: 40 additions & 4 deletions ApplicationLibCode/ReservoirDataModel/RigWellLogCsvFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ RigWellLogCsvFile::~RigWellLogCsvFile()
bool RigWellLogCsvFile::open( const QString& fileName, RigWellPath* wellPath, QString* errorMessage )
{
m_wellLogChannelNames.clear();
double samplingInterval = 1.0;
cvf::cref<RigWellPath> resampledWellPath = resampleWellPath( *wellPath, samplingInterval );

RifCsvUserDataFileParser parser( fileName, errorMessage );

Expand Down Expand Up @@ -104,14 +106,14 @@ bool RigWellLogCsvFile::open( const QString& fileName, RigWellPath* wellPath, QS
if ( channelName == m_tvdMslLogName )
{
// Use TVD from well path.
m_values[m_tvdMslLogName] = wellPath->trueVerticalDepths();
m_values[m_tvdMslLogName] = resampledWellPath->trueVerticalDepths();
}
else
{
CAF_ASSERT( readValues.size() == readTvds.size() );

auto wellPathMds = wellPath->measuredDepths();
auto wellPathTvds = wellPath->trueVerticalDepths();
auto wellPathMds = resampledWellPath->measuredDepths();
auto wellPathTvds = resampledWellPath->trueVerticalDepths();

// Interpolate values for the well path depths (from TVD).
// Assumes that the well channel values is dependent on TVD only (MD is not considered).
Expand All @@ -128,7 +130,7 @@ bool RigWellLogCsvFile::open( const QString& fileName, RigWellPath* wellPath, QS

// Use MD from well path.
m_depthLogName = "DEPTH";
m_values[m_depthLogName] = wellPath->measuredDepths();
m_values[m_depthLogName] = resampledWellPath->measuredDepths();

return true;
}
Expand Down Expand Up @@ -229,3 +231,37 @@ double RigWellLogCsvFile::getMissingValue() const
{
return std::numeric_limits<double>::infinity();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellPath* RigWellLogCsvFile::resampleWellPath( const RigWellPath& wellPath, double samplingInterval )
{
std::vector<double> measuredDepths = resampleMeasuredDepths( wellPath.measuredDepths(), samplingInterval );

std::vector<cvf::Vec3d> wellPathPoints;
for ( double md : measuredDepths )
{
wellPathPoints.push_back( wellPath.interpolatedPointAlongWellPath( md ) );
}

return new RigWellPath( wellPathPoints, measuredDepths );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogCsvFile::resampleMeasuredDepths( const std::vector<double>& measuredDepths, double samplingInterval )
{
double firstMd = measuredDepths.front();
double lastMd = measuredDepths.back();

std::vector<double> resampledMds;
for ( double md = firstMd; md < lastMd; md += samplingInterval )
{
resampledMds.push_back( md );
}
resampledMds.push_back( lastMd );

return resampledMds;
}
3 changes: 3 additions & 0 deletions ApplicationLibCode/ReservoirDataModel/RigWellLogCsvFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class RigWellLogCsvFile : public RigWellLogFile
void close();
QString depthUnitString() const override;

static RigWellPath* resampleWellPath( const RigWellPath& wellPath, double samplingInterval );
static std::vector<double> resampleMeasuredDepths( const std::vector<double>& measuredDepths, double samplingInterval );

QStringList m_wellLogChannelNames;
QString m_depthLogName;
QString m_tvdMslLogName;
Expand Down

0 comments on commit 20926fa

Please sign in to comment.