From 8f9b4165638832bb3675ed4a00fa2ee36186dc10 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 15 Dec 2025 10:35:41 +0100 Subject: [PATCH] #12876 Include RKB distance when importing RMSwell. Fixes #12876. --- ApplicationLibCode/FileInterface/RifRmsWellPathReader.cpp | 1 + ApplicationLibCode/UnitTests/RifRmsWellPathReader-Test.cpp | 2 ++ ThirdParty/NRLib/nrlib/well/rmswell.cpp | 7 ++++++- ThirdParty/NRLib/nrlib/well/well.cpp | 3 +++ ThirdParty/NRLib/nrlib/well/well.hpp | 4 ++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifRmsWellPathReader.cpp b/ApplicationLibCode/FileInterface/RifRmsWellPathReader.cpp index 71775c589c..34bf80fc83 100644 --- a/ApplicationLibCode/FileInterface/RifRmsWellPathReader.cpp +++ b/ApplicationLibCode/FileInterface/RifRmsWellPathReader.cpp @@ -75,6 +75,7 @@ RifWellPathImporter::WellData RifRmsWellPathReader::readWellData( const QString& wellData.m_name = QString::fromStdString( well->GetWellName() ); wellData.m_wellPathGeometry = new RigWellPath; + wellData.m_wellPathGeometry->setDatumElevation( well->GetRkb() ); for ( size_t i = 0; i < x.size(); i++ ) { cvf::Vec3d position( x[i], y[i], -z[i] ); diff --git a/ApplicationLibCode/UnitTests/RifRmsWellPathReader-Test.cpp b/ApplicationLibCode/UnitTests/RifRmsWellPathReader-Test.cpp index 91e45cfb4a..a1b00bcfab 100644 --- a/ApplicationLibCode/UnitTests/RifRmsWellPathReader-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifRmsWellPathReader-Test.cpp @@ -36,6 +36,8 @@ TEST( RifRmsWellPathReader, ReadFromFile ) auto wellPath = wellData.m_wellPathGeometry; ASSERT_TRUE( wellPath.notNull() ); + ASSERT_TRUE( wellPath->hasDatumElevation() ); + EXPECT_DOUBLE_EQ( 25.0, wellPath->datumElevation() ); EXPECT_EQ( 4647u, wellPath->wellPathPoints().size() ); EXPECT_EQ( 4647u, wellPath->measuredDepths().size() ); } diff --git a/ThirdParty/NRLib/nrlib/well/rmswell.cpp b/ThirdParty/NRLib/nrlib/well/rmswell.cpp index 4046dd58f7..f72c694812 100644 --- a/ThirdParty/NRLib/nrlib/well/rmswell.cpp +++ b/ThirdParty/NRLib/nrlib/well/rmswell.cpp @@ -49,7 +49,12 @@ RMSWell::RMSWell(const std::string& filename) SetWellName(wellName); xpos0_ = ReadNext(file, line); ypos0_ = ReadNext(file, line); // read wellname and positions - // getline(file,dummy);// Line may contain a dummy number + try { + rkb_ = ReadNext(file, line); + } catch (std::exception &) { + // Ignore errors: not guaranteed to get rkb + } + // getline(file,dummy);// Line may contain a dummy number //-----line shift DiscardRestOfLine(file, line, false); nlog = ReadNext(file, line); // read number of logs diff --git a/ThirdParty/NRLib/nrlib/well/well.cpp b/ThirdParty/NRLib/nrlib/well/well.cpp index 71d174c8d6..525f25ab8b 100644 --- a/ThirdParty/NRLib/nrlib/well/well.cpp +++ b/ThirdParty/NRLib/nrlib/well/well.cpp @@ -40,6 +40,7 @@ Well::Well() { well_rmissing_ = -999.0; well_imissing_ = -999; + rkb_ = 0.0; } @@ -50,6 +51,7 @@ Well::Well(const std::string & name, well_name_ = name; well_rmissing_ = rmissing; well_imissing_ = imissing; + rkb_ = 0.0; } @@ -62,6 +64,7 @@ Well::Well(const std::map > & cont_log, well_name_ = well_name; well_rmissing_ = -999.0; well_imissing_ = -999; + rkb_ = 0.0; } Well::~Well() diff --git a/ThirdParty/NRLib/nrlib/well/well.hpp b/ThirdParty/NRLib/nrlib/well/well.hpp index 2cdad1e3ed..f8ef5be95d 100644 --- a/ThirdParty/NRLib/nrlib/well/well.hpp +++ b/ThirdParty/NRLib/nrlib/well/well.hpp @@ -149,6 +149,7 @@ namespace NRLib { double GetXPos0() { return x_pos0_ ;} double GetYPos0() { return y_pos0_ ;} + double GetRkb() { return rkb_; } /// Set number of non-missing data void SetNumberOfNonMissingData(int n_data_nonmissing) { n_data_nonmissing_ = n_data_nonmissing ;} @@ -187,6 +188,9 @@ namespace NRLib { // Number of data excluding WELLMISSING values unsigned int n_data_nonmissing_; + // rig-kelly-bushing + double rkb_; + private: /// Continuous logs std::map > cont_log_;