mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary Import : Support cases with one file per time step (#8493)
This commit is contained in:
parent
2d2bf0bbc7
commit
ffc77516e8
@ -77,54 +77,6 @@ QString RiaEclipseFileNameTools::findRelatedDataFile()
|
|||||||
return relatedFilePath( EclipseFileType::ECLIPSE_DATA );
|
return relatedFilePath( EclipseFileType::ECLIPSE_DATA );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RiaEclipseFileNameTools::isProjectFile( const QString& fileName )
|
|
||||||
{
|
|
||||||
return hasMatchingSuffix( fileName, EclipseFileType::RESINSIGHT_PROJECT );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RiaEclipseFileNameTools::isGridFile( const QString& fileName )
|
|
||||||
{
|
|
||||||
if ( hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_EGRID ) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_GRID );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RiaEclipseFileNameTools::isSummarySpecFile( const QString& fileName )
|
|
||||||
{
|
|
||||||
return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_SMSPEC );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RiaEclipseFileNameTools::isSummaryDataFilePresent( const QString& smspecFileName )
|
|
||||||
{
|
|
||||||
QFileInfo fi( smspecFileName );
|
|
||||||
{
|
|
||||||
QString candidateFileName = fi.absolutePath() + '/' + fi.baseName() + ".UNSMRY";
|
|
||||||
if ( QFile::exists( candidateFileName ) ) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
QString candidateFileName = fi.absolutePath() + '/' + fi.baseName() + ".FUNSMRY";
|
|
||||||
if ( QFile::exists( candidateFileName ) ) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -49,11 +49,6 @@ public:
|
|||||||
QString findRelatedSummarySpecFile();
|
QString findRelatedSummarySpecFile();
|
||||||
QString findRelatedDataFile();
|
QString findRelatedDataFile();
|
||||||
|
|
||||||
static bool isProjectFile( const QString& fileName );
|
|
||||||
static bool isGridFile( const QString& fileName );
|
|
||||||
static bool isSummarySpecFile( const QString& fileName );
|
|
||||||
static bool isSummaryDataFilePresent( const QString& smspecFileName );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString relatedFilePath( EclipseFileType fileType ) const;
|
QString relatedFilePath( EclipseFileType fileType ) const;
|
||||||
|
|
||||||
|
@ -635,14 +635,12 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
|
|||||||
{
|
{
|
||||||
const QString& smspecFileName = fileInfo.summaryFileName();
|
const QString& smspecFileName = fileInfo.summaryFileName();
|
||||||
|
|
||||||
bool isEsmryFile = smspecFileName.endsWith( "ESMRY" );
|
if ( !smspecFileName.isEmpty() )
|
||||||
bool foundDataFile = RiaEclipseFileNameTools::isSummaryDataFilePresent( smspecFileName );
|
|
||||||
if ( foundDataFile || isEsmryFile )
|
|
||||||
{
|
{
|
||||||
RimFileSummaryCase* newSumCase = new RimFileSummaryCase();
|
auto newSumCase = new RimFileSummaryCase();
|
||||||
|
|
||||||
newSumCase->setIncludeRestartFiles( fileInfo.includeRestartFiles() );
|
newSumCase->setIncludeRestartFiles( fileInfo.includeRestartFiles() );
|
||||||
newSumCase->setSummaryHeaderFileName( fileInfo.summaryFileName() );
|
newSumCase->setSummaryHeaderFileName( smspecFileName );
|
||||||
newSumCase->updateOptionSensitivity();
|
newSumCase->updateOptionSensitivity();
|
||||||
project->assignCaseIdToSummaryCase( newSumCase );
|
project->assignCaseIdToSummaryCase( newSumCase );
|
||||||
newSumCase->refreshMetaData();
|
newSumCase->refreshMetaData();
|
||||||
|
@ -93,23 +93,6 @@ def tempdir():
|
|||||||
yield dirpath
|
yield dirpath
|
||||||
|
|
||||||
|
|
||||||
# This test ensures that missing unsmry file is handeled gracefully
|
|
||||||
def test_summary_no_unsmry(rips_instance, initialize_test):
|
|
||||||
casePathRelative = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC"
|
|
||||||
|
|
||||||
# create an absolute path, as the helper functions used to create a temporary folder does not work
|
|
||||||
# with the relative (..\..\) part of the file path
|
|
||||||
casePath = os.path.abspath(casePathRelative)
|
|
||||||
|
|
||||||
with tempdir() as dirpath:
|
|
||||||
base_path = os.path.basename(casePath)
|
|
||||||
temp_path = os.path.join(dirpath, base_path)
|
|
||||||
shutil.copy2(casePath, temp_path)
|
|
||||||
|
|
||||||
summary_case = rips_instance.project.import_summary_case(temp_path)
|
|
||||||
assert summary_case is None
|
|
||||||
|
|
||||||
|
|
||||||
def test_summary_set_values(rips_instance, initialize_test):
|
def test_summary_set_values(rips_instance, initialize_test):
|
||||||
casePath = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC"
|
casePath = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC"
|
||||||
summary_case = rips_instance.project.import_summary_case(casePath)
|
summary_case = rips_instance.project.import_summary_case(casePath)
|
||||||
|
Loading…
Reference in New Issue
Block a user