Add action for downloading and parsing well log from OSDU Wellbore DDMS.

This commit is contained in:
Kristian Bendiksen committed 2024-06-14 17:31:22 +02:00
1 parent 5be47b3d2c
commit 23d716754e
20 files changed
+1094 -46

No files matched your search

@@ -28,12 +28,14 @@
#include "RiaTextStringTools.h"
#include "RiaWellNameComparer.h"
#include "RifOsduWellLogReader.h"
#include "RifOsduWellPathReader.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigOsduWellLogData.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
@@ -42,6 +44,7 @@
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimOsduWellLog.h"
#include "RimOsduWellPath.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
@@ -147,6 +150,17 @@ void RimWellPathCollection::loadDataAndUpdate()
{
caf::ProgressInfo progress( m_wellPaths.size(), "Reading well paths from file" );
auto makeOsduConnector = []( auto app )
{
RiaPreferencesOsdu* osduPreferences = app->preferences()->osduPreferences();
const QString server = osduPreferences->server();
const QString dataPartitionId = osduPreferences->dataPartitionId();
const QString authority = osduPreferences->authority();
const QString scopes = osduPreferences->scopes();
const QString clientId = osduPreferences->clientId();
return std::make_unique<RiaOsduConnector>( RiuMainWindow::instance(), server, dataPartitionId, authority, scopes, clientId );
};
readWellPathFormationFiles();
for ( RimWellPath* wellPath : allWellPaths() )
@@ -173,18 +187,8 @@ void RimWellPathCollection::loadDataAndUpdate()
}
else if ( oWPath )
{
RiaApplication* app = RiaApplication::instance();
RiaPreferencesOsdu* osduPreferences = app->preferences()->osduPreferences();
const QString server = osduPreferences->server();
const QString dataParitionId = osduPreferences->dataPartitionId();
const QString authority = osduPreferences->authority();
const QString scopes = osduPreferences->scopes();
const QString clientId = osduPreferences->clientId();
auto osduConnector =
std::make_unique<RiaOsduConnector>( RiuMainWindow::instance(), server, dataParitionId, authority, scopes, clientId );
RiaApplication* app = RiaApplication::instance();
auto osduConnector = makeOsduConnector( app );
auto [wellPathGeometry, errorMessage] = loadWellPathGeometryFromOsdu( osduConnector.get(), oWPath->fileId() );
if ( wellPathGeometry.notNull() )
@@ -199,9 +203,9 @@ void RimWellPathCollection::loadDataAndUpdate()
if ( wellPath )
{
for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
for ( RimWellLog* wellLog : wellPath->wellLogs() )
{
if ( wellLogFile )
if ( RimWellLogFile* wellLogFile = dynamic_cast<RimWellLogFile*>( wellLog ) )
{
QString errorMessage;
if ( !wellLogFile->readFile( &errorMessage ) )
@@ -209,6 +213,16 @@ void RimWellPathCollection::loadDataAndUpdate()
RiaLogging::warning( errorMessage );
}
}
else if ( RimOsduWellLog* osduWellLog = dynamic_cast<RimOsduWellLog*>( wellLog ) )
{
RiaApplication* app = RiaApplication::instance();
auto osduConnector = makeOsduConnector( app );
auto [wellLogData, errorMessage] = loadWellLogFromOsdu( osduConnector.get(), osduWellLog->wellLogId() );
if ( wellLogData.notNull() )
{
osduWellLog->setWellLogData( wellLogData.p() );
}
}
}
RimStimPlanModelCollection* stimPlanModelCollection = wellPath->stimPlanModelCollection();
@@ -419,9 +433,9 @@ std::vector<RimWellLogLasFile*> RimWellPathCollection::addWellLogs( const QStrin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::addWellLog( RimWellLogFile* wellLogFile, RimWellPath* wellPath )
void RimWellPathCollection::addWellLog( RimWellLog* wellLog, RimWellPath* wellPath )
{
wellPath->addWellLog( wellLogFile );
wellPath->addWellLog( wellLog );
sortWellsByName();
updateAllRequiredEditors();
}
@@ -1060,3 +1074,18 @@ std::pair<cvf::ref<RigWellPath>, QString> RimWellPathCollection::loadWellPathGeo
return RifOsduWellPathReader::parseCsv( fileContents );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<cvf::ref<RigOsduWellLogData>, QString> RimWellPathCollection::loadWellLogFromOsdu( RiaOsduConnector* osduConnector,
const QString& wellLogId )
{
auto [fileContents, errorMessage] = osduConnector->requestWellLogParquetDataById( wellLogId );
if ( !errorMessage.isEmpty() )
{
return { nullptr, errorMessage };
}
return RifOsduWellLogReader::readWellLogData( fileContents );
}