mirror of https://github.com/ecmwf/eccodes.git
ECC-1620: add future behaviour: export ECCODES_FUTURE_BEHAVIOUR=1
This commit is contained in:
parent
1b05e40302
commit
8c7286d096
|
@ -191,8 +191,14 @@ std::string Step::value<std::string>(const std::string& format) const {
|
|||
//
|
||||
// TODO(maee): Remove this code to enable future output, e.g., 15h.
|
||||
|
||||
if (unit_ != Unit::Value::HOUR)
|
||||
int future_behaviour = getenv("ECCODES_FUTURE_BEHAVIOUR") ? atoi(getenv("ECCODES_FUTURE_BEHAVIOUR")) : 0;
|
||||
if (future_behaviour != 1) {
|
||||
if (unit_ != Unit::Value::HOUR)
|
||||
u = unit_.value<std::string>();
|
||||
}
|
||||
else {
|
||||
u = unit_.value<std::string>();
|
||||
}
|
||||
|
||||
if (unit_ == Unit::Value::MINUTES15 ||
|
||||
unit_ == Unit::Value::MINUTES30 ||
|
||||
|
|
|
@ -40,6 +40,8 @@ grib_check_key_equals()
|
|||
fi
|
||||
}
|
||||
|
||||
[[ -z "${ECCODES_FUTURE_BEHAVIOUR}" ]] && HOUR="" || HOUR="h"
|
||||
|
||||
label="grib_ecc-1620"
|
||||
temp=temp.$label
|
||||
temp2=temp_2.$label
|
||||
|
@ -61,15 +63,16 @@ keys_d="step:d,stepUnits:s"
|
|||
|
||||
${tools_dir}/grib_set -s stepunits=m,step=60 $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1"
|
||||
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"
|
||||
|
||||
|
||||
|
@ -83,15 +86,15 @@ keys_d="step:d,startStep:d,endStep:d,stepRange:d,stepUnits:s"
|
|||
|
||||
${tools_dir}/grib_set -s stepunits=m,stepRange=60-120 $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "2 1 2 1-2 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"
|
||||
${tools_dir}/grib_set -s stepUnits=m,stepRange=60-120 $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 60 m"
|
||||
grib_check_key_equals $temp "-p $keys_s" "2 1 2 1-2 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"
|
||||
${tools_dir}/grib_set -s stepRange=60m-120m $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1 h 1 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "2 1 2 1-2 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"
|
||||
|
||||
|
||||
|
@ -114,7 +117,7 @@ grib_check_key_equals $temp " -w count=1 -s stepUnits=s -p step,stepUnits:s" "34
|
|||
grib_check_key_equals $temp " -w count=1 -s stepUnits=m -p step,stepUnits:s" "5760m m"
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=15m -p step,stepUnits:s" "384x15m 15m"
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=30m -p step,stepUnits:s" "192x30m 30m"
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=h -p step,stepUnits:s" "96 h"
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=h -p step,stepUnits:s" "96$HOUR h"
|
||||
grib_check_key_equals $temp " -w count=1 -s stepUnits=6h -p step,stepUnits:s" "16x6h 6h"
|
||||
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"
|
||||
|
@ -139,12 +142,12 @@ low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indi
|
|||
${tools_dir}/grib_set -s forecastTime=-6,indicatorOfUnitOfTimeRange=h,lengthOfTimeRange=6,indicatorOfUnitForTimeRange=h $fn $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 0"
|
||||
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
|
||||
grib_check_key_equals $temp "-p stepRange" "-48"
|
||||
grib_check_key_equals $temp "-p stepRange" "-48$HOUR"
|
||||
|
||||
|
||||
#### CHECK: check optimal units are set correctly in GRIB files
|
||||
|
@ -237,15 +240,15 @@ grib_check_key_equals $temp2 "-p $low_level_keys" "2 h 46 h"
|
|||
|
||||
${tools_dir}/grib_set -s stepRange:s=5h-30h $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "5 h 25 h"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "5-30"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "5$HOUR-30$HOUR"
|
||||
|
||||
${tools_dir}/grib_set -s stepRange:s=5-30 $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "5 h 25 h"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "5-30"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "5$HOUR-30$HOUR"
|
||||
|
||||
${tools_dir}/grib_set -s stepRange:s=60m-120m $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "1 h 1 h"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "1-2"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "1$HOUR-2$HOUR"
|
||||
|
||||
${tools_dir}/grib_set -s stepRange:s=60s-120s $temp $temp2
|
||||
grib_check_key_equals $temp2 "-p $low_level_keys" "1 m 1 m"
|
||||
|
@ -257,7 +260,7 @@ grib_check_key_equals $temp2 "-p stepRange:s" "60m-121m"
|
|||
|
||||
${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-2928"
|
||||
grib_check_key_equals $temp2 "-p stepRange:s" "1488$HOUR-2928$HOUR"
|
||||
|
||||
fn="$instantaneous_field"
|
||||
low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s"
|
||||
|
@ -309,10 +312,10 @@ grib_check_key_equals $temp "-p $keys_d" "0 m"
|
|||
|
||||
grib_check_key_equals $temp "-p $keys__ -s stepUnits=s" "0s s"
|
||||
grib_check_key_equals $temp "-p $keys__ -s stepUnits=m" "0m m"
|
||||
grib_check_key_equals $temp "-p $keys__ -s stepUnits=h" "0 h"
|
||||
grib_check_key_equals $temp "-p $keys__ -s stepUnits=h" "0$HOUR h"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=s" "0s s"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=m" "0m m"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=h" "0 h"
|
||||
grib_check_key_equals $temp "-p $keys_s -s stepUnits=h" "0$HOUR h"
|
||||
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"
|
||||
|
@ -331,8 +334,8 @@ grib_check_key_equals $temp "-p $keys_d" "59 m"
|
|||
|
||||
${tools_dir}/grib_set -s forecastTime=60,indicatorOfUnitOfTimeRange=m $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "1 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1 h"
|
||||
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"
|
||||
|
||||
|
@ -346,15 +349,15 @@ grib_check_key_equals $temp "-p $keys_d" "61 m"
|
|||
|
||||
${tools_dir}/grib_set -s forecastTime=24,indicatorOfUnitOfTimeRange=h $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "24 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "24 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1440 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "24 h"
|
||||
grib_check_key_equals $temp "-p $keys_s" "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"
|
||||
|
||||
|
@ -374,23 +377,22 @@ keys_d="stepRange:d,startStep:d,endStep:d"
|
|||
|
||||
${tools_dir}/grib_set -s forecastTime=0,indicatorOfUnitOfTimeRange=m,lengthOfTimeRange=2,indicatorOfUnitForTimeRange=h $fn $temp
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "0 m 2 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "0-2 0 2"
|
||||
grib_check_key_equals $temp "-p $keys_s" "0-2 0 2"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "24 h 1 D"
|
||||
grib_check_key_equals $temp "-p $keys__" "24-48 24 48"
|
||||
grib_check_key_equals $temp "-p $keys_s" "24-48 24 48"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "25 h 1 D"
|
||||
grib_check_key_equals $temp "-p $keys__" "25-49 25 49"
|
||||
grib_check_key_equals $temp "-p $keys__" "25-49 25 49"
|
||||
grib_check_key_equals $temp "-p $keys_s" "25-49 25 49"
|
||||
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"
|
||||
|
||||
|
@ -404,29 +406,29 @@ 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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "60 m 2 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "1-3 1 3"
|
||||
grib_check_key_equals $temp "-p $keys_s" "1-3 1 3"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "18 h 6 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "18-24 18 24"
|
||||
grib_check_key_equals $temp "-p $keys_s" "18-24 18 24"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1080 m 360 m"
|
||||
grib_check_key_equals $temp "-p $keys__" "18-24 18 24"
|
||||
grib_check_key_equals $temp "-p $keys_s" "18-24 18 24"
|
||||
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
|
||||
grib_check_key_equals $temp "-p $low_level_keys" "1080 m 6 h"
|
||||
grib_check_key_equals $temp "-p $keys__" "18-24 18 24"
|
||||
grib_check_key_equals $temp "-p $keys_s" "18-24 18 24"
|
||||
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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue