mirror of https://github.com/ecmwf/eccodes.git
Merge pull request #208 from ecmwf/bugfix/ECC-1813_setting_stepunits_has_no_effect
ECC-1813: Setting stepunits has no effect
This commit is contained in:
commit
908a6d367c
|
@ -262,9 +262,13 @@ static int unpack_one_time_range_long_(grib_accessor* a, long* val, size_t* len)
|
|||
}
|
||||
if (add_time_range) {
|
||||
*val = start_step_value + time_range_value;
|
||||
if ((err = grib_set_long_internal(h, "endStepUnit", step_units)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
}
|
||||
else {
|
||||
*val = start_step_value;
|
||||
if ((err = grib_set_long_internal(h, "endStepUnit", step_units)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
}
|
||||
|
||||
return GRIB_SUCCESS;
|
||||
|
@ -310,9 +314,13 @@ static int unpack_one_time_range_double_(grib_accessor* a, double *val , size_t*
|
|||
}
|
||||
if (add_time_range) {
|
||||
*val = (start_step + time_range).value<double>(eccodes::Unit(step_units));
|
||||
if ((err = grib_set_long_internal(h, "endStepUnit", step_units)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
}
|
||||
else {
|
||||
*val = start_step.value<double>(eccodes::Unit(start_step_unit));
|
||||
if ((err = grib_set_long_internal(h, "endStepUnit", start_step_unit)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
}
|
||||
|
||||
return GRIB_SUCCESS;
|
||||
|
@ -441,14 +449,19 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
|||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
int ret = 0;
|
||||
long start_step_value;
|
||||
long start_step_unit;
|
||||
long numberOfTimeRange;
|
||||
|
||||
if ((ret = grib_get_long_internal(h, self->start_step_value, &start_step_value)))
|
||||
return ret;
|
||||
if ((ret = grib_get_long_internal(h, "startStepUnit", &start_step_unit)))
|
||||
return ret;
|
||||
|
||||
/* point in time */
|
||||
if (self->year == NULL) {
|
||||
*val = start_step_value;
|
||||
if ((ret = grib_set_long_internal(h, "endStepUnit", start_step_unit)))
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -479,14 +492,19 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
int ret = 0;
|
||||
long start_step_value;
|
||||
long start_step_unit;
|
||||
long numberOfTimeRange;
|
||||
|
||||
if ((ret = grib_get_long_internal(h, self->start_step_value, &start_step_value)))
|
||||
return ret;
|
||||
if ((ret = grib_get_long_internal(h, "startStepUnit", &start_step_unit)))
|
||||
return ret;
|
||||
|
||||
/* point in time */
|
||||
if (self->year == NULL) {
|
||||
*val = start_step_value;
|
||||
if ((ret = grib_set_long_internal(h, "endStepUnit", start_step_unit)))
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -542,7 +560,8 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en
|
|||
|
||||
/*point in time */
|
||||
if (self->year == NULL) {
|
||||
err = grib_set_long_internal(h, "startStepUnit", end_step.unit().value<long>());
|
||||
if ((err = grib_set_long_internal(h, "startStepUnit", end_step.unit().value<long>())) != GRIB_SUCCESS)
|
||||
return err;
|
||||
err = grib_set_long_internal(h, self->start_step_value, end_step.value<long>());
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -178,6 +178,12 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
grib_accessor_optimal_step_units* self = (grib_accessor_optimal_step_units*)a;
|
||||
|
||||
long start_step = 0;
|
||||
long start_step_unit = 0;
|
||||
long end_step = 0;
|
||||
long end_step_unit = 0;
|
||||
int ret;
|
||||
|
||||
auto supported_units = eccodes::Unit::list_supported_units();
|
||||
try {
|
||||
eccodes::Unit unit{*val}; // throws if not supported
|
||||
|
@ -198,10 +204,42 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
return GRIB_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
int ret;
|
||||
// ECC-1813: When the stepUnits key is used without specifying a value, as in the command
|
||||
// "grib-set -s stepUnits=m in.grib out.grib", the following code initiates an indirect update
|
||||
// of the low-level keys: forecastTime,indicatorOfUnitOfTimeRange,indicatorOfUnitForTimeRange,lengthOfTimeRange
|
||||
|
||||
self->overwriteStepUnits = *val;
|
||||
if ((ret = grib_set_long_internal(h, "forceStepUnits", *val)) != GRIB_SUCCESS) {
|
||||
if ((ret = grib_set_long_internal(h, "forceStepUnits", *val)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
if ((ret = grib_get_long_internal(h, "startStep", &start_step)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_get_long_internal(h, "startStepUnit", &start_step_unit)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_get_long_internal(h, "endStep", &end_step)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_get_long_internal(h, "endStepUnit", &end_step_unit)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
try {
|
||||
eccodes::Step start{start_step, start_step_unit};
|
||||
start.set_unit(*val);
|
||||
eccodes::Step end{end_step, end_step_unit};
|
||||
end.set_unit(*val);
|
||||
|
||||
if ((ret = grib_set_long_internal(h, "startStepUnit", start.unit().value<long>())) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_set_long_internal(h, "startStep", start.value<long>())) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_set_long_internal(h, "endStepUnit", end.unit().value<long>())) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_set_long_internal(h, "endStep", end.value<long>())) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
std::string msg = std::string{"Failed to convert steps to: "} + std::to_string(*val) + " (" + e.what() + ")";
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "%s", msg.c_str());
|
||||
return GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
return GRIB_SUCCESS;
|
||||
|
|
|
@ -62,86 +62,109 @@ fi
|
|||
instantaneous_field=$data_dir/reduced_gaussian_surface.grib2
|
||||
accumulated_field=$data_dir/reduced_gaussian_sub_area.grib2
|
||||
|
||||
|
||||
# ECC-1813: Test that we can set the stepUnits without setting the step
|
||||
in="$instantaneous_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=60 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
${tools_dir}/grib_set -s stepUnits=s $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "3600 s"
|
||||
${tools_dir}/grib_set -s stepUnits=m $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "60 m"
|
||||
${tools_dir}/grib_set -s stepUnits=h $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "1 h"
|
||||
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-180 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 120 m"
|
||||
${tools_dir}/grib_set -s stepUnits=s $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "3600 s 7200 s"
|
||||
${tools_dir}/grib_set -s stepUnits=m $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "60 m 120 m"
|
||||
${tools_dir}/grib_set -s stepUnits=h $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "1 h 2 h"
|
||||
|
||||
# Check the lowercase alias 'stepunits' for a variety of step types (instant, accum etc)
|
||||
${tools_dir}/grib_get -p stepunits $data_dir/tigge_cf_ecmwf.grib2
|
||||
|
||||
|
||||
#### Make sure that step, stepRange, startStep, endStep produce the same result for instantaneous fields
|
||||
fn="$instantaneous_field"
|
||||
in="$instantaneous_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
|
||||
keys_step="step,step:s,step:i,step:d,stepUnits:s"
|
||||
keys_step_range="stepRange,stepRange:s,stepRange:i,stepRange:d,stepUnits:s"
|
||||
keys_start_step="startStep,startStep:s,startStep:i,startStep:d,stepUnits:s"
|
||||
keys_end_step="endStep,endStep:s,endStep:i,endStep:d,stepUnits:s"
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 h"
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=59 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=59 $in $temp
|
||||
grib_check_key_equals $temp "-p $keys_step" "59m 59m 59 59 m"
|
||||
grib_check_key_equals $temp "-p $keys_step_range" "59m 59m 59 59 m"
|
||||
grib_check_key_equals $temp "-p $keys_start_step" "59m 59m 59 59 m"
|
||||
grib_check_key_equals $temp "-p $keys_end_step" "59m 59m 59 59 m"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 h"
|
||||
${tools_dir}/grib_set -s step=59m $fn $temp
|
||||
${tools_dir}/grib_set -s step=59m $in $temp
|
||||
grib_check_key_equals $temp "-p $keys_step" "59m 59m 59 59 m"
|
||||
grib_check_key_equals $temp "-p $keys_step_range" "59m 59m 59 59 m"
|
||||
grib_check_key_equals $temp "-p $keys_start_step" "59m 59m 59 59 m"
|
||||
grib_check_key_equals $temp "-p $keys_end_step" "59m 59m 59 59 m"
|
||||
|
||||
|
||||
#### stepUnits overrides the units in the low level keys
|
||||
# if stepUnits=UNIT is set, then set the low level keys to UNIT
|
||||
# else optimise low level keys
|
||||
# instant fields:
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
fn="$instantaneous_field"
|
||||
in="$instantaneous_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
|
||||
keys__="step,stepUnits:s"
|
||||
keys_s="step:s"
|
||||
keys_i="step:i,stepUnits:s"
|
||||
keys_d="step:d,stepUnits:s"
|
||||
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=60 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=60 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "60m"
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=60 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=m,step=60 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "60m"
|
||||
${tools_dir}/grib_set -s step=60m $fn $temp
|
||||
${tools_dir}/grib_set -s step=60m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "60m"
|
||||
|
||||
|
||||
# accumulated fields:
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
keys__="step,startStep,endStep,stepRange,stepUnits:s"
|
||||
keys_s="step:s,startStep:s,endStep:s,stepRange:s,stepUnits:s"
|
||||
keys_i="step:i,startStep:i,endStep:i,stepRange:i,stepUnits:s"
|
||||
keys_d="step:d,startStep:d,endStep:d,stepRange:d,stepUnits:s"
|
||||
|
||||
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-120 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-120 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "2$HOUR 1$HOUR 2$HOUR 1$HOUR-2$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "120m 60m 120m 60m-120m m"
|
||||
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-120 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-120 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "2$HOUR 1$HOUR 2$HOUR 1$HOUR-2$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "120m 60m 120m 60m-120m m"
|
||||
${tools_dir}/grib_set -s stepRange=60m-120m $fn $temp
|
||||
${tools_dir}/grib_set -s stepRange=60m-120m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1 h 1 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "2$HOUR 1$HOUR 2$HOUR 1$HOUR-2$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "120m 60m 120m 60m-120m m"
|
||||
|
||||
|
||||
#### CHECK units
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=96,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=96,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 h 96 h"
|
||||
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=s -p step:i,stepUnits:s" "345600 s"
|
||||
|
@ -162,38 +185,38 @@ grib_check_key_equals $temp " -w count=1 -s stepUnits=6h -p step,stepUnits:s" "1
|
|||
grib_check_key_equals $temp " -w count=1 -s stepUnits=12h -p step,stepUnits:s" "8x12h 12h"
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=D -p step,stepUnits:s" "4D D"
|
||||
|
||||
${tools_dir}/grib_set -s stepUnits=s,startStep=0,endStep=345600 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=s,startStep=0,endStep=345600 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 s 345600 s"
|
||||
${tools_dir}/grib_set -s stepUnits=m,startStep=0,endStep=5760 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=m,startStep=0,endStep=5760 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 m 5760 m"
|
||||
${tools_dir}/grib_set -s stepUnits=h,startStep=0,endStep=96 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=h,startStep=0,endStep=96 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 h 96 h"
|
||||
${tools_dir}/grib_set -s stepUnits=6h,startStep=0,endStep=16 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=6h,startStep=0,endStep=16 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 6h 16 6h"
|
||||
${tools_dir}/grib_set -s stepUnits=12h,startStep=0,endStep=8 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=12h,startStep=0,endStep=8 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 12h 8 12h"
|
||||
${tools_dir}/grib_set -s stepUnits=D,startStep=0,endStep=4 $fn $temp
|
||||
${tools_dir}/grib_set -s stepUnits=D,startStep=0,endStep=4 $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 D 4 D"
|
||||
|
||||
|
||||
#### CHECK negative forecastTime
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
${tools_dir}/grib_set -s forecastTime=-6,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=-6,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "-6 h 6 h"
|
||||
|
||||
grib_check_key_equals $temp "-s stepUnits:s=h -p startStep:s,endStep:s" "-6$HOUR 0$HOUR"
|
||||
grib_check_key_equals $temp "-s stepUnits:s=m -p startStep:s,endStep:s" "-360m 0m"
|
||||
grib_check_key_equals $temp "-s stepUnits:s=s -p startStep:s,endStep:s" "-21600s 0s"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=-48,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=0,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=-48,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=0,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p stepRange" "-48$HOUR"
|
||||
|
||||
|
||||
#### CHECK: check optimal units are set correctly in GRIB files
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "24 h 1 D"
|
||||
|
||||
### TODO(maee): @Shahram: how to make parameters position independent
|
||||
|
@ -220,18 +243,18 @@ grib_check_key_equals $temp2 "-p $low_level_keys" "60 h 120 h"
|
|||
${tools_dir}/grib_set -s stepUnits:s=h,startStep:i=60,endStep:i=180 $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "60 h 120 h"
|
||||
|
||||
#fn="$accumulated_field"
|
||||
#in="$accumulated_field"
|
||||
#low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
##high_level_keys="startStep:s,endStep:s"
|
||||
#high_level_keys="startStep:i,endStep:i"
|
||||
#${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $fn $temp
|
||||
#${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $in $temp
|
||||
#grib_check_key_equals $temp "-p $low_level_keys" "24 h 1 D"
|
||||
#grib_check_key_equals $temp "-p $high_level_keys" "24 48"
|
||||
#${tools_dir}/grib_set -s startStep:i=24 $temp $temp2
|
||||
#grib_check_key_equals $temp2 "-p $low_level_keys" "24 h 0 h"
|
||||
#grib_check_key_equals $temp2 "-p $high_level_keys" "24 24"
|
||||
|
||||
#${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=24,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
#${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=24,indicatorOfUnitForTimeRange=h $in $temp
|
||||
#grib_check_key_equals $temp "-p $low_level_keys" "24 h 24 h"
|
||||
#grib_check_key_equals $temp "-p $high_level_keys" "24 48"
|
||||
#${tools_dir}/grib_set -s startStep:i=24 $temp $temp2
|
||||
|
@ -240,9 +263,9 @@ grib_check_key_equals $temp2 "-p $low_level_keys" "60 h 120 h"
|
|||
#exit
|
||||
|
||||
#### CHECK: grib_set - endStep + stepUnits
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "24 h 1 D"
|
||||
|
||||
# Use range unit: hour
|
||||
|
@ -302,14 +325,14 @@ ${tools_dir}/grib_set -s stepRange:s=62D-122D $temp $temp2
|
|||
grib_check_key_equals $temp2 "-p $low_level_keys" "1488 h 1440 h"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "1488$HOUR-2928$HOUR"
|
||||
|
||||
fn="$instantaneous_field"
|
||||
in="$instantaneous_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
|
||||
keys__="step,stepUnits:s"
|
||||
keys_s="step:s"
|
||||
keys_i="step:i,stepUnits:s"
|
||||
keys_d="step:d,stepUnits:s"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=59,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=59,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $keys__ -s stepUnits=s" "3540s s"
|
||||
grib_check_key_equals $temp "-p $keys__ -s stepUnits=m" "59m m"
|
||||
#grib_check_key_equals $temp "-p $keys__ -s stepUnits=h" "0" # not supported
|
||||
|
@ -324,7 +347,7 @@ grib_check_key_equals $temp "-p $keys_d -s stepUnits=m" "59 m"
|
|||
#grib_check_key_equals $temp "-p $keys_d -s stepUnits=h" "0.983333" # not supported
|
||||
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $keys_i -s stepUnits=s" "0 s"
|
||||
grib_check_key_equals $temp "-p $keys_i -s stepUnits=m" "0 m"
|
||||
grib_check_key_equals $temp "-p $keys_i -s stepUnits=h" "0 h"
|
||||
|
@ -333,14 +356,14 @@ grib_check_key_equals $temp "-p $keys_d -s stepUnits=m" "0 m"
|
|||
grib_check_key_equals $temp "-p $keys_d -s stepUnits=h" "0 h"
|
||||
|
||||
|
||||
fn="$instantaneous_field"
|
||||
in="$instantaneous_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
|
||||
keys__="step,stepUnits:s"
|
||||
keys_s="step:s,stepUnits:s"
|
||||
keys_i="step:i,stepUnits:s"
|
||||
keys_d="step:d,stepUnits:s"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "0m m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "0m m"
|
||||
|
@ -361,7 +384,7 @@ grib_check_key_equals $temp "-p $keys_d -s stepUnits=m" "0 m"
|
|||
grib_check_key_equals $temp "-p $keys_d -s stepUnits=h" "0 h"
|
||||
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=59,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=59,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "59 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "59m m"
|
||||
#grib_check_key_equals $temp "-p $keys_s" "59"
|
||||
|
@ -369,14 +392,14 @@ grib_check_key_equals $temp "-p $keys_s" "59m m"
|
|||
grib_check_key_equals $temp "-p $keys_i" "59 m"
|
||||
grib_check_key_equals $temp "-p $keys_d" "59 m"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=60,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=60,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "1$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_i" "1 h"
|
||||
grib_check_key_equals $temp "-p $keys_d" "1 h"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=61,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=61,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "61 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "61m m"
|
||||
#grib_check_key_equals $temp "-p $keys_s" "61"
|
||||
|
@ -384,14 +407,14 @@ grib_check_key_equals $temp "-p $keys_s" "61m m"
|
|||
grib_check_key_equals $temp "-p $keys_i" "61 m"
|
||||
grib_check_key_equals $temp "-p $keys_d" "61 m"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "24 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "24$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "24$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_i" "24 h"
|
||||
grib_check_key_equals $temp "-p $keys_d" "24 h"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=1440,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=1440,indicatorOfUnitOfTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1440 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "24$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "24$HOUR h"
|
||||
|
@ -399,40 +422,40 @@ grib_check_key_equals $temp "-p $keys_i" "24 h"
|
|||
grib_check_key_equals $temp "-p $keys_d" "24 h"
|
||||
|
||||
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
${tools_dir}/grib_set -s stepRange=60m-2h $fn $temp
|
||||
${tools_dir}/grib_set -s stepRange=60m-2h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1 h 1 h"
|
||||
|
||||
fn="$accumulated_field"
|
||||
in="$accumulated_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
|
||||
keys__="stepRange,startStep,endStep"
|
||||
keys_s="stepRange:s,startStep:s,endStep:s"
|
||||
keys_i="stepRange:i,startStep:i,endStep:i"
|
||||
keys_d="stepRange:d,startStep:d,endStep:d"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=2,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=2,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 m 2 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "0$HOUR-2$HOUR 0$HOUR 2$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "0$HOUR-2$HOUR 0$HOUR 2$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_i" "2 0 2"
|
||||
grib_check_key_equals $temp "-p $keys_d" "2 0 2"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "24 h 1 D"
|
||||
grib_check_key_equals $temp "-p $keys__" "24$HOUR-48$HOUR 24$HOUR 48$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "24$HOUR-48$HOUR 24$HOUR 48$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_i" "48 24 48"
|
||||
grib_check_key_equals $temp "-p $keys_d" "48 24 48"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=25,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=25,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=1,indicatorOfUnitForTimeRange=D $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "25 h 1 D"
|
||||
grib_check_key_equals $temp "-p $keys__" "25$HOUR-49$HOUR 25$HOUR 49$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "25$HOUR-49$HOUR 25$HOUR 49$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_i" "49 25 49"
|
||||
grib_check_key_equals $temp "-p $keys_d" "49 25 49"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=45,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=15,indicatorOfUnitForTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=45,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=15,indicatorOfUnitForTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "45 m 15 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "45m-60m 45m 60m"
|
||||
#grib_check_key_equals $temp "-p $keys_s" "45-60 45 60"
|
||||
|
@ -440,28 +463,28 @@ grib_check_key_equals $temp "-p $keys_s" "45m-60m 45m 60m"
|
|||
grib_check_key_equals $temp "-p $keys_i" "60 45 60"
|
||||
grib_check_key_equals $temp "-p $keys_d" "60 45 60"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=60,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=2,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=60,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=2,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 2 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "1$HOUR-3$HOUR 1$HOUR 3$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1$HOUR-3$HOUR 1$HOUR 3$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_i" "3 1 3"
|
||||
grib_check_key_equals $temp "-p $keys_d" "3 1 3"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=18,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=18,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "18 h 6 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "18$HOUR-24$HOUR 18$HOUR 24$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "18$HOUR-24$HOUR 18$HOUR 24$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_i" "24 18 24"
|
||||
grib_check_key_equals $temp "-p $keys_d" "24 18 24"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=1080,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=360,indicatorOfUnitForTimeRange=m $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=1080,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=360,indicatorOfUnitForTimeRange=m $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1080 m 360 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "18$HOUR-24$HOUR 18$HOUR 24$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "18$HOUR-24$HOUR 18$HOUR 24$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_i" "24 18 24"
|
||||
grib_check_key_equals $temp "-p $keys_d" "24 18 24"
|
||||
|
||||
${tools_dir}/grib_set -s forecastTime=1080,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
${tools_dir}/grib_set -s forecastTime=1080,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $in $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1080 m 6 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "18$HOUR-24$HOUR 18$HOUR 24$HOUR"
|
||||
grib_check_key_equals $temp "-p $keys_s" "18$HOUR-24$HOUR 18$HOUR 24$HOUR"
|
||||
|
|
Loading…
Reference in New Issue