ECC-992: Renamed environment variable

This commit is contained in:
Shahram Najm 2019-11-29 14:45:55 +00:00
parent 696d08785f
commit 089604ec03
2 changed files with 24 additions and 10 deletions

View File

@ -461,12 +461,12 @@ grib_context* grib_context_get_default()
} }
} }
/* Definitions path supplement: Added at the head of existing path */ /* Definitions path extra: Added at the head of (i.e. before) existing path */
{ {
const char* defs_supp = codes_getenv("ECCODES_DEFINITION_PATH_SUPPLEMENT"); const char* defs_extra = getenv("ECCODES_EXTRA_DEFINITION_PATH");
if (defs_supp) { if (defs_extra) {
char buffer[DEF_PATH_MAXLEN]; char buffer[DEF_PATH_MAXLEN];
ecc_snprintf(buffer, DEF_PATH_MAXLEN, "%s:%s", defs_supp, default_grib_context.grib_definition_files_path); ecc_snprintf(buffer, DEF_PATH_MAXLEN, "%s:%s", defs_extra, default_grib_context.grib_definition_files_path);
default_grib_context.grib_definition_files_path = strdup(buffer); default_grib_context.grib_definition_files_path = strdup(buffer);
} }
} }

View File

@ -14,20 +14,34 @@ set -u
# Tests for data quality checks # Tests for data quality checks
# --------------------------------------------------------- # ---------------------------------------------------------
label="grib_data_quality" label="grib_data_quality"
tempOut=temp.${label}.out tempOut=temp.1.${label}.out
temp2=temp.2.${label}.out
tempErr=temp.${label}.err tempErr=temp.${label}.err
# Start with clean environment
unset ECCODES_GRIB_DATA_QUALITY_CHECKS
unset ECCODES_EXTRA_DEFINITION_PATH
input1=${data_dir}/reduced_gaussian_surface.grib1 input1=${data_dir}/reduced_gaussian_surface.grib1
input2=${data_dir}/reduced_gaussian_surface.grib2 input2=${data_dir}/reduced_gaussian_surface.grib2
grib_check_key_equals $input1 paramId 167 grib_check_key_equals $input1 paramId 167
grib_check_key_equals $input2 paramId 167 grib_check_key_equals $input2 paramId 167
# Data quality checks disabled. Create cause huge values for temperature # Data quality checks disabled. Create huge values for temperature
unset ECCODES_GRIB_DATA_QUALITY_CHECKS
${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut ${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut
${tools_dir}/grib_set -s scaleValuesBy=100 $input2 $tempOut ${tools_dir}/grib_set -s scaleValuesBy=100 $input2 $tempOut
# Data quality checks enabled. Commands should fail # Data quality checks enabled. Repacking should fail
export ECCODES_GRIB_DATA_QUALITY_CHECKS=1
set +e
${tools_dir}/grib_copy -r $tempOut /dev/null 2>$tempErr
status=$?
set -e
[ $status -ne 0 ]
grep -q 'outside allowable limits' $tempErr
# Data quality checks enabled. Scaling should fail
export ECCODES_GRIB_DATA_QUALITY_CHECKS=1 export ECCODES_GRIB_DATA_QUALITY_CHECKS=1
set +e set +e
${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut 2>$tempErr ${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut 2>$tempErr
@ -62,9 +76,9 @@ cat > $tempDir/param_limits.def <<EOF
} : long_type, hidden; } : long_type, hidden;
EOF EOF
# Command should not fail now # Command should succeed
export ECCODES_GRIB_DATA_QUALITY_CHECKS=1 export ECCODES_GRIB_DATA_QUALITY_CHECKS=1
export ECCODES_DEFINITION_PATH_SUPPLEMENT=$test_dir/$tempDir export ECCODES_EXTRA_DEFINITION_PATH=$test_dir/$tempDir
${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut ${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut