Add well log loaders.

This commit is contained in:
Kristian Bendiksen
2024-07-05 15:57:26 +02:00
parent 694d2eda66
commit 2651ca91b6
11 changed files with 311 additions and 47 deletions

View File

@@ -71,6 +71,8 @@
#include "RimObservedFmuRftData.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h"
#include "RimOsduWellLog.h"
#include "RimOsduWellLogDataLoader.h"
#include "RimOsduWellPath.h"
#include "RimOsduWellPathDataLoader.h"
#include "RimPlotWindow.h"
@@ -91,6 +93,8 @@
#include "RimSurfaceCollection.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileDataLoader.h"
#include "RimWellLogLasFile.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@@ -1758,4 +1762,8 @@ void RiaApplication::initializeDataLoadController()
dataLoadController->registerDataLoader( RimModeledWellPath::classKeywordStatic(),
wellPathGeometryKeyword,
std::make_shared<RimModeledWellPathDataLoader>() );
const QString wellLogKeyword = "WELL_LOG";
dataLoadController->registerDataLoader( RimWellLogFile::classKeywordStatic(), wellLogKeyword, std::make_shared<RimWellLogFileDataLoader>() );
dataLoadController->registerDataLoader( RimOsduWellLog::classKeywordStatic(), wellLogKeyword, std::make_shared<RimOsduWellLogDataLoader>() );
}

View File

@@ -31,6 +31,8 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimRftTopologyCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveInfoTextProvider.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCalculatedCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileDataLoader.h
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellLogDataLoader.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -68,12 +70,16 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimRftTopologyCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveInfoTextProvider.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCalculatedCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileDataLoader.cpp
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellLogDataLoader.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RimOsduWellLogDataLoader.h)
source_group(
"ProjectDataModel\\WellLog"
FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}

View File

@@ -0,0 +1,111 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024- 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 "RimOsduWellLogDataLoader.h"
#include "Cloud/RiaOsduConnector.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimOsduWellLog.h"
#include "RifOsduWellLogReader.h"
#include "RigWellLogData.h"
#include "cafProgressInfo.h"
#include <QApplication>
#include <QObject>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimOsduWellLogDataLoader::RimOsduWellLogDataLoader()
: caf::DataLoader()
{
RiaApplication* app = RiaApplication::instance();
RiaOsduConnector* osduConnector = app->makeOsduConnector();
connect( osduConnector,
SIGNAL( parquetDownloadFinished( const QByteArray&, const QString&, const QString& ) ),
this,
SLOT( parquetDownloadComplete( const QByteArray&, const QString&, const QString& ) ),
Qt::QueuedConnection );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimOsduWellLogDataLoader::loadData( caf::PdmObject& pdmObject, const QString& dataType, int taskId, caf::ProgressInfo& progressInfo )
{
RiaApplication* app = RiaApplication::instance();
RiaOsduConnector* osduConnector = app->makeOsduConnector();
// TODO: this is weird?
m_dataType = dataType;
if ( RimOsduWellLog* osduWellLog = dynamic_cast<RimOsduWellLog*>( &pdmObject ) )
{
QString wellLogId = osduWellLog->wellLogId();
osduConnector->requestWellLogParquetDataById( wellLogId );
m_wellLogs[wellLogId] = osduWellLog;
m_taskIds[wellLogId] = taskId;
}
QApplication::processEvents();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimOsduWellLogDataLoader::isRunnable() const
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimOsduWellLogDataLoader::parquetDownloadComplete( const QByteArray& contents, const QString& url, const QString& id )
{
QMutexLocker lock( &m_mutex );
if ( m_wellLogs.find( id ) != m_wellLogs.end() )
{
int taskId = m_taskIds[id];
RiaLogging::info( QString( "Parquet download complete. Id: %1 Size: %2" ).arg( id ).arg( contents.size() ) );
if ( !contents.isEmpty() )
{
auto osduWellLog = m_wellLogs[id];
auto [wellLogData, errorMessage] = RifOsduWellLogReader::readWellLogData( contents );
if ( wellLogData.notNull() )
{
osduWellLog->setWellLogData( wellLogData.p() );
}
else
{
RiaLogging::warning( errorMessage );
}
}
taskDone.send( m_dataType, taskId );
}
}

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024- 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 "cafDataLoader.h"
#include "cafProgressInfo.h"
#include <QMutex>
#include <QObject>
#include <QString>
class RimOsduWellLog;
//==================================================================================================
///
///
//==================================================================================================
class RimOsduWellLogDataLoader : public QObject, public caf::DataLoader
{
Q_OBJECT
public:
RimOsduWellLogDataLoader();
void loadData( caf::PdmObject& pdmObject, const QString& dataType, int taskId, caf::ProgressInfo& progressInfo ) override;
bool isRunnable() const override;
private slots:
void parquetDownloadComplete( const QByteArray& contents, const QString& url, const QString& id );
private:
std::map<QString, RimOsduWellLog*> m_wellLogs;
std::map<QString, int> m_taskIds;
QString m_dataType;
QMutex m_mutex;
};

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024- 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 "RimWellLogFileDataLoader.h"
#include "RiaLogging.h"
#include "RimWellLogFile.h"
#include "RigWellPath.h"
#include "cafProgressInfo.h"
#include <QApplication>
#include <QObject>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileDataLoader::RimWellLogFileDataLoader()
: caf::DataLoader()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFileDataLoader::loadData( caf::PdmObject& pdmObject, const QString& dataType, int taskId, caf::ProgressInfo& progressInfo )
{
if ( RimWellLogFile* wellLogFile = dynamic_cast<RimWellLogFile*>( &pdmObject ) )
{
QString errorMessage;
if ( !wellLogFile->readFile( &errorMessage ) )
{
RiaLogging::warning( errorMessage );
}
}
taskDone.send( dataType, taskId );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogFileDataLoader::isRunnable() const
{
return true;
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024- 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 "RimFileWellPath.h"
#include "cafDataLoader.h"
#include "cafProgressInfo.h"
#include <QString>
#include <memory>
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogFileDataLoader : public caf::DataLoader
{
public:
RimWellLogFileDataLoader();
void loadData( caf::PdmObject& pdmObject, const QString& dataType, int taskId, caf::ProgressInfo& progressInfo ) override;
bool isRunnable() const override;
};

View File

@@ -48,8 +48,9 @@ list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RimOsduWellPathDataLoader.h)
list(APPEND QT_MOC_HEADERS
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellPathDataLoader.h
)
source_group(
"ProjectDataModel\\WellPath"

View File

@@ -84,26 +84,27 @@ bool RimOsduWellPathDataLoader::isRunnable() const
//--------------------------------------------------------------------------------------------------
void RimOsduWellPathDataLoader::parquetDownloadComplete( const QByteArray& contents, const QString& url, const QString& id )
{
RiaLogging::info( QString( "Parquet download complete. Id: %1 Size: %2" ).arg( id ).arg( contents.size() ) );
QMutexLocker lock( &m_mutex );
int taskId = m_taskIds[id];
if ( !contents.isEmpty() )
if ( m_wellPaths.find( id ) != m_wellPaths.end() )
{
m_parquetData[id] = contents;
RiaLogging::info( QString( "Parquet download complete. Id: %1 Size: %2" ).arg( id ).arg( contents.size() ) );
int taskId = m_taskIds[id];
auto oWPath = m_wellPaths[id];
auto [wellPathGeometry, errorMessage] = RifOsduWellPathReader::readWellPathData( contents, oWPath->datumElevationFromOsdu() );
if ( wellPathGeometry.notNull() )
if ( !contents.isEmpty() )
{
oWPath->setWellPathGeometry( wellPathGeometry.p() );
}
else
{
RiaLogging::warning( errorMessage );
auto oWPath = m_wellPaths[id];
auto [wellPathGeometry, errorMessage] = RifOsduWellPathReader::readWellPathData( contents, oWPath->datumElevationFromOsdu() );
if ( wellPathGeometry.notNull() )
{
oWPath->setWellPathGeometry( wellPathGeometry.p() );
}
else
{
RiaLogging::warning( errorMessage );
}
}
taskDone.send( m_dataType, taskId );
}
taskDone.send( m_dataType, taskId );
}

View File

@@ -43,7 +43,6 @@ private slots:
void parquetDownloadComplete( const QByteArray& contents, const QString& url, const QString& id );
private:
std::map<QString, QByteArray> m_parquetData;
std::map<QString, RimOsduWellPath*> m_wellPaths;
std::map<QString, int> m_taskIds;
QString m_dataType;

View File

@@ -151,47 +151,37 @@ void RimWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changed
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::loadDataAndUpdate()
{
caf::ProgressInfo progress( m_wellPaths.size(), "Reading well paths from file" );
caf::ProgressInfo progress( 3, "Reading well paths from file" );
readWellPathFormationFiles();
RiaApplication* app = RiaApplication::instance();
caf::DataLoadController* dataLoadController = caf::DataLoadController::instance();
const QString wellPathGeometryKeyword = "WELL_PATH_GEOMETRY";
const QString wellLogKeyword = "WELL_LOG";
progress.setProgressDescription( QString( "Reading well path geometry." ) );
for ( RimWellPath* wellPath : allWellPaths() )
{
progress.setProgressDescription( QString( "Reading well %1" ).arg( wellPath->name() ) );
dataLoadController->loadData( *wellPath, wellPathGeometryKeyword, progress );
}
dataLoadController->blockUntilDone( wellPathGeometryKeyword );
progress.incrementProgress();
progress.setProgressDescription( QString( "Reading well logs." ) );
for ( RimWellPath* wellPath : allWellPaths() )
{
for ( RimWellLog* wellLog : wellPath->wellLogs() )
{
if ( RimWellLogFile* wellLogFile = dynamic_cast<RimWellLogFile*>( wellLog ) )
{
QString errorMessage;
if ( !wellLogFile->readFile( &errorMessage ) )
{
RiaLogging::warning( errorMessage );
}
}
else if ( RimOsduWellLog* osduWellLog = dynamic_cast<RimOsduWellLog*>( wellLog ) )
{
RiaOsduConnector* osduConnector = app->makeOsduConnector();
auto [wellLogData, errorMessage] = loadWellLogFromOsdu( osduConnector, osduWellLog->wellLogId() );
if ( wellLogData.notNull() )
{
osduWellLog->setWellLogData( wellLogData.p() );
}
}
dataLoadController->loadData( *wellLog, wellLogKeyword, progress );
}
}
dataLoadController->blockUntilDone( wellLogKeyword );
progress.incrementProgress();
progress.setProgressDescription( QString( "Reading additional data." ) );
for ( RimWellPath* wellPath : allWellPaths() )
{
RimStimPlanModelCollection* stimPlanModelCollection = wellPath->stimPlanModelCollection();
if ( stimPlanModelCollection )
{
@@ -200,8 +190,8 @@ void RimWellPathCollection::loadDataAndUpdate()
stimPlanModel->loadDataAndUpdate();
}
}
progress.incrementProgress();
}
progress.incrementProgress();
rebuildWellPathNodes();