Create features to append plots with RFT curves (#9200)

* Add create plot with RFT curve
* Add RFT segment plot with curve
* Create tracks for all three branch types

* Make sure the zero is displayed when adjusted minimum is changing sign
This commit is contained in:
Magne Sjaastad 2022-08-17 10:04:10 +02:00 committed by GitHub
parent 1507894066
commit 597a3d1f97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 412 additions and 10 deletions

View File

@ -466,6 +466,67 @@ RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLo
showPlotWindow );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogCurve* RicWellLogTools::addSummaryRftCurve( RimWellLogTrack* plotTrack, RimSummaryCase* rimCase )
{
auto curve = new RimWellLogRftCurve();
curve->setSummaryCase( rimCase );
auto rftReader = rimCase->rftReader();
QString wellName;
auto wellNames = rftReader->wellNames();
if ( !wellNames.empty() ) wellName = *wellNames.begin();
QDateTime dateTime;
auto timeSteps = rftReader->availableTimeSteps( wellName );
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
RifEclipseRftAddress adr =
RifEclipseRftAddress::createAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
curve->setRftAddress( adr );
plotTrack->addCurve( curve );
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogCurve* RicWellLogTools::addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
const QString& resultName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* rimCase )
{
auto curve = new RimWellLogRftCurve();
curve->setSummaryCase( rimCase );
auto rftReader = rimCase->rftReader();
QString wellName;
auto wellNames = rftReader->wellNames();
if ( !wellNames.empty() ) wellName = *wellNames.begin();
QDateTime dateTime;
auto timeSteps = rftReader->availableTimeSteps( wellName );
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
RifEclipseRftAddress adr =
RifEclipseRftAddress::createBranchSegmentAddress( wellName, dateTime, resultName, 1, branchType );
curve->setRftAddress( adr );
curve->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );
plotTrack->addCurve( curve );
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -18,6 +18,8 @@
#pragma once
#include "RiaRftDefines.h"
#include <QString>
#include <vector>
@ -34,6 +36,8 @@ class RimWellLogTrack;
class RimWellLogWbsCurve;
class RimWellPath;
class RimWellMeasurementCurve;
class RimSummaryCase;
class RimWellLogCurve;
//--------------------------------------------------------------------------------------------------
///
@ -73,6 +77,12 @@ public:
const QString& measurementName,
bool showPlotWindow = true );
static RimWellLogCurve* addSummaryRftCurve( RimWellLogTrack* plotTrack, RimSummaryCase* rimCase );
static RimWellLogCurve* addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
const QString& resultName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* rimCase );
private:
template <typename ExtractionCurveType>
static ExtractionCurveType* addExtractionCurve( RimWellLogTrack* plotTrack,

View File

@ -27,6 +27,8 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWellBoreStabilityPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogCurveFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -58,6 +60,8 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWellBoreStabilityPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogCurveFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -0,0 +1,119 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RicNewRftSegmentWellLogCurveFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RiaRftDefines.h"
#include "RigWellLogCurveData.h"
#include "RimRftCase.h"
#include "RimSummaryCase.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewRftSegmentWellLogCurveFeature, "RicNewRftSegmentWellLogCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftSegmentWellLogCurveFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogCurveFeature::onActionTriggered( bool isChecked )
{
auto rftCase = caf::SelectionManager::instance()->selectedItemOfType<RimRftCase>();
if ( !rftCase ) return;
RimSummaryCase* summaryCase = nullptr;
rftCase->firstAncestorOfType( summaryCase );
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
QString resultName = "SEGGRAT";
{
auto branchType = RiaDefines::RftBranchType::RFT_TUBING;
appendTrackAndCurveForBranchType( plot, resultName, branchType, summaryCase );
}
{
auto branchType = RiaDefines::RftBranchType::RFT_DEVICE;
appendTrackAndCurveForBranchType( plot, resultName, branchType, summaryCase );
}
{
auto branchType = RiaDefines::RftBranchType::RFT_ANNULUS;
appendTrackAndCurveForBranchType( plot, resultName, branchType, summaryCase );
}
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogCurveFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& resultName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
plot->loadDataAndUpdate();
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, branchType, summaryCase );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
RiuPlotMainWindowTools::setExpanded( curve );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Append RFT Segment Curve" );
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
}

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RiaRftDefines.h"
#include "cafCmdFeature.h"
class RimWellLogPlot;
class RimSummaryCase;
//==================================================================================================
///
//==================================================================================================
class RicNewRftSegmentWellLogCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
void appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& resultName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase );
};

View File

