mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
StimPlan Model: Improve logging for facies value/name mismatch.
This commit is contained in:
@@ -714,7 +714,8 @@ std::pair<std::vector<double>, std::vector<QString>> RimStimPlanModelCalculator:
|
||||
|
||||
for ( auto value : values )
|
||||
{
|
||||
faciesNames.push_back( RimStimPlanModelElasticPropertyCalculator::findFaciesName( *colorLegend, value ) );
|
||||
auto [isFound, faciesName] = RimStimPlanModelElasticPropertyCalculator::findFaciesName( *colorLegend, value );
|
||||
faciesNames.push_back( faciesName );
|
||||
}
|
||||
|
||||
return std::make_pair( values, faciesNames );
|
||||
|
@@ -220,9 +220,19 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp
|
||||
for ( size_t i = 0; i < tvDepthValues.size(); i++ )
|
||||
{
|
||||
// Avoid using the field name in the match for now
|
||||
QString fieldName = "";
|
||||
QString faciesName = findFaciesName( *colorLegend, faciesValues[i] );
|
||||
int idx = static_cast<int>( formationValues[i] );
|
||||
QString fieldName = "";
|
||||
auto [foundFaciesName, faciesName] = findFaciesName( *colorLegend, faciesValues[i] );
|
||||
if ( !foundFaciesName )
|
||||
{
|
||||
RiaLogging::error( QString( "Missing facies name for facies value: %1 (%2). Color legend: '%3'" )
|
||||
.arg( static_cast<int>( faciesValues[i] ) )
|
||||
.arg( faciesValues[i] )
|
||||
.arg( colorLegend->colorLegendName() ) );
|
||||
values.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
int idx = static_cast<int>( formationValues[i] );
|
||||
if ( std::isinf( formationValues[i] ) || idx < 0 || idx >= static_cast<int>( formationNamesVector.size() ) )
|
||||
{
|
||||
RiaLogging::error(
|
||||
@@ -295,8 +305,10 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::error(
|
||||
QString( "Missing elastic properties. Field='%1', formation='%2', facies='%3'" ).arg( fieldName ).arg( formationName ).arg( faciesName ) );
|
||||
RiaLogging::error( QString( "Missing elastic properties. Formation='%1', facies='%2'. Facies value: %3" )
|
||||
.arg( formationName )
|
||||
.arg( faciesName )
|
||||
.arg( static_cast<int>( faciesValues[i] ) ) );
|
||||
values.clear();
|
||||
return false;
|
||||
}
|
||||
@@ -308,14 +320,14 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimStimPlanModelElasticPropertyCalculator::findFaciesName( const RimColorLegend& colorLegend, double value )
|
||||
std::pair<bool, QString> RimStimPlanModelElasticPropertyCalculator::findFaciesName( const RimColorLegend& colorLegend, double value )
|
||||
{
|
||||
for ( auto item : colorLegend.colorLegendItems() )
|
||||
{
|
||||
if ( item->categoryValue() == static_cast<int>( value ) ) return item->categoryName();
|
||||
if ( item->categoryValue() == static_cast<int>( value ) ) return { true, item->categoryName() };
|
||||
}
|
||||
|
||||
return "not found";
|
||||
return { false, "not found" };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
bool isMatching( RiaDefines::CurveProperty curveProperty ) const override;
|
||||
|
||||
static QString findFaciesName( const RimColorLegend& colorLegend, double value );
|
||||
static std::pair<bool, QString> findFaciesName( const RimColorLegend& colorLegend, double value );
|
||||
|
||||
protected:
|
||||
static void addOverburden( std::vector<QString>& formationNames,
|
||||
|
Reference in New Issue
Block a user