Merge branch 'develop' into develop

This commit is contained in:
shahramn 2020-10-20 15:12:36 +01:00 committed by GitHub
commit f93d92350a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 12 deletions

View File

@ -53,9 +53,6 @@ output_file_base = sys.argv[-1]
buffer = None
fcount = -1
for directory in dirs:
# print("MEMFS: directory=", directory)
@ -70,14 +67,12 @@ for directory in dirs:
dirnames[:] = [dirname for dirname in dirnames if dirname not in EXCLUDED]
for name in files:
if buffer is None:
fcount += 1
opath = get_outfile_name(output_file_base, fcount)
print("MEMFS: Generating output:", opath)
buffer = open(opath, 'wb')
full = "%s/%s" % (dirpath, name)
_, ext = os.path.splitext(full)
if ext not in [".def", ".table", ".tmpl", ".list", ".txt"]:
@ -119,7 +114,6 @@ for directory in dirs:
buffer.close()
buffer = None
if buffer is not None:
buffer.close()
@ -323,3 +317,4 @@ FILE* codes_memfs_open(const char* path) {
print("Finished")
print("MEMFS: done", time.time() - start)

View File

@ -672,6 +672,15 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
return GRIB_INTERNAL_ERROR;
}
/* Data Quality checks */
if (a->context->grib_data_quality_checks) {
/* First value is the field's average */
double min_val = val[0];
double max_val = min_val;
if ((ret = grib_util_grib_data_quality_check(gh, min_val, max_val)) != GRIB_SUCCESS)
return ret;
}
if (pen_j == sub_j) {
double* values;
d = grib_power(decimal_scale_factor, 10);
@ -819,7 +828,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
}
else {
/* _test(val[i]*d,0); */
grib_encode_unsigned_long(hres, encode_float(val[i++]), &hpos, 8 * bytes);
/* _test(val[i]*d,0); */
grib_encode_unsigned_long(hres, encode_float(val[i++]), &hpos, 8 * bytes);

View File

@ -62,7 +62,7 @@ r=`${test_dir}/bufr_extract_headers centre ${data_dir}/bufr/israel_observations_
# Check all centres with an abbreviation
centre_table=${ECCODES_DEFINITION_PATH}/common/c-11.table
centres=`awk 'NR > 1 && $2 ~ /^[A-z]/ {print $2}' < $centre_table`
centres=`awk 'NR > 1 {print $2}' < $centre_table`
for c in $centres; do
${tools_dir}/bufr_set -s centre=$c $ECCODES_SAMPLES_PATH/BUFR4.tmpl $temp1
r=`${test_dir}/bufr_extract_headers centre $temp1`

View File

@ -140,24 +140,34 @@ echo "Override the defaults..."
tempDir=tempdir.$label
rm -rf $tempDir
mkdir -p $tempDir
# Set a large limit for temperature
# Change limits for 2m temperature (grid-point) and Temperature (spectral)
cat > $tempDir/param_limits.def <<EOF
constant default_min_val = -1e9 : long_type, hidden;
constant default_max_val = +1e9 : long_type, hidden;
concept param_value_min(default_min_val) {
0 = { paramId=167; }
273 = { paramId=130; }
} : long_type, hidden;
concept param_value_max(default_max_val) {
40000 = { paramId=167; }
273 = { paramId=130; }
} : long_type, hidden;
EOF
# Command should succeed
# High 2m temperature should succeed
#export ECCODES_DEBUG=-1
export ECCODES_GRIB_DATA_QUALITY_CHECKS=1
export ECCODES_EXTRA_DEFINITION_PATH=$test_dir/$tempDir
${tools_dir}/grib_set -s scaleValuesBy=100 $input1 $tempOut
${tools_dir}/grib_set -s paramId=167,scaleValuesBy=1000 $input1 $tempOut
# Spectral temperature (paramId=130) should fail
sh_sample="$ECCODES_SAMPLES_PATH/sh_sfc_grib1.tmpl"
grib_check_key_equals $sh_sample "packingType,paramId" "spectral_complex 130"
set +e
${tools_dir}/grib_copy -r $sh_sample $tempGrib1
status=$?
set -e
[ $status -ne 0 ]
# Clean up
rm -rf $tempDir