Janitor issues

* Remove obsolete code
* Fix path modification of a relative folder
Replace start token '.' with file path to the project file to make sure that the path './wells/a-1h.dev' can be imported correctly.
* Add more logging when keywords are missing from import
This commit is contained in:
Magne Sjaastad 2023-02-15 07:56:17 +01:00 committed by GitHub
parent af7fe8f00e
commit 70bb221162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 29 additions and 117 deletions

View File

@ -199,6 +199,13 @@ bool RifEclipseInputFileTools::openGridFile( const QString& fileName,
return true;
}
QString txt = "Missing required keywords :";
if ( !specGridKw ) txt += " SPECGRID";
if ( !zCornKw ) txt += " ZCORN";
if ( !coordKw ) txt += " COORD";
RiaLogging::error( txt );
return false;
}

View File

@ -277,17 +277,7 @@ void RimFractureTemplateCollection::loadAndUpdateData()
{
stimPlanFracture->loadDataAndUpdate();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureTemplateCollection::updateFilePathsFromProjectPath( const QString& newProjectPath,
const QString& oldProjectPath )
{
for ( RimFractureTemplate* f : m_fractureDefinitions() )
{
RimEllipseFractureTemplate* ellipseFracture = dynamic_cast<RimEllipseFractureTemplate*>( f );
if ( ellipseFracture )
{

View File

@ -60,8 +60,6 @@ public:
void createAndAssignTemplateCopyForNonMatchingUnit();
void loadAndUpdateData();
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;

View File

@ -150,15 +150,6 @@ void RimFormationNames::readFormationNamesFile( QString* errorMessage )
m_formationNamesData = RifColorLegendData::readFormationNamesFile( m_formationNamesFileName().path(), errorMessage );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
// m_formationNamesFileName =
// RimTools::relocateFile( m_formationNamesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -44,7 +44,6 @@ public:
void updateConnectedViews();
void readFormationNamesFile( QString* errorMessage );
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
static QString layerZoneTableFileName();

View File

@ -112,18 +112,6 @@ std::vector<RimFormationNames*> RimFormationNamesCollection::importFiles( const
return m_formationNamesList.children();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNamesCollection::updateFilePathsFromProjectPath( const QString& newProjectPath,
const QString& oldProjectPath )
{
for ( RimFormationNames* fmNames : m_formationNamesList )
{
fmNames->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -39,8 +39,6 @@ public:
std::vector<RimFormationNames*> importFiles( const QStringList& fileNames );
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;

View File

@ -473,38 +473,18 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project
bool foundFile = false;
std::vector<QString> searchedPaths;
QString filePathCandidate = filePath->path();
if ( filePathCandidate.startsWith( '.' ) )
{
filePathCandidate = filePathCandidate.right( filePathCandidate.size() - 1 );
filePathCandidate = newProjectPath + filePathCandidate;
}
QString newFilePath =
RimTools::relocateFile( filePath->path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
RimTools::relocateFile( filePathCandidate, newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
filePath->setPath( newFilePath );
}
// Update path to well path file cache
for ( RimOilField* oilField : oilFields )
{
if ( oilField == nullptr ) continue;
if ( oilField->wellPathCollection() != nullptr )
{
oilField->wellPathCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
if ( oilField->formationNamesCollection() != nullptr )
{
oilField->formationNamesCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
CVF_ASSERT( oilField->fractureDefinitionCollection() );
oilField->fractureDefinitionCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
{
std::vector<RimWellLogFile*> rimWellLogFiles;
this->descendantsIncludingThisOfType( rimWellLogFiles );
for ( auto rimWellLogFile : rimWellLogFiles )
{
rimWellLogFile->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
}
wellPathImport->updateFilePaths();
}

View File

@ -232,22 +232,6 @@ bool RimWellLogFile::hasFlowData() const
return RimWellPlotTools::hasFlowData( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
// bool foundFile = false;
// std::vector<QString> searchedPaths;
//
// QString fileNameCandidate =
// RimTools::relocateFile( m_fileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
// if ( foundFile )
// {
// m_fileName = fileNameCandidate;
// }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -70,8 +70,6 @@ public:
RimWellLogFile::WellFlowCondition wellFlowRateCondition() const { return m_wellFlowCondition(); }
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
static std::vector<std::pair<double, double>> findMdAndChannelValuesForWellPath( const RimWellPath* wellPath,
const QString& channelName,
QString* unitString = nullptr );

View File

@ -279,19 +279,6 @@ bool RimFileWellPath::isStoredInCache() const
return !id().isEmpty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
QString newCacheFileName = getCacheFileName();
if ( caf::Utils::fileExists( newCacheFileName ) )
{
m_filePathInCache = newCacheFileName;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -349,3 +336,16 @@ void RimFileWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileWellPath::initAfterRead()
{
QString newCacheFileName = getCacheFileName();
if ( caf::Utils::fileExists( newCacheFileName ) )
{
m_filePathInCache = newCacheFileName;
}
}

View File

@ -31,7 +31,6 @@ public:
bool readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter, bool setWellNameForExport );
int wellPathIndexInFile() const; // -1 means none.
void setWellPathIndexInFile( int index );
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
static QString getCacheDirectoryPath();
protected:
@ -43,6 +42,7 @@ private:
bool isStoredInCache() const;
QString getCacheFileName();
void initAfterRead() override;
void setupBeforeSave() override;
void ensureWellPathStartAtSeaLevel( RigWellPath* wellPath );

View File

@ -813,13 +813,6 @@ size_t RimWellPath::simulationWellBranchCount( const QString& simWellName )
return branches.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -87,8 +87,6 @@ public:
bool tryAssociateWithSimulationWell();
bool isAssociatedWithSimulationWell() const;
virtual void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
void setUnitSystem( RiaDefines::EclipseUnitSystem unitSystem );
RiaDefines::EclipseUnitSystem unitSystem() const;

View File

@ -504,17 +504,6 @@ void RimWellPathCollection::scheduleRedrawAffectedViews()
if ( proj ) proj->reloadCompletionTypeResultsInAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
for ( auto wellPath : m_wellPaths )
{
wellPath->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -120,7 +120,6 @@ public:
void scheduleRedrawAffectedViews();
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
bool anyWellsContainingPerforationIntervals() const;
size_t modelledWellPathCount() const;