mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
#8555 Well Log Extraction : Fix missing curve data for no console
This commit is contained in:
parent
477ae02382
commit
79614e09e9
@ -340,69 +340,75 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( isCurveVisible() && m_plotCurve )
|
||||
if ( isCurveVisible() )
|
||||
{
|
||||
bool isUsingPseudoLength = false;
|
||||
performDataExtraction( &isUsingPseudoLength );
|
||||
|
||||
RimDepthTrackPlot* wellLogPlot;
|
||||
firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( !wellLogPlot ) return;
|
||||
|
||||
RiaDefines::DepthTypeEnum depthType = wellLogPlot->depthType();
|
||||
RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit();
|
||||
if ( depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH ||
|
||||
depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB )
|
||||
if ( m_plotCurve )
|
||||
{
|
||||
isUsingPseudoLength = false;
|
||||
}
|
||||
bool isUsingPseudoLength = false;
|
||||
performDataExtraction( &isUsingPseudoLength );
|
||||
|
||||
bool useLogarithmicScale = false;
|
||||
RimDepthTrackPlot* wellLogPlot;
|
||||
firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( !wellLogPlot ) return;
|
||||
|
||||
RimWellLogTrack* track = nullptr;
|
||||
firstAncestorOfType( track );
|
||||
if ( track )
|
||||
{
|
||||
useLogarithmicScale = track->isLogarithmicScale();
|
||||
}
|
||||
|
||||
std::vector<double> xPlotValues = curveData()->propertyValuesByIntervals();
|
||||
std::vector<double> depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit );
|
||||
CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() );
|
||||
|
||||
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, useLogarithmicScale );
|
||||
|
||||
else
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, useLogarithmicScale );
|
||||
|
||||
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
|
||||
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
|
||||
if ( isUsingPseudoLength )
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
firstAncestorOrThisOfType( wellLogTrack );
|
||||
CVF_ASSERT( wellLogTrack );
|
||||
|
||||
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
||||
if ( viewer )
|
||||
RiaDefines::DepthTypeEnum depthType = wellLogPlot->depthType();
|
||||
RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit();
|
||||
if ( depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH ||
|
||||
depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB )
|
||||
{
|
||||
viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "PL/" + wellLogPlot->depthAxisTitle() );
|
||||
isUsingPseudoLength = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
bool useLogarithmicScale = false;
|
||||
|
||||
setLogScaleFromSelectedResult();
|
||||
RimWellLogTrack* track = nullptr;
|
||||
firstAncestorOfType( track );
|
||||
if ( track )
|
||||
{
|
||||
useLogarithmicScale = track->isLogarithmicScale();
|
||||
}
|
||||
|
||||
if ( m_parentPlot )
|
||||
{
|
||||
m_parentPlot->replot();
|
||||
std::vector<double> xPlotValues = curveData()->propertyValuesByIntervals();
|
||||
std::vector<double> depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit );
|
||||
CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() );
|
||||
|
||||
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, useLogarithmicScale );
|
||||
|
||||
else
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, useLogarithmicScale );
|
||||
|
||||
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
|
||||
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
|
||||
if ( isUsingPseudoLength )
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
firstAncestorOrThisOfType( wellLogTrack );
|
||||
CVF_ASSERT( wellLogTrack );
|
||||
|
||||
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
||||
if ( viewer )
|
||||
{
|
||||
viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "PL/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
|
||||
setLogScaleFromSelectedResult();
|
||||
|
||||
if ( m_parentPlot )
|
||||
{
|
||||
m_parentPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -692,7 +698,8 @@ void RimWellLogExtractionCurve::clearGeneratedSimWellPaths()
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogCollection = nullptr;
|
||||
|
||||
// Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when deleted.
|
||||
// Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when
|
||||
// deleted.
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj && proj->mainPlotCollection() ) wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection();
|
||||
|
46
GrpcInterface/Python/rips/tests/test_well_log_extraction.py
Normal file
46
GrpcInterface/Python/rips/tests/test_well_log_extraction.py
Normal file
@ -0,0 +1,46 @@
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
|
||||
import rips
|
||||
|
||||
import dataroot
|
||||
|
||||
|
||||
def test_10k_well_log_extraction(rips_instance, initialize_test):
|
||||
case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC"
|
||||
case_path = case_root_path + "/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=case_path)
|
||||
assert len(case.grids()) == 2
|
||||
well_path_files = [
|
||||
case_root_path + "/wellpath_a.dev",
|
||||
]
|
||||
|
||||
view = case.create_view()
|
||||
view.set_time_step(1)
|
||||
|
||||
well_path_names = rips_instance.project.import_well_paths(well_path_files)
|
||||
wells = rips_instance.project.well_paths()
|
||||
well_path = wells[0]
|
||||
|
||||
properties = [
|
||||
("STATIC_NATIVE", "INDEX_K", 0),
|
||||
("STATIC_NATIVE", "PORO", 0),
|
||||
("STATIC_NATIVE", "PERMX", 0),
|
||||
("DYNAMIC_NATIVE", "PRESSURE", 0),
|
||||
]
|
||||
|
||||
well_log_plot_collection = rips_instance.project.descendants(
|
||||
rips.WellLogPlotCollection
|
||||
)[0]
|
||||
|
||||
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)
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
|
||||
well_log_plot.export_data_as_las(export_folder=tmpdirname)
|
Loading…
Reference in New Issue
Block a user