#4893 Import Observed FMU data : Add error message

This commit is contained in:
Magne Sjaastad 2019-10-18 14:35:33 +02:00
parent 905c34968f
commit 3f617c93d2
3 changed files with 35 additions and 4 deletions

View File

@ -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()

View File

@ -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();
}

View File

@ -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 );