From 70554b80519bd15ce2035fe1818b894f2fa9f3f6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 24 Jan 2023 11:26:34 +0100 Subject: [PATCH] Trim spaces and avoid spaces in generated address text * Trim spaces and avoid spaces in generated address text * Fix unit test --- .../SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp | 7 ++++++- .../FileInterface/RifEclipseSummaryAddress.cpp | 5 +++-- ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp | 2 +- .../UnitTests/RiaSummaryAddressAnalyzer-Test.cpp | 2 +- GrpcInterface/Python/rips/tests/test_summary_cases.py | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index be0a682ddc..e703e69853 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -232,7 +232,12 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin } else { - allCurveAddressFilters.push_back( arguments[optionIdx] ); + // Remove space from address string https://github.com/OPM/ResInsight/issues/9707 + + QString stringWithoutSpaces = arguments[optionIdx]; + stringWithoutSpaces.remove( " " ); + + allCurveAddressFilters.push_back( stringWithoutSpaces ); } } } diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 697c33bdab..7559435fbc 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -923,8 +923,9 @@ std::string RifEclipseSummaryAddress::baseVectorName( const std::string& vectorN //-------------------------------------------------------------------------------------------------- std::string RifEclipseSummaryAddress::blockAsString() const { - return std::to_string( this->cellI() ) + ", " + std::to_string( this->cellJ() ) + ", " + - std::to_string( this->cellK() ); + // Avoid space in address text https://github.com/OPM/ResInsight/issues/9707 + + return std::to_string( this->cellI() ) + "," + std::to_string( this->cellJ() ) + "," + std::to_string( this->cellK() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp b/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp index 4864ead0a4..10efe5c8cb 100644 --- a/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp +++ b/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp @@ -993,7 +993,7 @@ TEST( RifKeywordBasedRsmspecParserTest, TestAddressCreation ) EXPECT_TRUE( address.isValid() ); EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR ); - EXPECT_EQ( address.uiText(), "LCABC:lgrName:wellName:12, 14, 16" ); + EXPECT_EQ( address.uiText(), "LCABC:lgrName:wellName:12,14,16" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp index 9dc48e58e9..9a65492cbe 100644 --- a/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp @@ -55,7 +55,7 @@ TEST( RiaSummaryAddressAnalyzer, WellCompletions ) auto completionsForB = analyzer.wellCompletions( wellNameB ); EXPECT_EQ( 3u, completionsForB.size() ); - std::string tupleToFind = "5, 4, 30"; + std::string tupleToFind = "5,4,30"; EXPECT_TRUE( completionsForB.find( tupleToFind ) != completionsForB.end() ); } diff --git a/GrpcInterface/Python/rips/tests/test_summary_cases.py b/GrpcInterface/Python/rips/tests/test_summary_cases.py index de988d5abd..49618f1ea2 100644 --- a/GrpcInterface/Python/rips/tests/test_summary_cases.py +++ b/GrpcInterface/Python/rips/tests/test_summary_cases.py @@ -39,7 +39,7 @@ def test_summary_data(rips_instance, initialize_test): addresses = summary_case.available_addresses() # Summary reader type is controlled from Preferences. libecl reports 343 vectors, opm_common (ESMRY) reports 339. # As this configuration can be different, allow both variants - assert len(addresses.values) == 343 or len(addresses.values) == 339 + assert len(addresses.values) == 335 or len(addresses.values) == 339 summary_data = summary_case.summary_vector_values("FOPT") assert len(summary_data.values) == 60