mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#12462 Well Path Import: add support for RMS well format.
This commit is contained in:
1 parent
b46e55bc21
commit
065d39d856
9 files changed
+4850
-1
No files matched your search
@@ -190,7 +190,7 @@ std::vector<RimWellPath*> RicImportWellPaths::importWellPaths( const QStringList
|
||||
QStringList RicImportWellPaths::wellPathNameFilters()
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << "*.json" << "*.asc" << " *.asci" << "*.ascii" << "*.dev";
|
||||
nameFilters << "*.json" << "*.asc" << " *.asci" << "*.ascii" << "*.dev" << "*.rmswell";
|
||||
return nameFilters;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfio.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFileTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifVtkImportUtil.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRmsWellPathReader.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -215,6 +216,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfio.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFileTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifVtkImportUtil.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRmsWellPathReader.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifRmsWellPathReader.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStringEncodingTools.h"
|
||||
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
#include "well.hpp"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifWellPathImporter::WellData RifRmsWellPathReader::readWellData( const QString& filePath )
|
||||
{
|
||||
try
|
||||
{
|
||||
int wellFormat = NRLib::Well::RMS;
|
||||
|
||||
std::unique_ptr<NRLib::Well> well( NRLib::Well::ReadWell( RiaStringEncodingTools::toNativeEncoded( filePath ).data(), wellFormat ) );
|
||||
|
||||
if ( well )
|
||||
{
|
||||
const std::map<std::string, std::vector<double>>& contLogs = well->GetContLog();
|
||||
|
||||
std::vector<double> x;
|
||||
std::vector<double> y;
|
||||
std::vector<double> z;
|
||||
std::vector<double> md;
|
||||
for ( const auto& [name, values] : contLogs )
|
||||
{
|
||||
QString logName = QString::fromStdString( name ).toUpper();
|
||||
if ( logName == "X" )
|
||||
x = values;
|
||||
else if ( logName == "Y" )
|
||||
y = values;
|
||||
else if ( logName == "Z" )
|
||||
z = values;
|
||||
else if ( logName == "MDEPTH" )
|
||||
md = values;
|
||||
}
|
||||
|
||||
if ( !x.empty() && x.size() == y.size() && x.size() == z.size() && x.size() == md.size() )
|
||||
{
|
||||
auto wellData = RifWellPathImporter::WellData();
|
||||
|
||||
wellData.m_name = QString::fromStdString( well->GetWellName() );
|
||||
wellData.m_wellPathGeometry = new RigWellPath;
|
||||
for ( size_t i = 0; i < x.size(); i++ )
|
||||
{
|
||||
cvf::Vec3d position( x[i], y[i], -z[i] );
|
||||
double measuredDepth = md[i];
|
||||
wellData.m_wellPathGeometry->addWellPathPoint( position, measuredDepth );
|
||||
}
|
||||
|
||||
return wellData;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
{
|
||||
if ( e.what() )
|
||||
{
|
||||
RiaLogging::error( QString( "Failed to import RMS well path: %1. Error: %2" ).arg( filePath ).arg( e.what() ) );
|
||||
}
|
||||
}
|
||||
|
||||
RiaLogging::error( QString( "Failed to import RMS well path: %1." ).arg( filePath ) );
|
||||
return RifWellPathImporter::WellData();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifRmsWellPathReader
|
||||
{
|
||||
public:
|
||||
static RifWellPathImporter::WellData readWellData( const QString& filePath );
|
||||
};
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
#include "RifRmsWellPathReader.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
@@ -45,6 +46,10 @@ RifWellPathImporter::WellData RifWellPathImporter::readWellData( const QString&
|
||||
{
|
||||
return readJsonWellData( filePath );
|
||||
}
|
||||
else if ( isRmsWellFile( filePath ) )
|
||||
{
|
||||
return RifRmsWellPathReader::readWellData( filePath );
|
||||
}
|
||||
else
|
||||
{
|
||||
return readAsciiWellData( filePath, indexInFile );
|
||||
@@ -94,6 +99,11 @@ size_t RifWellPathImporter::wellDataCount( const QString& filePath )
|
||||
// Only support JSON files with single well data currently
|
||||
return 1;
|
||||
}
|
||||
else if ( isRmsWellFile( filePath ) )
|
||||
{
|
||||
// Only support JSON files with single well data currently
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it = m_fileNameToWellDataGroupMap.find( filePath );
|
||||
@@ -121,6 +131,15 @@ bool RifWellPathImporter::isJsonFile( const QString& filePath )
|
||||
return ( fileInfo.suffix().compare( "json" ) == 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifWellPathImporter::isRmsWellFile( const QString& filePath )
|
||||
{
|
||||
QFileInfo fileInfo( filePath );
|
||||
return ( fileInfo.suffix().compare( "rmswell" ) == 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -71,6 +71,7 @@ private:
|
||||
static WellMetaData readJsonWellMetaData( const QString& filePath );
|
||||
static WellMetaData readAsciiWellMetaData( const QString& filePath, size_t indexInFile );
|
||||
static bool isJsonFile( const QString& filePath );
|
||||
static bool isRmsWellFile( const QString& filePath );
|
||||
|
||||
private:
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>> m_fileNameToWellDataGroupMap;
|
||||
|
||||
@@ -112,6 +112,7 @@ set(SOURCE_UNITTEST_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleImportTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfio-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRmsWellPathReader-Test.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RifRmsWellPathReader.h"
|
||||
|
||||
#include "RiaTestDataDirectory.h"
|
||||
|
||||
static const QString TEST_DATA_DIRECTORY = QString( "%1/RifRmsWellPathReader/" ).arg( TEST_DATA_DIR );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RifRmsWellPathReader, ReadFromFile )
|
||||
{
|
||||
QString filePath = TEST_DATA_DIRECTORY + "55_33-1.rmswell";
|
||||
auto wellData = RifRmsWellPathReader::readWellData( filePath );
|
||||
EXPECT_EQ( wellData.m_name, QString( "55_33-1" ) );
|
||||
|
||||
auto wellPath = wellData.m_wellPathGeometry;
|
||||
ASSERT_TRUE( wellPath.notNull() );
|
||||
|
||||
EXPECT_EQ( 4647u, wellPath->wellPathPoints().size() );
|
||||
EXPECT_EQ( 4647u, wellPath->measuredDepths().size() );
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user