Fix some minor issues (#8043)

* #8016 Surface Ensemble : Update 2d intersection views
* Ensemble WLP : Make code more robust to missing data
* Janitor: Do not add files to recently used list when importing ensemble
* #8016 Ensemble WLP : Delete all temporary plots in one go
* #8016 WLP: Create a default date string that can be exported to LAS
* #8016 Janitor: Use *.dev as default well path extension
This commit is contained in:
Magne Sjaastad 2021-09-24 12:21:16 +02:00 committed by GitHub
parent 33221e7e07
commit 15b4077876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 110 additions and 79 deletions

View File

@ -146,7 +146,8 @@ void RicCreateEnsembleWellLogFeature::executeCommand( const RicCreateEnsembleWel
if ( !wellPath ) return;
QStringList allLasFileNames;
std::vector<RimWellLogPlot*> tmpPlotsToDelete;
QStringList allLasFileNames;
for ( const auto& fileName : fileNames )
{
auto task = progress.task( QString( "Extracting well log for %1" ).arg( fileName ) );
@ -217,12 +218,21 @@ void RicCreateEnsembleWellLogFeature::executeCommand( const RicCreateEnsembleWel
allLasFileNames << lasFile;
}
// Remove the temporary plots after export
plotCollection->removePlot( wellLogPlot );
tmpPlotsToDelete.push_back( wellLogPlot );
RicCloseCaseFeature::deleteEclipseCase( eclipseCase );
}
for ( auto wlp : tmpPlotsToDelete )
{
// Hide window to avoid flickering
wlp->setShowWindow( false );
wlp->updateMdiWindowVisibility();
plotCollection->removePlot( wlp );
delete wlp;
}
if ( ui.autoCreateEnsembleWellLogs() )
{
std::vector<RimEnsembleWellLogs*> ensembleWellLogs =

View File

@ -32,6 +32,7 @@
#include "cafAppEnum.h"
#include "cafPdmObject.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
@ -68,7 +69,7 @@ RicCreateEnsembleWellLogUi::RicCreateEnsembleWellLogUi()
CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPathSource, "WellPathSource", "Well Path Source", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_well, "Well", "Well", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellFilePath, "WellFilePath", "Well File Path", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_selectedKeywords, "SelectedProperties", "Selected Properties", "", "", "" );
m_selectedKeywords.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
@ -101,9 +102,9 @@ void RicCreateEnsembleWellLogUi::defineUiOrdering( QString uiConfigName, caf::Pd
uiOrdering.add( &m_wellPathSource );
bool fileSource = ( m_wellPathSource == RicCreateEnsembleWellLogUi::WellPathSource::FILE );
uiOrdering.add( &m_well );
uiOrdering.add( &m_wellFilePath );
uiOrdering.add( &m_wellPath );
m_well.uiCapability()->setUiHidden( !fileSource );
m_wellFilePath.uiCapability()->setUiHidden( !fileSource );
m_wellPath.uiCapability()->setUiHidden( fileSource );
uiOrdering.add( &m_autoCreateEnsembleWellLogs );
}
@ -164,6 +165,23 @@ QList<caf::PdmOptionItemInfo>
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateEnsembleWellLogUi::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_wellFilePath )
{
auto* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
if ( myAttr )
{
myAttr->m_fileSelectionFilter = "Well Path Files(*.dev);;All Files (*.*)";
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -225,7 +243,7 @@ int RicCreateEnsembleWellLogUi::timeStep() const
//--------------------------------------------------------------------------------------------------
QString RicCreateEnsembleWellLogUi::wellPathFilePath() const
{
return m_well().path();
return m_wellFilePath().path();
}
//--------------------------------------------------------------------------------------------------

View File

@ -68,11 +68,14 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
std::vector<RiaDefines::ResultCatType> validResultCategories() const;
private:
caf::PdmField<caf::FilePath> m_well;
caf::PdmField<caf::FilePath> m_wellFilePath;
caf::PdmField<caf::AppEnum<WellPathSource>> m_wellPathSource;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<bool> m_autoCreateEnsembleWellLogs;

View File

@ -240,7 +240,6 @@ bool RicImportGeneralDataFeature::openEclipseCaseFromFileNames( const QStringLis
{
for ( const auto& newCaseFileAndId : newCaseFiles )
{
RiaApplication::instance()->addToRecentFiles( newCaseFileAndId.first );
createdCaseIds.push_back( newCaseFileAndId.second );
}
return true;

View File

@ -21,6 +21,9 @@
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "Rim2dIntersectionView.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimCase.h"
#include "RimEnsembleSurface.h"
#include "RimFileSurface.h"
#include "RimGridCaseSurface.h"
@ -333,6 +336,15 @@ void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToR
for ( auto view : viewsNeedingUpdate )
{
view->scheduleCreateDisplayModelAndRedraw();
if ( view->ownerCase() )
{
auto views = view->ownerCase()->intersectionViewCollection()->views();
for ( Rim2dIntersectionView* view : views )
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}

View File

@ -530,32 +530,5 @@ void Rim3dWellLogExtractionCurve::initAfterRead()
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::wellDate() const
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList timeStepNames;
if ( eclipseCase )
{
if ( m_eclipseResultDefinition->resultType() == RiaDefines::ResultCatType::STATIC_NATIVE )
{
return QString();
}
if ( eclipseCase->eclipseCaseData() )
{
timeStepNames = eclipseCase->timeStepStrings();
}
}
else if ( geomCase )
{
if ( geomCase->geoMechData() )
{
timeStepNames = geomCase->timeStepStrings();
}
}
if ( m_timeStep == -1 )
{
return QString( "Animation Time Step" );
}
return ( m_timeStep >= 0 && m_timeStep < timeStepNames.size() ) ? timeStepNames[m_timeStep] : "";
return RimWellLogExtractionCurve::wellDateFromGridCaseModel( m_case, m_timeStep );
}

View File

@ -183,28 +183,29 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
std::vector<double> kIndexValues = fileData->values( RiaResultNames::indexKResultName() );
std::vector<double> values = fileData->values( wellLogChannelName );
CAF_ASSERT( values.size() == kIndexValues.size() );
std::set<int> seenTopIndexes;
std::set<int> seenBottomIndexes;
for ( size_t i = 0; i < values.size(); i++ )
if ( values.size() == kIndexValues.size() )
{
int kLayer = static_cast<int>( kIndexValues[i] );
if ( seenTopIndexes.count( kLayer ) == 0 )
std::set<int> seenTopIndexes;
std::set<int> seenBottomIndexes;
for ( size_t i = 0; i < values.size(); i++ )
{
seenTopIndexes.insert( kLayer );
topValues[kLayer].push_back( values[i] );
int kLayer = static_cast<int>( kIndexValues[i] );
if ( seenTopIndexes.count( kLayer ) == 0 )
{
seenTopIndexes.insert( kLayer );
topValues[kLayer].push_back( values[i] );
}
}
}
for ( int i = static_cast<int>( values.size() ) - 1; i >= 0; i-- )
{
int kLayer = static_cast<int>( kIndexValues[i] );
if ( seenBottomIndexes.count( kLayer ) == 0 )
for ( int i = static_cast<int>( values.size() ) - 1; i >= 0; i-- )
{
seenBottomIndexes.insert( kLayer );
bottomValues[kLayer].push_back( values[i] );
int kLayer = static_cast<int>( kIndexValues[i] );
if ( seenBottomIndexes.count( kLayer ) == 0 )
{
seenBottomIndexes.insert( kLayer );
bottomValues[kLayer].push_back( values[i] );
}
}
}
}

View File

@ -614,6 +614,36 @@ RiaDefines::PhaseType RimWellLogExtractionCurve::phaseType() const
return phase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogExtractionCurve::wellDateFromGridCaseModel( RimCase* gridCaseModel, int timeStep )
{
auto* geomCase = dynamic_cast<RimGeoMechCase*>( gridCaseModel );
auto* eclipseCase = dynamic_cast<RimEclipseCase*>( gridCaseModel );
QStringList timeStepNames;
if ( eclipseCase )
{
if ( eclipseCase->eclipseCaseData() )
{
timeStepNames = eclipseCase->timeStepStrings();
}
}
else if ( geomCase )
{
if ( geomCase->geoMechData() )
{
timeStepNames = geomCase->timeStepStrings();
}
}
if ( timeStep >= 0 && timeStep < timeStepNames.size() ) return timeStepNames[timeStep];
return "01_Jan_2000";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -975,27 +1005,7 @@ QString RimWellLogExtractionCurve::wellName() const
//--------------------------------------------------------------------------------------------------
QString RimWellLogExtractionCurve::wellDate() const
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList timeStepNames;
if ( eclipseCase )
{
if ( eclipseCase->eclipseCaseData() )
{
timeStepNames = eclipseCase->timeStepStrings();
}
}
else if ( geomCase )
{
if ( geomCase->geoMechData() )
{
timeStepNames = geomCase->timeStepStrings();
}
}
return ( m_timeStep >= 0 && m_timeStep < timeStepNames.size() ) ? timeStepNames[m_timeStep] : "";
return RimWellLogExtractionCurve::wellDateFromGridCaseModel( m_case(), m_timeStep );
}
//--------------------------------------------------------------------------------------------------

View File

@ -94,6 +94,8 @@ public:
void setAutoNameComponents( bool addCaseName, bool addProperty, bool addWellname, bool addTimeStep, bool addDate );
RiaDefines::PhaseType phaseType() const override;
static QString wellDateFromGridCaseModel( RimCase* gridCaseModel, int timeStep );
protected:
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;

View File

@ -100,11 +100,14 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
// Adjust depths by reassigning depths for top and bottom of layer for each K layer
std::vector<double> kIndexValues = wellLogFile->values( RiaResultNames::indexKResultName() );
auto [valuesAdjusted, measuredDepthValuesAdjusted] =
adjustByIndexDepthOffsets( measuredDepthValues, values, kIndexValues );
if ( values.size() == kIndexValues.size() )
{
auto [valuesAdjusted, measuredDepthValuesAdjusted] =
adjustByIndexDepthOffsets( measuredDepthValues, values, kIndexValues );
values = valuesAdjusted;
measuredDepthValues = measuredDepthValuesAdjusted;
values = valuesAdjusted;
measuredDepthValues = measuredDepthValuesAdjusted;
}
}
if ( tvdMslValues.size() != values.size() )