mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8833 Import Of Observed FMU Data: Improve parsing of text files
This commit is contained in:
parent
853b4a26d5
commit
571011c2bd
@ -418,32 +418,32 @@ RifReaderFmuRft::WellObservationMap RifReaderFmuRft::loadWellDates( QDir& dir, Q
|
|||||||
return WellObservationMap();
|
return WellObservationMap();
|
||||||
}
|
}
|
||||||
QTextStream fileStream( &wellDateFile );
|
QTextStream fileStream( &wellDateFile );
|
||||||
while ( true )
|
while ( !fileStream.atEnd() )
|
||||||
{
|
{
|
||||||
QString line = fileStream.readLine();
|
QString line = fileStream.readLine();
|
||||||
if ( line.isNull() )
|
|
||||||
|
line = line.simplified();
|
||||||
|
if ( line.isNull() || line.isEmpty() )
|
||||||
{
|
{
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
QTextStream lineStream( &line );
|
||||||
|
|
||||||
|
QString wellName;
|
||||||
|
int day, month, year, measurementIndex;
|
||||||
|
|
||||||
|
lineStream >> wellName >> day >> month >> year >> measurementIndex;
|
||||||
|
if ( lineStream.status() != QTextStream::Ok )
|
||||||
{
|
{
|
||||||
QTextStream lineStream( &line );
|
*errorMsg = QString( "Failed to parse '%1'" ).arg( wellDateFileInfo.absoluteFilePath() );
|
||||||
|
return WellObservationMap();
|
||||||
QString wellName;
|
|
||||||
int day, month, year, measurementIndex;
|
|
||||||
|
|
||||||
lineStream >> wellName >> day >> month >> year >> measurementIndex;
|
|
||||||
if ( lineStream.status() != QTextStream::Ok )
|
|
||||||
{
|
|
||||||
*errorMsg = QString( "Failed to parse '%1'" ).arg( wellDateFileInfo.absoluteFilePath() );
|
|
||||||
return WellObservationMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
QDateTime dateTime = RiaQDateTimeTools::createDateTime( QDate( year, month, day ) );
|
|
||||||
dateTime.setTimeSpec( Qt::UTC );
|
|
||||||
WellObservationSet observationSet( dateTime, measurementIndex );
|
|
||||||
validObservations.insert( std::make_pair( wellName, observationSet ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDateTime dateTime = RiaQDateTimeTools::createDateTime( QDate( year, month, day ) );
|
||||||
|
dateTime.setTimeSpec( Qt::UTC );
|
||||||
|
WellObservationSet observationSet( dateTime, measurementIndex );
|
||||||
|
validObservations.insert( std::make_pair( wellName, observationSet ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user