mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Janitor : Trim unit text for summary vectors
This commit is contained in:
parent
9023b01cfa
commit
db8209d23a
@ -19,6 +19,7 @@
|
||||
#include "RifOpmCommonSummary.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "opm/io/eclipse/ESmry.hpp"
|
||||
#include "opm/io/eclipse/ExtESmry.hpp"
|
||||
@ -156,22 +157,22 @@ bool RifOpmCommonEclipseSummary::values( const RifEclipseSummaryAddress& resultA
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifOpmCommonEclipseSummary::unitName( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
auto it = m_summaryAddressToKeywordMap.find( resultAddress );
|
||||
std::string nameString;
|
||||
auto it = m_summaryAddressToKeywordMap.find( resultAddress );
|
||||
if ( it != m_summaryAddressToKeywordMap.end() )
|
||||
{
|
||||
auto keyword = it->second;
|
||||
if ( m_enhancedReader )
|
||||
{
|
||||
return m_enhancedReader->get_unit( keyword );
|
||||
nameString = m_enhancedReader->get_unit( keyword );
|
||||
}
|
||||
|
||||
if ( m_standardReader )
|
||||
else if ( m_standardReader )
|
||||
{
|
||||
return m_standardReader->get_unit( keyword );
|
||||
nameString = m_standardReader->get_unit( keyword );
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
return RiaStdStringTools::trimString( nameString );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RifOpmHdf5Summary.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "RifHdf5SummaryReader.h"
|
||||
#include "RifOpmCommonSummary.h"
|
||||
@ -127,7 +128,8 @@ std::string RifOpmHdf5Summary::unitName( const RifEclipseSummaryAddress& resultA
|
||||
|
||||
if ( m_eSmry->hasKey( node.keyword ) )
|
||||
{
|
||||
return m_eSmry->get_unit( node );
|
||||
auto stringFromFileReader = m_eSmry->get_unit( node );
|
||||
return RiaStdStringTools::trimString( stringFromFileReader );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,8 +302,20 @@ RifSummaryReaderInterface* RifReaderEclipseSummary::currentSummaryReader() const
|
||||
std::string RifReaderEclipseSummary::unitName( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
auto reader = currentSummaryReader();
|
||||
if ( reader )
|
||||
{
|
||||
auto nativeName = resultAddress.quantityName();
|
||||
auto stringToRemove = RifReaderEclipseSummary::differenceIdentifier();
|
||||
if ( RiaStdStringTools::endsWith( nativeName, stringToRemove ) )
|
||||
{
|
||||
nativeName = nativeName.substr( 0, nativeName.size() - stringToRemove.size() );
|
||||
}
|
||||
|
||||
if ( reader ) return reader->unitName( resultAddress );
|
||||
RifEclipseSummaryAddress adr( resultAddress );
|
||||
adr.setQuantityName( nativeName );
|
||||
|
||||
return reader->unitName( adr );
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user