diff --git a/definitions/boot.def b/definitions/boot.def index bb8991382..25b3f895d 100644 --- a/definitions/boot.def +++ b/definitions/boot.def @@ -12,7 +12,8 @@ constant internalVersion=30 : hidden; meta checkInternalVersion check_internal_version(internalVersion) : hidden; # 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; diff --git a/tests/grib_ecc-806.sh b/tests/grib_ecc-806.sh index 95707b812..11c375c56 100755 --- a/tests/grib_ecc-806.sh +++ b/tests/grib_ecc-806.sh @@ -17,7 +17,6 @@ label="grib_ecc-806_test" tempGrb=temp.${label}.grb tempOut=temp.${label}.txt -tempErr=temp.${label}.err # This NCEP grib2 file has the keys # 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" = "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 -rm -f $tempGrb $tempOut $tempErr +rm -f $tempGrb $tempOut