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

@@ -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();