From d9a29a6c9a933629cfaaf267ee2f1dbb49830436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 16 Oct 2017 08:38:38 +0200 Subject: [PATCH] #1982 RFT plot. Support for TVDMSL when showing well log file curve --- .../ProjectDataModel/RimWellLogFileCurve.cpp | 38 +++++++++++++------ .../ReservoirDataModel/RigWellLogFile.cpp | 20 ++++++++++ .../ReservoirDataModel/RigWellLogFile.h | 4 ++ 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index 0fca481214..4a9791d4d0 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -90,26 +90,42 @@ void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot) if (wellLogFile) { std::vector values = wellLogFile->values(m_wellLogChannnelName); - std::vector measuredDepthValues = wellLogFile->depthValues(); if (wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { - RigWellPath* rigWellPath = m_wellPath->wellPathGeometry(); - if (rigWellPath) + bool canUseTvd = false; + if (wellLogFile->hasTvdChannel()) { - std::vector trueVerticeldepthValues; + std::vector tvdMslValues = wellLogFile->tvdMslValues(); - for (double measuredDepthValue : measuredDepthValues) + if (values.size() == measuredDepthValues.size() && values.size() == tvdMslValues.size()) { - trueVerticeldepthValues.push_back(-rigWellPath->interpolatedPointAlongWellPath(measuredDepthValue).z()); - } - if (values.size() == trueVerticeldepthValues.size() && values.size() == measuredDepthValues.size()) - { - m_curveData->setValuesWithTVD(values, measuredDepthValues, trueVerticeldepthValues, wellLogFile->depthUnit(), false); + m_curveData->setValuesWithTVD(values, measuredDepthValues, tvdMslValues, wellLogFile->depthUnit(), false); + canUseTvd = true; } } - else + + if (!canUseTvd) + { + RigWellPath* rigWellPath = m_wellPath->wellPathGeometry(); + if (rigWellPath) + { + std::vector trueVerticeldepthValues; + + for (double measuredDepthValue : measuredDepthValues) + { + trueVerticeldepthValues.push_back(-rigWellPath->interpolatedPointAlongWellPath(measuredDepthValue).z()); + } + if (values.size() == trueVerticeldepthValues.size() && values.size() == measuredDepthValues.size()) + { + m_curveData->setValuesWithTVD(values, measuredDepthValues, trueVerticeldepthValues, wellLogFile->depthUnit(), false); + canUseTvd = true; + } + } + } + + if (!canUseTvd) { if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning()) { diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp index a9fa81e05f..9a4fabc3d2 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp @@ -115,6 +115,10 @@ bool RigWellLogFile::open(const QString& fileName, QString* errorMessage) { m_depthLogName = logName; } + else if (logName.toUpper() == "TVDMSL") + { + m_tvdMslLogName = logName; + } } m_wellLogChannelNames = wellLogNames; @@ -172,6 +176,14 @@ std::vector RigWellLogFile::depthValues() const return values(m_depthLogName); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellLogFile::tvdMslValues() const +{ + return values(m_tvdMslLogName); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -339,6 +351,14 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigWellLogFile::hasTvdChannel() const +{ + return !m_tvdMslLogName.isEmpty(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogFile.h b/ApplicationCode/ReservoirDataModel/RigWellLogFile.h index 299bcfbbeb..411fa8e2d2 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogFile.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogFile.h @@ -50,6 +50,7 @@ public: QStringList wellLogChannelNames() const; std::vector depthValues() const; + std::vector tvdMslValues() const; std::vector values(const QString& name) const; QString wellLogChannelUnitString(const QString& wellLogChannelName, RiaDefines::DepthUnitType displayDepthUnit) const; @@ -57,6 +58,8 @@ public: static bool exportToLasFile(const RimWellLogCurve* curve, const QString& fileName); + bool hasTvdChannel() const; + private: void close(); QString depthUnitString() const; @@ -64,4 +67,5 @@ private: NRLib::Well* m_wellLogFile; QStringList m_wellLogChannelNames; QString m_depthLogName; + QString m_tvdMslLogName; };