mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7715 Add python interface for creating well log plots
This commit is contained in:
@@ -63,6 +63,8 @@
|
|||||||
#include "RiuQwtPlotCurve.h"
|
#include "RiuQwtPlotCurve.h"
|
||||||
#include "RiuQwtPlotWidget.h"
|
#include "RiuQwtPlotWidget.h"
|
||||||
|
|
||||||
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
#include "cafPdmObjectScriptingCapability.h"
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafUtils.h"
|
#include "cafUtils.h"
|
||||||
|
|
||||||
@@ -91,7 +93,7 @@ void AppEnum<RimWellLogExtractionCurve::TrajectoryType>::setUp()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellLogExtractionCurve::RimWellLogExtractionCurve()
|
RimWellLogExtractionCurve::RimWellLogExtractionCurve()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Well Log Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" );
|
CAF_PDM_InitScriptableObject( "Well Log Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type", "", "", "" );
|
||||||
|
|
||||||
@@ -1071,6 +1073,14 @@ QString RimWellLogExtractionCurve::eclipseResultVariable() const
|
|||||||
return m_eclipseResultDefinition->resultVariable();
|
return m_eclipseResultDefinition->resultVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogExtractionCurve::setEclipseResultCategory( RiaDefines::ResultCatType catType )
|
||||||
|
{
|
||||||
|
m_eclipseResultDefinition->setResultType( catType );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public:
|
|||||||
|
|
||||||
void setEclipseResultVariable( const QString& resVarname );
|
void setEclipseResultVariable( const QString& resVarname );
|
||||||
QString eclipseResultVariable() const;
|
QString eclipseResultVariable() const;
|
||||||
|
void setEclipseResultCategory( RiaDefines::ResultCatType catType );
|
||||||
|
|
||||||
void setGeoMechResultAddress( const RigFemResultAddress& resAddr );
|
void setGeoMechResultAddress( const RigFemResultAddress& resAddr );
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimWellPathCollection.h"
|
||||||
|
|
||||||
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
#include "cafPdmObjectScriptingCapability.h"
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimWellLogPlotCollection, "WellLogPlotCollection" );
|
CAF_PDM_SOURCE_INIT( RimWellLogPlotCollection, "WellLogPlotCollection" );
|
||||||
@@ -43,9 +46,9 @@ CAF_PDM_SOURCE_INIT( RimWellLogPlotCollection, "WellLogPlotCollection" );
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellLogPlotCollection::RimWellLogPlotCollection()
|
RimWellLogPlotCollection::RimWellLogPlotCollection()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" );
|
CAF_PDM_InitScriptableObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "", "", "", "" );
|
CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "", "", "", "" );
|
||||||
m_wellLogPlots.uiCapability()->setUiHidden( true );
|
m_wellLogPlots.uiCapability()->setUiHidden( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,8 +83,11 @@
|
|||||||
#include "RiuWellPathComponentPlotItem.h"
|
#include "RiuWellPathComponentPlotItem.h"
|
||||||
|
|
||||||
#include "cafPdmFieldReorderCapability.h"
|
#include "cafPdmFieldReorderCapability.h"
|
||||||
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
#include "cafPdmObjectScriptingCapability.h"
|
||||||
#include "cafPdmUiSliderEditor.h"
|
#include "cafPdmUiSliderEditor.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
@@ -169,7 +172,7 @@ RimWellLogTrack::RimWellLogTrack()
|
|||||||
, m_availableDepthRangeMax( RI_LOGPLOTTRACK_MAXX_DEFAULT )
|
, m_availableDepthRangeMax( RI_LOGPLOTTRACK_MAXX_DEFAULT )
|
||||||
|
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Track", ":/WellLogTrack16x16.png", "", "" );
|
CAF_PDM_InitScriptableObject( "Track", ":/WellLogTrack16x16.png", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" );
|
||||||
|
|
||||||
|
|||||||
@@ -76,14 +76,6 @@ void RimStimPlanModelCurve::setStimPlanModel( RimStimPlanModel* stimPlanModel )
|
|||||||
m_wellPath = stimPlanModel->thicknessDirectionWellPath();
|
m_wellPath = stimPlanModel->thicknessDirectionWellPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimStimPlanModelCurve::setEclipseResultCategory( RiaDefines::ResultCatType catType )
|
|
||||||
{
|
|
||||||
m_eclipseResultDefinition->setResultType( catType );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ public:
|
|||||||
|
|
||||||
void setStimPlanModel( RimStimPlanModel* stimPlanModel );
|
void setStimPlanModel( RimStimPlanModel* stimPlanModel );
|
||||||
|
|
||||||
void setEclipseResultCategory( RiaDefines::ResultCatType catType );
|
|
||||||
|
|
||||||
void setCurveProperty( RiaDefines::CurveProperty ) override;
|
void setCurveProperty( RiaDefines::CurveProperty ) override;
|
||||||
RiaDefines::CurveProperty curveProperty() const override;
|
RiaDefines::CurveProperty curveProperty() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSurfaceCollection.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.h
|
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.h
|
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.h
|
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimcWellLogPlotCollection.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimcWellLogPlot.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimcWellLogTrack.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -29,6 +32,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSurfaceCollection.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimcWellLogPlotCollection.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimcWellLogPlot.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimcWellLogTrack.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "RimcWellLogPlot.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
|
||||||
|
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimWellLogCurveCommonDataSource.h"
|
||||||
|
#include "RimWellLogExtractionCurve.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
|
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||||
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
|
||||||
|
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellLogPlot, RimcWellLogPlot_newWellLogTrack, "NewWellLogTrack" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimcWellLogPlot_newWellLogTrack::RimcWellLogPlot_newWellLogTrack( caf::PdmObjectHandle* self )
|
||||||
|
: caf::PdmObjectMethod( self )
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject( "Create Well Log Track", "", "", "Create a new well log track" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_title, "Title", "", "", "", "Title" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "", "", "", "Case" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "", "", "", "Well Path" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmObjectHandle* RimcWellLogPlot_newWellLogTrack::execute()
|
||||||
|
{
|
||||||
|
RimWellLogPlot* wellLogPlot = self<RimWellLogPlot>();
|
||||||
|
|
||||||
|
// Make sure the plot window is created
|
||||||
|
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||||
|
|
||||||
|
if ( !wellLogPlot ) return nullptr;
|
||||||
|
|
||||||
|
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, m_title, wellLogPlot );
|
||||||
|
if ( m_case() ) plotTrack->setFormationCase( m_case );
|
||||||
|
if ( m_wellPath() ) plotTrack->setFormationWellPath( m_wellPath );
|
||||||
|
plotTrack->setColSpan( RimPlot::TWO );
|
||||||
|
plotTrack->setLegendsVisible( true );
|
||||||
|
plotTrack->setPlotTitleVisible( true );
|
||||||
|
plotTrack->setShowWindow( true );
|
||||||
|
plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR );
|
||||||
|
plotTrack->setShowRegionLabels( true );
|
||||||
|
plotTrack->setAutoScaleXEnabled( true );
|
||||||
|
plotTrack->updateConnectedEditors();
|
||||||
|
wellLogPlot->setShowWindow( true );
|
||||||
|
wellLogPlot->updateConnectedEditors();
|
||||||
|
|
||||||
|
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||||
|
|
||||||
|
wellLogPlot->loadDataAndUpdate();
|
||||||
|
return plotTrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimcWellLogPlot_newWellLogTrack::resultIsPersistent() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::unique_ptr<caf::PdmObjectHandle> RimcWellLogPlot_newWellLogTrack::defaultResult() const
|
||||||
|
{
|
||||||
|
return std::unique_ptr<caf::PdmObjectHandle>( new RimWellLogTrack );
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "RimWellLogPlot.h"
|
||||||
|
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObjectHandle.h"
|
||||||
|
#include "cafPdmObjectMethod.h"
|
||||||
|
#include "cafPdmPtrArrayField.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
class RimEclipseCase;
|
||||||
|
class RimWellPath;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimcWellLogPlot_newWellLogTrack : public caf::PdmObjectMethod
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimcWellLogPlot_newWellLogTrack( caf::PdmObjectHandle* self );
|
||||||
|
|
||||||
|
caf::PdmObjectHandle* execute() override;
|
||||||
|
bool resultIsPersistent() const override;
|
||||||
|
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField<QString> m_title;
|
||||||
|
caf::PdmPtrField<RimEclipseCase*> m_case;
|
||||||
|
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||||
|
};
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "RimcWellLogPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
|
||||||
|
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimWellLogCurveCommonDataSource.h"
|
||||||
|
#include "RimWellLogExtractionCurve.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
|
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||||
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
|
||||||
|
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellLogPlotCollection, RimcWellLogPlotCollection_newWellLogPlot, "NewWellLogPlot" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimcWellLogPlotCollection_newWellLogPlot::RimcWellLogPlotCollection_newWellLogPlot( caf::PdmObjectHandle* self )
|
||||||
|
: caf::PdmObjectMethod( self )
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject( "Create Well Log Plot", "", "", "Create a new well log plot" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "", "", "", "Case" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "", "", "", "Well Path" );
|
||||||
|
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_propertyType, "PropertyType", "", "", "", "Property Type" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_propertyName, "PropertyName", "", "", "", "Property Name" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_timeStep, "TimeStep", "", "", "", "Time Step" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmObjectHandle* RimcWellLogPlotCollection_newWellLogPlot::execute()
|
||||||
|
{
|
||||||
|
RimWellLogPlot* newWellLogPlot = nullptr;
|
||||||
|
RimWellLogPlotCollection* wellLogPlotCollection = self<RimWellLogPlotCollection>();
|
||||||
|
|
||||||
|
// Make sure the plot window is created
|
||||||
|
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||||
|
|
||||||
|
if ( m_case && m_wellPath && wellLogPlotCollection )
|
||||||
|
{
|
||||||
|
newWellLogPlot = new RimWellLogPlot;
|
||||||
|
newWellLogPlot->setAsPlotMdiWindow();
|
||||||
|
|
||||||
|
wellLogPlotCollection->addWellLogPlot( newWellLogPlot );
|
||||||
|
|
||||||
|
newWellLogPlot->commonDataSource()->setCaseToApply( m_case );
|
||||||
|
newWellLogPlot->commonDataSource()->setWellPathToApply( m_wellPath );
|
||||||
|
newWellLogPlot->loadDataAndUpdate();
|
||||||
|
newWellLogPlot->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
return newWellLogPlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimcWellLogPlotCollection_newWellLogPlot::resultIsPersistent() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::unique_ptr<caf::PdmObjectHandle> RimcWellLogPlotCollection_newWellLogPlot::defaultResult() const
|
||||||
|
{
|
||||||
|
return std::unique_ptr<caf::PdmObjectHandle>( new RimWellLogPlot );
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "RimWellLogPlotCollection.h"
|
||||||
|
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObjectHandle.h"
|
||||||
|
#include "cafPdmObjectMethod.h"
|
||||||
|
#include "cafPdmPtrArrayField.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
class RimStimPlanModel;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimcWellLogPlotCollection_newWellLogPlot : public caf::PdmObjectMethod
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimcWellLogPlotCollection_newWellLogPlot( caf::PdmObjectHandle* self );
|
||||||
|
|
||||||
|
caf::PdmObjectHandle* execute() override;
|
||||||
|
bool resultIsPersistent() const override;
|
||||||
|
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmPtrField<RimEclipseCase*> m_case;
|
||||||
|
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||||
|
caf::PdmField<QString> m_propertyType;
|
||||||
|
caf::PdmField<QString> m_propertyName;
|
||||||
|
caf::PdmField<int> m_timeStep;
|
||||||
|
};
|
||||||
109
ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp
Normal file
109
ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "RimcWellLogTrack.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
|
||||||
|
#include "WellLogCommands/RicNewWellLogPlotFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimWellLogCurveCommonDataSource.h"
|
||||||
|
#include "RimWellLogExtractionCurve.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
|
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||||
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
|
||||||
|
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellLogTrack, RimcWellLogTrack_addExtractionCurve, "AddExtractionCurve" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimcWellLogTrack_addExtractionCurve::RimcWellLogTrack_addExtractionCurve( caf::PdmObjectHandle* self )
|
||||||
|
: caf::PdmObjectMethod( self )
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject( "Create Well Log Extraction Curve", "", "", "Create a well log extraction curve" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "", "", "", "Case" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "", "", "", "Well Path" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_propertyType, "PropertyType", "", "", "", "Property Type" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_propertyName, "PropertyName", "", "", "", "Property Name" );
|
||||||
|
CAF_PDM_InitScriptableFieldNoDefault( &m_timeStep, "TimeStep", "", "", "", "Time Step" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmObjectHandle* RimcWellLogTrack_addExtractionCurve::execute()
|
||||||
|
{
|
||||||
|
RimWellLogTrack* wellLogTrack = self<RimWellLogTrack>();
|
||||||
|
|
||||||
|
// Make sure the plot window is created
|
||||||
|
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||||
|
|
||||||
|
if ( m_case && m_wellPath && wellLogTrack )
|
||||||
|
{
|
||||||
|
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve;
|
||||||
|
curve->setWellPath( m_wellPath );
|
||||||
|
curve->setCase( m_case );
|
||||||
|
curve->setCurrentTimeStep( m_timeStep );
|
||||||
|
curve->setEclipseResultVariable( m_propertyName );
|
||||||
|
|
||||||
|
RiaDefines::ResultCatType resultCategoryType = caf::AppEnum<RiaDefines::ResultCatType>::fromText( m_propertyType );
|
||||||
|
curve->setEclipseResultCategory( resultCategoryType );
|
||||||
|
|
||||||
|
wellLogTrack->addCurve( curve );
|
||||||
|
curve->loadDataAndUpdate( true );
|
||||||
|
|
||||||
|
curve->updateConnectedEditors();
|
||||||
|
|
||||||
|
wellLogTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR );
|
||||||
|
wellLogTrack->setShowRegionLabels( true );
|
||||||
|
wellLogTrack->setAutoScaleXEnabled( true );
|
||||||
|
wellLogTrack->updateConnectedEditors();
|
||||||
|
wellLogTrack->setShowWindow( true );
|
||||||
|
|
||||||
|
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||||
|
|
||||||
|
RimWellLogPlot* wellLogPlot = dynamic_cast<RimWellLogPlot*>( wellLogTrack->parentField() );
|
||||||
|
if ( wellLogPlot ) wellLogPlot->loadDataAndUpdate();
|
||||||
|
|
||||||
|
return curve;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimcWellLogTrack_addExtractionCurve::resultIsPersistent() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::unique_ptr<caf::PdmObjectHandle> RimcWellLogTrack_addExtractionCurve::defaultResult() const
|
||||||
|
{
|
||||||
|
return std::unique_ptr<caf::PdmObjectHandle>( new RimWellLogExtractionCurve );
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021- 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 "cafPdmField.h"
|
||||||
|
#include "cafPdmObjectHandle.h"
|
||||||
|
#include "cafPdmObjectMethod.h"
|
||||||
|
#include "cafPdmPtrArrayField.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
class RimEclipseCase;
|
||||||
|
class RimWellPath;
|
||||||
|
class RimWellLogTrack;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimcWellLogTrack_addExtractionCurve : public caf::PdmObjectMethod
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimcWellLogTrack_addExtractionCurve( caf::PdmObjectHandle* self );
|
||||||
|
|
||||||
|
caf::PdmObjectHandle* execute() override;
|
||||||
|
bool resultIsPersistent() const override;
|
||||||
|
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmPtrField<RimEclipseCase*> m_case;
|
||||||
|
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||||
|
caf::PdmField<QString> m_propertyType;
|
||||||
|
caf::PdmField<QString> m_propertyName;
|
||||||
|
caf::PdmField<int> m_timeStep;
|
||||||
|
};
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# Load ResInsight Processing Server Client Library
|
||||||
|
import rips
|
||||||
|
import tempfile
|
||||||
|
from os.path import expanduser
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Connect to ResInsight instance
|
||||||
|
resinsight = rips.Instance.find()
|
||||||
|
|
||||||
|
|
||||||
|
home_dir = expanduser("~")
|
||||||
|
|
||||||
|
|
||||||
|
properties = [("STATIC_NATIVE", "PORO", 0), ("DYNAMIC_NATIVE", "PRESSURE", 0)]
|
||||||
|
|
||||||
|
export_folder = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
directory_path = "resprojects/webviz-subsurface-testdata/reek_history_match/"
|
||||||
|
|
||||||
|
|
||||||
|
case_file_paths = []
|
||||||
|
num_realizations = 9
|
||||||
|
num_iterations = 4
|
||||||
|
|
||||||
|
|
||||||
|
for realization in range(0, num_realizations):
|
||||||
|
for iteration in range(0, num_iterations):
|
||||||
|
realization_dir = "realization-" + str(realization)
|
||||||
|
iteration_dir = "iter-" + str(iteration)
|
||||||
|
egrid_name = "eclipse/model/5_R001_REEK-" + str(realization) + ".EGRID"
|
||||||
|
path = Path(
|
||||||
|
home_dir, directory_path, realization_dir, iteration_dir, egrid_name
|
||||||
|
)
|
||||||
|
case_file_paths.append(path)
|
||||||
|
|
||||||
|
for path in case_file_paths:
|
||||||
|
# Load a case
|
||||||
|
path_name = path.as_posix()
|
||||||
|
case = resinsight.project.load_case(path_name)
|
||||||
|
|
||||||
|
# Load some wells
|
||||||
|
well_paths = resinsight.project.import_well_paths(
|
||||||
|
well_path_files=[
|
||||||
|
Path(home_dir, directory_path, "wellpaths", "Well-1.dev").as_posix(),
|
||||||
|
Path(home_dir, directory_path, "wellpaths", "Well-2.dev").as_posix(),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if resinsight.project.has_warnings():
|
||||||
|
for warning in resinsight.project.warnings():
|
||||||
|
print(warning)
|
||||||
|
|
||||||
|
well_log_plot_collection = resinsight.project.descendants(
|
||||||
|
rips.WellLogPlotCollection
|
||||||
|
)[0]
|
||||||
|
|
||||||
|
for well_path in well_paths:
|
||||||
|
print(
|
||||||
|
"Generating las file for well: " + well_path.name + " in case: " + path_name
|
||||||
|
)
|
||||||
|
|
||||||
|
well_log_plot = well_log_plot_collection.new_well_log_plot(case, well_path)
|
||||||
|
|
||||||
|
# Create a track for each property
|
||||||
|
for (prop_type, prop_name, time_step) in properties:
|
||||||
|
track = well_log_plot.new_well_log_track(
|
||||||
|
"Track: " + prop_name, case, well_path
|
||||||
|
)
|
||||||
|
|
||||||
|
c = track.add_extraction_curve(
|
||||||
|
case, well_path, prop_type, prop_name, time_step
|
||||||
|
)
|
||||||
|
|
||||||
|
parent_path = path.parent
|
||||||
|
export_folder_path = Path(parent_path, "lasexport")
|
||||||
|
export_folder_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
export_folder = export_folder_path.as_posix()
|
||||||
|
well_log_plot.export_data_as_las(export_folder=export_folder)
|
||||||
Reference in New Issue
Block a user