#4664 Implement smoothing of WBS curves (#4809)

* Initial WIP

* Identical results with spreadsheet

* Improved and more robust smoothing by filtering points first

* Improved smoothing and more GUI

* Include mixed-label for smoothing threshold
This commit is contained in:
Gaute Lindkvist
2019-10-03 14:16:56 +02:00
committed by GitHub
parent 1e2e02c9ac
commit 55f0cac713
15 changed files with 761 additions and 132 deletions

View File

@@ -32,6 +32,7 @@
#include "RimWellLogFileCurve.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogWbsCurve.h"
#include "RimWellPath.h"
#include "RifReaderEclipseRft.h"
@@ -166,16 +167,17 @@ RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow )
template <typename ExtractionCurveType>
ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow )
{
CVF_ASSERT( plotTrack );
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
ExtractionCurveType* curve = new ExtractionCurveType();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor );
@@ -363,3 +365,43 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve( RimWellLogTrack* plotTrack,
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow /*= true */ )
{
return addExtractionCurve<RimWellLogExtractionCurve>( plotTrack,
view,
wellPath,
simWell,
branchIndex,
useBranchDetection,
showPlotWindow );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogWbsCurve* RicWellLogTools::addWellLogWbsCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow /*= true */ )
{
return addExtractionCurve<RimWellLogWbsCurve>( plotTrack,
view,
wellPath,
simWell,
branchIndex,
useBranchDetection,
showPlotWindow );
}

View File

@@ -30,6 +30,7 @@ class RimWellLogFileChannel;
class RimWellLogFileCurve;
class RimWellLogRftCurve;
class RimWellLogTrack;
class RimWellLogWbsCurve;
class RimWellPath;
//--------------------------------------------------------------------------------------------------
@@ -38,21 +39,39 @@ class RimWellPath;
class RicWellLogTools
{
public:
static RimSimWellInView* selectedSimulationWell( int* branchIndex );
static bool wellHasRftData( const QString& wellName );
static bool isWellPathOrSimWellSelectedInView();
static void addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack,
const std::vector<RimWellLogFileChannel*>& wellLogFileChannels );
static RimWellPath* selectedWellPathWithLogFile();
static RimWellPath* findWellPathWithLogFileFromSelection();
static RimWellLogExtractionCurve* addExtractionCurve( RimWellLogTrack* plotTrack,
static RimSimWellInView* selectedSimulationWell( int* branchIndex );
static bool wellHasRftData( const QString& wellName );
static bool isWellPathOrSimWellSelectedInView();
static void addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack,
const std::vector<RimWellLogFileChannel*>& wellLogFileChannels );
static RimWellPath* selectedWellPathWithLogFile();
static RimWellPath* findWellPathWithLogFileFromSelection();
static RimWellLogRftCurve*
addRftCurve( RimWellLogTrack* plotTrack, const RimSimWellInView* simWell, bool showPlotWindow = true );
static RimWellLogFileCurve* addFileCurve( RimWellLogTrack* plotTrack, bool showPlotWindow = true );
static RimWellLogExtractionCurve* addWellLogExtractionCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow = true );
static RimWellLogWbsCurve* addWellLogWbsCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow = true );
static RimWellLogRftCurve*
addRftCurve( RimWellLogTrack* plotTrack, const RimSimWellInView* simWell, bool showPlotWindow = true );
static RimWellLogFileCurve* addFileCurve( RimWellLogTrack* plotTrack, bool showPlotWindow = true );
private:
template <typename ExtractionCurveType>
static ExtractionCurveType* addExtractionCurve( RimWellLogTrack* plotTrack,
Rim3dView* view,
RimWellPath* wellPath,
const RimSimWellInView* simWell,
int branchIndex,
bool useBranchDetection,
bool showPlotWindow );
};

View File

@@ -37,6 +37,7 @@
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellLogWbsCurve.h"
#include "RimWellPath.h"
#include "RicWellLogTools.h"
@@ -221,21 +222,23 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
for ( size_t i = 0; i < resultNames.size(); ++i )
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( stabilityCurvesTrack,
geoMechView,
wellPath,
nullptr,
-1,
false,
false );
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogWbsCurve* curve = RicWellLogTools::addWellLogWbsCurve( stabilityCurvesTrack,
geoMechView,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName );
curve->setColor( colors[i % colors.size()] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
curve->setSmoothCurve( true );
curve->setSmoothingThreshold( 0.002 );
}
stabilityCurvesTrack->calculateXZoomRangeAndUpdateQwt();
}
@@ -262,8 +265,13 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addExtractionCurve( wellPathAnglesTrack, geoMechView, wellPath, nullptr, -1, false, false );
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( wellPathAnglesTrack,
geoMechView,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName );

View File

@@ -74,7 +74,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
RicWellLogTools::addExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, -1, true );
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, -1, true );
}
else
{
@@ -113,12 +113,12 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
}
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addExtractionCurve( newWellLogPlotTrack,
view,
wellPath,
simWell,
branchIndex,
useBranchDetection );
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addWellLogExtractionCurve( newWellLogPlotTrack,
view,
wellPath,
simWell,
branchIndex,
useBranchDetection );
plotCurve->loadDataAndUpdate( true );

View File

@@ -53,7 +53,12 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( plotTrack,
nullptr,
nullptr,
nullptr,
-1,
true );
curve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );

View File

@@ -66,7 +66,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered( bool isChecked )
plotTrack->setDescription( QString( "Track %1" ).arg( wellLogPlot->trackCount() ) );
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>( wellLogPlot->viewWidget() );
RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredSize().width() );
wellLogPlot->updateConnectedEditors();