mirror of https://github.com/ecmwf/eccodes.git
Tools: grib_to_netcdf test for GRIB_TO_NETCDF_CHECKVALIDTIME
This commit is contained in:
parent
e524876975
commit
265b4fc49b
|
@ -1 +0,0 @@
|
|||
ret,padding=0,level=500,grid=2/2,area=2/0/0/2,target=latlon.grib
|
|
@ -1 +0,0 @@
|
|||
ret,padding=0,level=500,resol=21,target=spectral.grib
|
|
@ -135,5 +135,24 @@ ${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempDir > $tempText
|
|||
grep -q "Processing input file .*/subdir/regular_latlon_surface.grib2" $tempText
|
||||
rm -rf $tempDir
|
||||
|
||||
echo "Enable/Disable Checks ..."
|
||||
# ---------------------------------
|
||||
rm -f $tempNetcdf
|
||||
input=${data_dir}/regular_latlon_surface.grib2
|
||||
cat $input $input > $tempGrib
|
||||
# By default checks are enabled. So this should fail
|
||||
set +e
|
||||
${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib > $tempText 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Wrong number of fields" $tempText
|
||||
|
||||
export GRIB_TO_NETCDF_CHECKVALIDTIME=0
|
||||
${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib
|
||||
[ -f "$tempNetcdf" ]
|
||||
unset GRIB_TO_NETCDF_CHECKVALIDTIME
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempNetcdf $tempGrib $tempText
|
||||
|
|
|
@ -2107,8 +2107,12 @@ static void get_nc_options(const request* user_r)
|
|||
setup.history = history ? grib_context_strdup(ctx, (history)) : NULL;
|
||||
setup.unlimited = unlimited ? grib_context_strdup(ctx, ((unlimited))) : NULL;
|
||||
|
||||
setup.checkvalidtime = true;
|
||||
checkvalidtime_env = getenv("GRIB_TO_NETCDF_CHECKVALIDTIME");
|
||||
setup.checkvalidtime = checkvalidtime_env ? atol(checkvalidtime_env) : 1;
|
||||
if (checkvalidtime_env) {
|
||||
const long v = atol(checkvalidtime_env);
|
||||
if (v == 0) setup.checkvalidtime = false;
|
||||
}
|
||||
setup.mars_description = empty_request("MARS");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue