mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-13 00:42:12 -05:00
#8069 Summary ESMRY : Improve robustness and error reporting
This commit is contained in:
1 parent
6440bd5b8d
commit
e5e1f59aef
2 files changed
+32
-6
No files matched your search
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
#include "RiaPreferencesSummary.h"
|
#include "RiaPreferencesSummary.h"
|
||||||
|
#include "RiaStdStringTools.h"
|
||||||
|
|
||||||
#include "RifHdf5Exporter.h"
|
#include "RifHdf5Exporter.h"
|
||||||
#include "RifSummaryReaderInterface.h"
|
#include "RifSummaryReaderInterface.h"
|
||||||
@@ -225,6 +226,8 @@ bool RifHdf5SummaryExporter::writeSummaryVectors( RifHdf5Exporter& exporter, Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::set<std::string> exportErrorKeywords;
|
||||||
|
|
||||||
for ( const auto& nodesForKeyword : mapKeywordToSummaryNodeIndex )
|
for ( const auto& nodesForKeyword : mapKeywordToSummaryNodeIndex )
|
||||||
{
|
{
|
||||||
std::string keyword = nodesForKeyword.first;
|
std::string keyword = nodesForKeyword.first;
|
||||||
@@ -237,17 +240,36 @@ bool RifHdf5SummaryExporter::writeSummaryVectors( RifHdf5Exporter& exporter, Opm
|
|||||||
auto smspecKeywordIndex = summaryNode.smspecKeywordIndex;
|
auto smspecKeywordIndex = summaryNode.smspecKeywordIndex;
|
||||||
const QString& smspecKeywordText = QString( "%1" ).arg( smspecKeywordIndex );
|
const QString& smspecKeywordText = QString( "%1" ).arg( smspecKeywordIndex );
|
||||||
|
|
||||||
auto dataValuesGroup = exporter.createGroup( &keywordGroup, smspecKeywordText.toStdString() );
|
try
|
||||||
const std::vector<float>& values = sourceSummaryData.get( summaryNode );
|
{
|
||||||
|
const std::vector<float>& values = sourceSummaryData.get( summaryNode );
|
||||||
|
auto dataValuesGroup = exporter.createGroup( &keywordGroup, smspecKeywordText.toStdString() );
|
||||||
|
|
||||||
exporter.writeDataset( dataValuesGroup, datasetName, values );
|
exporter.writeDataset( dataValuesGroup, datasetName, values );
|
||||||
|
dataValuesGroup.close();
|
||||||
dataValuesGroup.close();
|
}
|
||||||
|
catch ( ... )
|
||||||
|
{
|
||||||
|
exportErrorKeywords.insert( keyword );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keywordGroup.close();
|
keywordGroup.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !exportErrorKeywords.empty() )
|
||||||
|
{
|
||||||
|
std::vector<std::string> keywordVector;
|
||||||
|
for ( const auto& k : exportErrorKeywords )
|
||||||
|
{
|
||||||
|
keywordVector.push_back( k );
|
||||||
|
}
|
||||||
|
auto txt = RiaStdStringTools::joinStrings( keywordVector, ',' );
|
||||||
|
|
||||||
|
QString errorTxt = QString( "Failed to export keywords %1 " ).arg( QString::fromStdString( txt ) );
|
||||||
|
RiaLogging::error( errorTxt );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,11 @@ std::string RifOpmHdf5Summary::unitName( const RifEclipseSummaryAddress& resultA
|
|||||||
{
|
{
|
||||||
auto index = it->second;
|
auto index = it->second;
|
||||||
auto node = m_eSmry->summaryNodeList()[index];
|
auto node = m_eSmry->summaryNodeList()[index];
|
||||||
return m_eSmry->get_unit( node );
|
|
||||||
|
if ( m_eSmry->hasKey( node.keyword ) )
|
||||||
|
{
|
||||||
|
return m_eSmry->get_unit( node );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user