Merge pull request #4728 from OPM/feature-ensemble-rft-md-labels

Feature ensemble rft md labels
This commit is contained in:
Gaute Lindkvist 2019-09-18 15:43:04 +02:00 committed by GitHub
commit de4a032fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 107 additions and 67 deletions

View File

@ -67,8 +67,6 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
{
QString wellName = selectedWellName();
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setSimWellOrWellPathName( wellName );
@ -77,9 +75,13 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) );
rftPlotColl->addPlot( rftPlot );
rftPlot->applyInitialSelections();
wellName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
rftPlot->setDescription( plotName );
rftPlot->applyInitialSelections();
rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();

View File

@ -222,6 +222,12 @@ QString RimWellRftPlot::associatedSimWellName() const
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::applyInitialSelections()
{
std::map<QString, QStringList> wellSources = findWellSources();
if ( m_wellPathNameOrSimWellName == "None" && !wellSources.empty() )
{
m_wellPathNameOrSimWellName = wellSources.begin()->first;
}
std::vector<RifDataSourceForRftPlt> sourcesToSelect;
const QString simWellName = associatedSimWellName();
@ -639,7 +645,20 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions( const caf::
if ( fieldNeedingOptions == &m_wellPathNameOrSimWellName )
{
calculateValueOptionsForWells( options );
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
std::map<QString, QStringList> wellSources = findWellSources();
for ( const auto& wellName : wellSources )
{
const QStringList& tags = wellName.second;
QString uiText = wellName.first;
if ( !tags.empty() )
{
uiText += QString( " (%1)" ).arg( wellName.second.join( ", " ) );
}
options.push_back( caf::PdmOptionItemInfo( uiText, wellName.first ) );
}
}
else if ( fieldNeedingOptions == &m_selectedSources )
{
@ -849,17 +868,16 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options )
std::map<QString, QStringList> RimWellRftPlot::findWellSources()
{
RimProject* proj = RiaApplication::instance()->project();
std::map<QString /*value*/, QStringList /*uitext*/> wellNames;
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
RimProject* proj = RiaApplication::instance()->project();
if ( proj != nullptr )
{
const std::vector<QString> simWellNames = proj->simulationWellNames();
std::set<QString> simWellsAssociatedWithWellPath;
std::map<QString /*value*/, QStringList /*uitext*/> wellNames;
const std::vector<QString> simWellNames = proj->simulationWellNames();
std::set<QString> simWellsAssociatedWithWellPath;
// Observed wells
for ( RimWellPath* const wellPath : proj->allWellPaths() )
@ -905,19 +923,8 @@ void RimWellRftPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo
}
}
}
for ( const auto& wellName : wellNames )
{
const QStringList& tags = wellName.second;
QString uiText = wellName.first;
if ( !tags.empty() )
{
uiText += QString( " (%1)" ).arg( wellName.second.join( ", " ) );
}
options.push_back( caf::PdmOptionItemInfo( uiText, wellName.first ) );
}
}
return wellNames;
}
//--------------------------------------------------------------------------------------------------

View File

@ -98,10 +98,10 @@ protected:
void initAfterRead() override;
private:
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
void updateEditorsFromCurves();
void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves();
std::map<QString, QStringList> findWellSources();
void updateEditorsFromCurves();
void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves();
RimObservedFmuRftData* findObservedFmuData( const QString& wellPathName, const QDateTime& timeStep ) const;

View File