@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RicNewRftWellLogCurveFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RigWellLogCurveData.h"
#include "RimRftCase.h"
#include "RimSummaryCase.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewRftWellLogCurveFeature, "RicNewRftWellLogCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftWellLogCurveFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftWellLogCurveFeature::onActionTriggered( bool isChecked )
{
auto rftCase = caf::SelectionManager::instance()->selectedItemOfType<RimRftCase>();
if ( !rftCase ) return;
RimSummaryCase* summaryCase = nullptr;
rftCase->firstAncestorOfType( summaryCase );
auto plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
plot->loadDataAndUpdate();
auto curve = RicWellLogTools::addSummaryRftCurve( plotTrack, summaryCase );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
RiuPlotMainWindowTools::setExpanded( curve );
RiuPlotMainWindowTools::selectAsCurrentItem( curve );
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftWellLogCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Append RFT Well Log Curve" );
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewRftWellLogCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -80,6 +80,17 @@ RimWellBoreStabilityPlot*
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot()
{
auto plot = createWellLogPlot();
plot->setDepthOrientation( RimDepthTrackPlot::DepthOrientation::HORIZONTAL );
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -37,12 +37,17 @@ public:
static RimWellBoreStabilityPlot* createWellBoreStabilityPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ),
const RimWbsParameters* params = nullptr );
static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) );
static RimWellLogTrack* createWellLogPlotTrack( bool updateAfterCreation = true,
const QString& trackDescription = QString( "" ),
RimDepthTrackPlot* existingPlot = nullptr );
static void updateAfterCreation( RimDepthTrackPlot* plot );
static RimWellLogPlot* createHorizontalWellLogPlot();
static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) );
static RimWellLogTrack* createWellLogPlotTrack( bool updateAfterCreation = true,
const QString& trackDescription = QString( "" ),
RimDepthTrackPlot* existingPlot = nullptr );
static void updateAfterCreation( RimDepthTrackPlot* plot );
private:
static RimWellLogPlotCollection* wellLogPlotCollection();

View File

@ -106,6 +106,7 @@
#include "RimPltPlotCollection.h"
#include "RimPressureTable.h"
#include "RimProject.h"
#include "RimRftCase.h"
#include "RimRftPlotCollection.h"
#include "RimSaturationPressurePlotCollection.h"
#include "RimScriptCollection.h"
@ -1070,6 +1071,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
{
menuBuilder << "RicNewPlotAxisPropertiesFeature";
}
else if ( dynamic_cast<RimRftCase*>( firstUiItem ) )
{
menuBuilder << "RicNewRftWellLogCurveFeature";
menuBuilder << "RicNewRftSegmentWellLogCurveFeature";
}
if ( dynamic_cast<Rim3dView*>( firstUiItem ) )
{

View File

@ -1217,6 +1217,14 @@ RimDepthTrackPlot::DepthOrientation RimDepthTrackPlot::depthOrientation() const
return m_depthOrientation();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::setDepthOrientation( DepthOrientation depthOrientation )
{
m_depthOrientation = depthOrientation;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -105,9 +105,11 @@ public:
AxisGridVisibility depthAxisGridLinesEnabled() const;
RimDepthTrackPlot::DepthOrientation depthOrientation() const;
RiuPlotAxis depthAxis() const;
RiuPlotAxis valueAxis() const;
RiuPlotAxis annotationAxis() const;
void setDepthOrientation( RimDepthTrackPlot::DepthOrientation depthOrientation );
RiuPlotAxis depthAxis() const;
RiuPlotAxis valueAxis() const;
RiuPlotAxis annotationAxis() const;
void setAutoScalePropertyValuesEnabled( bool enabled );
void setAutoScaleDepthValuesEnabled( bool enabled );

View File

@ -327,6 +327,7 @@ void RimWellLogRftCurve::setRftAddress( RifEclipseRftAddress address )
m_rftDataType = RftDataType::RFT_SEGMENT_DATA;
m_segmentResultName = address.segmentResultName();
m_segmentBranchIndex = address.segmentBranchIndex();
m_segmentBranchType = address.segmentBranchType();
}
else
{

View File

@ -2138,9 +2138,13 @@ std::pair<double, double> RimWellLogTrack::extendMinMaxRange( double minValue, d
auto candidateMinValue = minValue - factor * range;
if ( std::signbit( minValue ) == std::signbit( candidateMinValue ) )
{
// Leave minimum unchanged if the changes causes change of sign to make sure that zero is located properly
modifiedMin = candidateMinValue;
}
else
{
// If the sign of the adjusted minimum changes, set minimum to zero to make sure that zero is located properly
modifiedMin = 0.0;
}
return { modifiedMin, modifiedMax };
}