Osdu Well Log: make it possible to add Osdu well logs to plot.

This commit is contained in:
Kristian Bendiksen
2024-06-03 19:42:08 +02:00
parent 23d716754e
commit 10ad053c30
14 changed files with 104 additions and 78 deletions

View File

@@ -72,24 +72,30 @@ void RicImportWellLogOsduFeature::onActionTriggered( bool isChecked )
if ( !oilField->wellPathCollection ) oilField->wellPathCollection = std::make_unique<RimWellPathCollection>();
RimOsduWellLog* osduWellLog = new RimOsduWellLog;
// TODO: get from OSDU...
osduWellLog->setWellLogId( "npequinor-dev:work-product-component--WellLog:aeb5bd8b1de14138afe9f23cacbc7fe7" );
oilField->wellPathCollection->addWellLog( osduWellLog, wellPath );
std::vector<QString> wellLogIds = { "npequinor-dev:work-product-component--WellLog:aeb5bd8b1de14138afe9f23cacbc7fe7" };
auto osduConnector = makeOsduConnector( app );
auto [wellLogData, errorMessage] = RimWellPathCollection::loadWellLogFromOsdu( osduConnector.get(), osduWellLog->wellLogId() );
if ( wellLogData.notNull() )
for ( QString wellLogId : wellLogIds )
{
osduWellLog->setWellLogData( wellLogData.p() );
}
else
{
RiaLogging::error( "Importing OSDU well log failed: " + errorMessage );
}
RimOsduWellLog* osduWellLog = new RimOsduWellLog;
osduWellLog->setName( wellLogId );
osduWellLog->setWellLogId( wellLogId );
oilField->wellPathCollection->addWellLog( osduWellLog, wellPath );
osduWellLog->updateConnectedEditors();
auto osduConnector = makeOsduConnector( app );
auto [wellLogData, errorMessage] = RimWellPathCollection::loadWellLogFromOsdu( osduConnector.get(), osduWellLog->wellLogId() );
if ( wellLogData.notNull() )
{
osduWellLog->setWellLogData( wellLogData.p() );
}
else
{
RiaLogging::error( "Importing OSDU well log failed: " + errorMessage );
}
osduWellLog->updateConnectedEditors();
}
}
}

View File

@@ -147,7 +147,7 @@ void RicWellLogTools::addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack,
if ( wellPath )
{
if ( wellLogFile ) plotCurve->setWellLogFile( wellLogFile );
if ( wellLogFile ) plotCurve->setWellLog( wellLogFile );
plotCurve->setWellPath( wellPath );
plotCurve->setWellLogChannelName( wellLogChannel->name() );

View File

@@ -69,13 +69,12 @@ void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
plot->loadDataAndUpdate();
for ( size_t wlIdx = 0; wlIdx < selection.size(); wlIdx++ )
bool isFirst = true;
for ( RimWellLogChannel* wellLogChannel : selection )
{
RimWellLogChannel* wellLog = selection[wlIdx];
auto wellPath = wellLog->firstAncestorOrThisOfType<RimWellPath>();
auto wellLogFile = wellLog->firstAncestorOrThisOfType<RimWellLogLasFile>();
if ( wellLogFile )
auto wellPath = wellLogChannel->firstAncestorOrThisOfType<RimWellPath>();
auto wellLog = wellLogChannel->firstAncestorOrThisOfType<RimWellLog>();
if ( wellLog )
{
RimWellLogLasFileCurve* curve = new RimWellLogLasFileCurve;
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
@@ -83,18 +82,19 @@ void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
plotTrack->addCurve( curve );
RigWellLogLasFile* wellLogDataFile = wellLogFile->wellLogData();
CVF_ASSERT( wellLogDataFile );
RigWellLogData* wellLogData = wellLog->wellLogData();
CVF_ASSERT( wellLogData );
if ( wlIdx == 0 )
if ( isFirst )
{
// Initialize plot with depth unit from the first log file
plot->setDepthUnit( wellLogDataFile->depthUnit() );
plot->setDepthUnit( wellLogData->depthUnit() );
isFirst = false;
}
curve->setWellPath( wellPath );
curve->setWellLogChannelName( wellLog->name() );
curve->setWellLogFile( wellLogFile );
curve->setWellLogChannelName( wellLogChannel->name() );
curve->setWellLog( wellLog );
curve->loadDataAndUpdate( true );
}

View File

@@ -72,7 +72,7 @@ void RicNewWellLogFileCurveFeature::onActionTriggered( bool isChecked )
if ( wellPath->wellLogFiles().size() == 1 )
{
plotCurve->setWellLogFile( wellPath->wellLogFiles().front() );
plotCurve->setWellLog( wellPath->wellLogFiles().front() );
}
plotCurve->updateConnectedEditors();
}