mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#4893 Import Observed FMU data : Add error message
This commit is contained in:
parent
905c34968f
commit
3f617c93d2
@ -15,10 +15,15 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicImportObservedFmuDataFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicImportFormationNamesFeature.h"
|
||||
|
||||
#include "RifReaderFmuRft.h"
|
||||
|
||||
#include "RimObservedDataCollection.h"
|
||||
@ -53,7 +58,24 @@ void RicImportObservedFmuDataFeature::selectObservedDataPathInDialog()
|
||||
QFileDialog::ShowDirsOnly );
|
||||
|
||||
QStringList subDirsWithFmuData = RifReaderFmuRft::findSubDirectoriesWithFmuRftData( directory );
|
||||
if ( subDirsWithFmuData.empty() ) return;
|
||||
if ( subDirsWithFmuData.empty() )
|
||||
{
|
||||
QString message =
|
||||
QString(
|
||||
"Could not find the file %1 in any sub-folder of %2.\nThis file is required for import of FMU data." )
|
||||
.arg( RifReaderFmuRft::wellPathFileName() )
|
||||
.arg( directory );
|
||||
|
||||
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
|
||||
if ( guiApp )
|
||||
{
|
||||
QMessageBox::warning( nullptr, "Import of Observed FMU Data", message );
|
||||
}
|
||||
|
||||
RiaLogging::warning( message );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RimProject* proj = app->project();
|
||||
RimObservedDataCollection* observedDataCollection = proj->activeOilField()
|
||||
|
@ -112,7 +112,7 @@ bool RifReaderFmuRft::directoryContainsFmuRftData( const QString& filePath )
|
||||
}
|
||||
|
||||
QDir dir( filePath );
|
||||
if ( !dir.exists( "well_date_rft.txt" ) )
|
||||
if ( !dir.exists( RifReaderFmuRft::wellPathFileName() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -138,6 +138,14 @@ bool RifReaderFmuRft::directoryContainsFmuRftData( const QString& filePath )
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RifReaderFmuRft::wellPathFileName()
|
||||
{
|
||||
return "well_date_rft.txt";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -386,10 +394,10 @@ RifReaderFmuRft::WellObservationMap RifReaderFmuRft::loadWellDates( QDir& dir, Q
|
||||
|
||||
WellObservationMap validObservations;
|
||||
|
||||
QFileInfo wellDateFileInfo( dir.absoluteFilePath( "well_date_rft.txt" ) );
|
||||
QFileInfo wellDateFileInfo( dir.absoluteFilePath( RifReaderFmuRft::wellPathFileName() ) );
|
||||
if ( !( wellDateFileInfo.exists() && wellDateFileInfo.isFile() && wellDateFileInfo.isReadable() ) )
|
||||
{
|
||||
*errorMsg = QString( "well_date_rft.txt cannot be found at '%s'" ).arg( m_filePath );
|
||||
*errorMsg = QString( "%1 cannot be found at '%s'" ).arg( RifReaderFmuRft::wellPathFileName() ).arg( m_filePath );
|
||||
return WellObservationMap();
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
|
||||
static QStringList findSubDirectoriesWithFmuRftData( const QString& filePath );
|
||||
static bool directoryContainsFmuRftData( const QString& filePath );
|
||||
static QString wellPathFileName();
|
||||
|
||||
std::vector<QString> labels( const RifEclipseRftAddress& rftAddress );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user