@ -120,8 +120,7 @@ RimWellLogRftCurve::RimWellLogRftCurve()
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", "" );
m_isUsingPseudoLength = false;
m_derivingMDFromObservedData = false;
m_derivedMDSource = NO_SOURCE;
}
//--------------------------------------------------------------------------------------------------
@ -367,7 +366,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
m_isUsingPseudoLength = false;
m_derivedMDSource = PSEUDO_LENGTH;
if ( isCurveVisible() )
{
@ -412,17 +411,20 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( tvDepthVector.size() != measuredDepthVector.size() )
{
measuredDepthVector = interpolatedMeasuredDepthValuesFromWellPathOrObservedData( tvDepthVector );
if ( measuredDepthVector.size() == tvDepthVector.size() )
if ( deriveMeasuredDepthValuesFromWellPath( tvDepthVector, measuredDepthVector ) )
{
m_derivingMDFromObservedData = true;
m_derivedMDSource = WELL_PATH;
}
else if ( deriveMeasuredDepthFromObservedData( tvDepthVector, measuredDepthVector ) )
{
m_derivedMDSource = OBSERVED_DATA;
}
}
if ( tvDepthVector.size() != measuredDepthVector.size() )
{
m_isUsingPseudoLength = true;
measuredDepthVector = tvDepthVector;
m_derivedMDSource = NO_SOURCE;
measuredDepthVector = tvDepthVector;
}
m_curveData->setValuesWithTVD( values,
@ -442,18 +444,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->measuredDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
}
else
{
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->trueDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
m_isUsingPseudoLength = false;
m_derivingMDFromObservedData = false;
}
if ( m_isUsingPseudoLength || m_derivingMDFromObservedData )
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
CVF_ASSERT( wellLogTrack );
@ -461,12 +452,30 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
RiuWellLogTrack* viewer = wellLogTrack->viewer();
if ( viewer )
{
if ( m_derivingMDFromObservedData )
viewer->setDepthTitle( "OBS/" + wellLogPlot->depthPlotTitle() );
else
if ( m_derivedMDSource == NO_SOURCE )
{
viewer->setDepthTitle( "TVDMSL" );
}
else if ( m_derivedMDSource == PSEUDO_LENGTH )
{
viewer->setDepthTitle( "PL/" + wellLogPlot->depthPlotTitle() );
}
else if ( m_derivedMDSource == WELL_PATH )
{
viewer->setDepthTitle( "WELL/" + wellLogPlot->depthPlotTitle() );
}
else
{
viewer->setDepthTitle( "OBS/" + wellLogPlot->depthPlotTitle() );
}
}
}
else
{
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->trueDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
}
m_qwtPlotCurve->setLineSegmentStartStopIndices( m_curveData->polylineStartStopIndices() );
@ -694,11 +703,11 @@ RigEclipseWellLogExtractor* RimWellLogRftCurve::extractor()
auto wellPathBranch = wellPaths[m_branchIndex];
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor( simWellName,
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor( simWellName,
QString( "Find or create sim well extractor" ),
wellPathBranch,
m_eclipseResultCase->eclipseCaseData() );
m_isUsingPseudoLength = true;
m_derivedMDSource = NO_SOURCE;
}
return eclExtractor;
@ -914,24 +923,34 @@ std::vector<double> RimWellLogRftCurve::measuredDepthValues()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellLogRftCurve::interpolatedMeasuredDepthValuesFromWellPathOrObservedData(
const std::vector<double>& tvDepthValues )
bool RimWellLogRftCurve::deriveMeasuredDepthValuesFromWellPath( const std::vector<double>& tvDepthValues,
std::vector<double>& derivedMDValues )
{
RimProject* proj = RiaApplication::instance()->project();
RimWellPath* wellPath = proj->wellPathByName( m_wellName );
std::vector<double> interpolatedMdValues;
std::vector<double> derivedMdValues;
if ( wellPath )
{
const std::vector<double>& mdValuesOfWellPath = wellPath->wellPathGeometry()->measureDepths();
std::vector<double> tvdValuesOfWellPath = wellPath->wellPathGeometry()->trueVerticalDepths();
interpolatedMdValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfWellPath,
tvdValuesOfWellPath,
tvDepthValues );
CVF_ASSERT( interpolatedMdValues.size() == tvDepthValues.size() );
derivedMdValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfWellPath,
tvdValuesOfWellPath,
tvDepthValues );
CVF_ASSERT( derivedMdValues.size() == tvDepthValues.size() );
return true;
}
else if ( m_observedFmuRftData )
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogRftCurve::deriveMeasuredDepthFromObservedData( const std::vector<double>& tvDepthValues,
std::vector<double>& derivedMDValues )
{
if ( m_observedFmuRftData )
{
RifReaderRftInterface* reader = m_observedFmuRftData->rftReader();
if ( reader )
@ -944,11 +963,12 @@ std::vector<double> RimWellLogRftCurve::interpolatedMeasuredDepthValuesFromWellP
reader->values( tvdAddress, &tvdValuesOfObservedData );
reader->values( mdAddress, &mdValuesOfObservedData );
interpolatedMdValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfObservedData,
tvdValuesOfObservedData,
tvDepthValues );
CVF_ASSERT( interpolatedMdValues.size() == tvDepthValues.size() );
derivedMDValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfObservedData,
tvdValuesOfObservedData,
tvDepthValues );
CVF_ASSERT( derivedMDValues.size() == tvDepthValues.size() );
return true;
}
}
return interpolatedMdValues;
return false;
}

View File

@ -46,6 +46,15 @@ class RimWellLogRftCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
enum DerivedMDSource
{
NO_SOURCE,
PSEUDO_LENGTH,
WELL_PATH,
OBSERVED_DATA
};
public:
RimWellLogRftCurve();
~RimWellLogRftCurve() override;
@ -98,8 +107,11 @@ private:
std::vector<double> xValues();
std::vector<double> tvDepthValues();
std::vector<double> measuredDepthValues();
std::vector<double>
interpolatedMeasuredDepthValuesFromWellPathOrObservedData( const std::vector<double>& tvDepthValues );
bool deriveMeasuredDepthValuesFromWellPath( const std::vector<double>& tvDepthValues,
std::vector<double>& derivedMDValues );
bool deriveMeasuredDepthFromObservedData( const std::vector<double>& tvDepthValues,
std::vector<double>& derivedMDValues );
private:
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
@ -112,7 +124,6 @@ private:
caf::PdmField<bool> m_branchDetection;
std::map<size_t, size_t> m_idxInWellPathToIdxInRftFile;
bool m_isUsingPseudoLength;
bool m_derivingMDFromObservedData;
DerivedMDSource m_derivedMDSource;
caf::PdmField<caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>> m_wellLogChannelName;
};