mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make RFT pressure data more robust
Replace tab with space, and fix an out of bounds bug.
This commit is contained in:
@@ -58,12 +58,19 @@ std::pair<std::vector<RigPressureDepthData>, QString> RifPressureDepthTextFileRe
|
|||||||
while ( !in.atEnd() )
|
while ( !in.atEnd() )
|
||||||
{
|
{
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
|
|
||||||
|
// Replace tab with space to be able to split the string using space as separator
|
||||||
|
line.replace( "\t", " " );
|
||||||
|
|
||||||
if ( isHeaderLine( line ) )
|
if ( isHeaderLine( line ) )
|
||||||
{
|
{
|
||||||
bool skipEmptyParts = true;
|
bool skipEmptyParts = true;
|
||||||
QStringList headerValues = RifFileParseTools::splitLineAndTrim( line, separator, skipEmptyParts );
|
|
||||||
RigPressureDepthData data;
|
RigPressureDepthData data;
|
||||||
data.setWellName( headerValues[1].replace( "'", "" ) );
|
QStringList headerValues = RifFileParseTools::splitLineAndTrim( line, separator, skipEmptyParts );
|
||||||
|
if ( headerValues.size() > 1 )
|
||||||
|
{
|
||||||
|
data.setWellName( headerValues[1].replace( "'", "" ) );
|
||||||
|
}
|
||||||
items.push_back( data );
|
items.push_back( data );
|
||||||
}
|
}
|
||||||
else if ( isDateLine( line ) )
|
else if ( isDateLine( line ) )
|
||||||
|
|||||||
@@ -92,3 +92,18 @@ PSIA FEET
|
|||||||
EXPECT_NEAR( 12008.0, values0[0].first, delta );
|
EXPECT_NEAR( 12008.0, values0[0].first, delta );
|
||||||
EXPECT_NEAR( 22640.66, values0[0].second, delta );
|
EXPECT_NEAR( 22640.66, values0[0].second, delta );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
TEST( RifPressureDepthTextFileReaderTest, LoadFileWithTabs )
|
||||||
|
{
|
||||||
|
QString fileName = CASE_REAL_TEST_DATA_DIRECTORY_04 + "example_file_tabs.txt";
|
||||||
|
|
||||||
|
auto [items, errorMessage] = RifPressureDepthTextFileReader::readFile( fileName );
|
||||||
|
|
||||||
|
EXPECT_TRUE( errorMessage.isEmpty() );
|
||||||
|
ASSERT_EQ( 3u, items.size() );
|
||||||
|
|
||||||
|
EXPECT_EQ( "G-14", items[0].wellName().toStdString() );
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
--TVDMSL
|
||||||
|
RFT
|
||||||
|
--
|
||||||
|
WELLNAME 'G-14'
|
||||||
|
DATE 28-DEC-1995
|
||||||
|
PRESSURE DEPTH
|
||||||
|
BARSA METRES
|
||||||
|
418.88 2726.91
|
||||||
|
419.02 2729.36
|
||||||
|
419.11 2733.29
|
||||||
|
419.17 2735.26
|
||||||
|
--
|
||||||
|
WELLNAME 'G-14'
|
||||||
|
DATE 28-DEC-1996
|
||||||
|
PRESSURE DEPTH
|
||||||
|
BARSA METRES
|
||||||
|
418.88 2726.91
|
||||||
|
419.02 2729.36
|
||||||
|
419.11 2733.29
|
||||||
|
419.17 2735.26
|
||||||
|
--
|
||||||
|
WELLNAME 'F-56'
|
||||||
|
DATE 15-jan-12
|
||||||
|
PRESSURE DEPTH
|
||||||
|
BARSA METRES
|
||||||
|
414.40 2911.029
|
||||||
|
415.92 2929.496
|
||||||
|
417.23 2935.801
|
||||||
|
415.76 2934.981
|
||||||
|
414.75 2919.446
|
||||||
|
413.53 2903.147
|
||||||
|
413.32 2896.555
|
||||||
Reference in New Issue
Block a user