Definitions: Precedence order env var

This commit is contained in:
shahramn 2024-10-31 11:14:59 +00:00
parent 6d0e3e733a
commit d8f1cdcc3d
2 changed files with 15 additions and 3 deletions

View File

@ -12,7 +12,8 @@ constant internalVersion=30 : hidden;
meta checkInternalVersion check_internal_version(internalVersion) : hidden; meta checkInternalVersion check_internal_version(internalVersion) : hidden;
# ECC-806: Local concepts precedence order # ECC-806: Local concepts precedence order
transient preferLocalConcepts = 0 : hidden; preferLocalConceptsEnvVar = getenv("ECCODES_GRIB_PREFER_LOCAL_CONCEPTS","0") : hidden;
transient preferLocalConcepts = preferLocalConceptsEnvVar : hidden;
constant defaultTypeOfLevel="unknown" : hidden; constant defaultTypeOfLevel="unknown" : hidden;

View File

@ -17,7 +17,6 @@
label="grib_ecc-806_test" label="grib_ecc-806_test"
tempGrb=temp.${label}.grb tempGrb=temp.${label}.grb
tempOut=temp.${label}.txt tempOut=temp.${label}.txt
tempErr=temp.${label}.err
# This NCEP grib2 file has the keys # This NCEP grib2 file has the keys
# discipline = 0 # discipline = 0
@ -36,5 +35,17 @@ res=`${tools_dir}/grib_get -p paramId,shortName,units,name $input`
res=`${tools_dir}/grib_get -s preferLocalConcepts=1 -p paramId,shortName,units,name $input` res=`${tools_dir}/grib_get -s preferLocalConcepts=1 -p paramId,shortName,units,name $input`
[ "$res" = "260056 sdwe kg m**-2 Water equivalent of accumulated snow depth (deprecated)" ] [ "$res" = "260056 sdwe kg m**-2 Water equivalent of accumulated snow depth (deprecated)" ]
# Test the environment variable too
export ECCODES_GRIB_PREFER_LOCAL_CONCEPTS=1
grib_check_key_equals $input preferLocalConceptsEnvVar,preferLocalConcepts '1 1'
res=`${tools_dir}/grib_get -p paramId,shortName,units,name $input`
[ "$res" = "260056 sdwe kg m**-2 Water equivalent of accumulated snow depth (deprecated)" ]
export ECCODES_GRIB_PREFER_LOCAL_CONCEPTS=0
grib_check_key_equals $input preferLocalConceptsEnvVar,preferLocalConcepts '0 0'
unset ECCODES_GRIB_PREFER_LOCAL_CONCEPTS
grib_check_key_equals $input preferLocalConceptsEnvVar,preferLocalConcepts '0 0'
# Clean up # Clean up
rm -f $tempGrb $tempOut $tempErr rm -f $tempGrb $tempOut