Skip to content

Commit cb4f057

Browse files
committed
ECC-1813: Test accumulated fields
1 parent 57bfc52 commit cb4f057

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

tests/grib_sub_hourly.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,23 @@ instantaneous_field=$data_dir/reduced_gaussian_surface.grib2
6363
accumulated_field=$data_dir/reduced_gaussian_sub_area.grib2
6464

6565

66+
fn="$instantaneous_field"
67+
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
68+
${tools_dir}/grib_set -s stepUnits=m,step=60 $fn $temp
69+
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
70+
${tools_dir}/grib_set -s stepUnits=s $temp $temp2
71+
grib_check_key_equals $temp2 "-p $low_level_keys" "3600 s"
72+
${tools_dir}/grib_set -s stepUnits=h $temp $temp2
73+
grib_check_key_equals $temp2 "-p $low_level_keys" "1 h"
6674

75+
fn="$accumulated_field"
76+
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s"
77+
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-180 $fn $temp
78+
grib_check_key_equals $temp "-p $low_level_keys" "60 m 120 m"
79+
${tools_dir}/grib_set -s stepUnits=s $temp $temp2
80+
grib_check_key_equals $temp2 "-p $low_level_keys" "3600 s 7200 s"
81+
${tools_dir}/grib_set -s stepUnits=h $temp $temp2
82+
grib_check_key_equals $temp2 "-p $low_level_keys" "1 h 2 h"
6783

6884
# Check the lowercase alias 'stepunits' for a variety of step types (instant, accum etc)
6985
${tools_dir}/grib_get -p stepunits $data_dir/tigge_cf_ecmwf.grib2
@@ -92,13 +108,6 @@ grib_check_key_equals $temp "-p $keys_step_range" "59m 59m 59 59 m"
92108
grib_check_key_equals $temp "-p $keys_start_step" "59m 59m 59 59 m"
93109
grib_check_key_equals $temp "-p $keys_end_step" "59m 59m 59 59 m"
94110

95-
${tools_dir}/grib_set -s stepUnits=m,step=60 $fn $temp
96-
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
97-
${tools_dir}/grib_set -s stepUnits=s $temp $temp2
98-
grib_check_key_equals $temp2 "-p $low_level_keys" "3600 s"
99-
${tools_dir}/grib_set -s stepUnits=h $temp $temp2
100-
grib_check_key_equals $temp2 "-p $low_level_keys" "1 h"
101-
102111
#### stepUnits overrides the units in the low level keys
103112
# if stepUnits=UNIT is set, then set the low level keys to UNIT
104113
# else optimise low level keys

0 commit comments

Comments
 (0)