Fix the issue re detection of typeOfSecondFixedSurface key

This commit is contained in:
Shahram Najm 2016-05-04 14:57:43 +01:00
parent 1e91720bdd
commit e370b14c12
1 changed files with 10 additions and 7 deletions

View File

@ -184,14 +184,17 @@ sub process {
# Users will set parameters by shortname or ID # Users will set parameters by shortname or ID
if ($filename eq 'paramId.def' || $filename eq 'shortName.def') { if ($filename eq 'paramId.def' || $filename eq 'shortName.def') {
# The 'typeOfSecondFixedSurface' key has side effects and can change the scale values/factors! # The 'typeOfSecondFixedSurface' key has side effects and can change the scale values/factors!
# So make sure it comes BEFORE the scale keys! i.e. if we find a scale key then our map should have # So make sure it comes BEFORE the scale keys! So if we come across this key ensure none of
# the typeOf key since it came before # scale keys came before it
if ($key =~ /scale.*OfSecondFixedSurface/ && !exists($map2{'typeOfSecondFixedSurface'})) { if ( $key =~ /typeOfSecondFixedSurface/ &&
(exists($map2{'scaleFactorOfFirstFixedSurface'}) ||
exists($map2{'scaledValueOfFirstFixedSurface'}) ||
exists($map2{'scaleFactorOfSecondFixedSurface'}) ||
exists($map2{'scaledValueOfSecondFixedSurface'})) )
{
print "File: $filename, line: $lineNum: TypeOfSurface problem (GRIB-229): Please check: $desc\n"; print "File: $filename, line: $lineNum: TypeOfSurface problem (GRIB-229): Please check: $desc\n";
#$error = 1; #print "DUMP,\t", Data::Dumper->Dump([\%map2], [" "]);
} $error = 1;
if ($key =~ /typeOfSecondFixedSurface/ && exists($map2{'typeOfFirstFixedSurface'})) {
print "File: $filename, line: $lineNum: Potential TypeOfSurface problem (GRIB-229): Please check: $desc\n";
} }
} }
$map2{$key} = $val; $map2{$key} = $val;