chemId/paramId split: chemName etc should not be present for non-chemicals

This commit is contained in:
shahramn 2024-06-13 17:50:20 +01:00
parent ef5252723a
commit a0f879d582
2 changed files with 19 additions and 15 deletions

View File

@ -44,16 +44,18 @@ else {
alias cfVarName=cfVarNameFallback; alias cfVarName=cfVarNameFallback;
} }
concept chemId (unknown,"chemId.def",conceptsDir2,conceptsDir1): no_copy,long_type,dump; if (tablesVersion >= 31 ) {
concept chemName (unknown,"chemName.def",conceptsDir2,conceptsDir1): no_copy,dump; concept chemId (unknown,"chemId.def",conceptsDir2,conceptsDir1): no_copy,long_type,dump;
concept chemShortName (unknown,"chemShortName.def",conceptsDir2,conceptsDir1): no_copy,dump; concept chemName (unknown,"chemName.def",conceptsDir2,conceptsDir1): no_copy,dump;
concept chemFormula (unknown,"chemFormula.def",conceptsDir2,conceptsDir1): no_copy,dump; concept chemShortName (unknown,"chemShortName.def",conceptsDir2,conceptsDir1): no_copy,dump;
concept chemFormula (unknown,"chemFormula.def",conceptsDir2,conceptsDir1): no_copy,dump;
if ( !(chemId is "unknown") ) { if ( !(chemId is "unknown") ) {
alias mars.chem = chemId; alias mars.chem = chemId;
alias parameter.chemId = chemId; alias parameter.chemId = chemId;
alias ls.chemShortName = chemShortName; alias ls.chemShortName = chemShortName;
alias parameter.chemShortName = chemShortName; alias parameter.chemShortName = chemShortName;
}
} }
template_nofail names "grib2/products_[productionStatusOfProcessedData].def"; template_nofail names "grib2/products_[productionStatusOfProcessedData].def";

View File

@ -10,7 +10,6 @@
. ./include.ctest.sh . ./include.ctest.sh
label="grib_paramid_chemid_split_test" label="grib_paramid_chemid_split_test"
tempGribA=temp1.$label.grib tempGribA=temp1.$label.grib
tempGribB=temp2.$label.grib tempGribB=temp2.$label.grib
@ -23,6 +22,9 @@ ${tools_dir}/grib_set -s productDefinitionTemplateNumber=40,discipline=0,paramet
$sample_grib2 $tempGribA $sample_grib2 $tempGribA
grib_check_key_equals $tempGribA tablesVersion 4 grib_check_key_equals $tempGribA tablesVersion 4
grib_check_key_equals $tempGribA paramId,is_chemical "210121 1" grib_check_key_equals $tempGribA paramId,is_chemical "210121 1"
# The new keys should not be present
result=$( ${tools_dir}/grib_get -f -p chemName,chemId $tempGribA )
[ "$result" = "not_found not_found" ]
# Switch to the newer tablesVersion so now the chemId/paramId split is activated # Switch to the newer tablesVersion so now the chemId/paramId split is activated
@ -30,12 +32,12 @@ grib_check_key_equals $tempGribA paramId,is_chemical "210121 1"
${tools_dir}/grib_set -s tablesVersion=32 $tempGribA $tempGribB ${tools_dir}/grib_set -s tablesVersion=32 $tempGribA $tempGribB
grib_check_key_equals $tempGribB paramId,chemId "402000 17" grib_check_key_equals $tempGribB paramId,chemId "402000 17"
grib_check_key_equals $tempGribB chemName "Nitrogen dioxide"
grib_check_key_equals $tempGribB name "Mass mixing ratio" grib_check_key_equals $tempGribB name "Mass mixing ratio"
set +e
${tools_dir}/grib_get -p is_chemical $tempGribB 2> /dev/null # The is_chemical key should not be present
status=$? result=$( ${tools_dir}/grib_get -f -p is_chemical $tempGribB )
set -e [ "$result" = "not_found" ]
[ $status -ne 0 ]
# Clean up # Clean up