13
13
REDIRECT=/dev/null
14
14
15
15
label=" grib_ecc-1806_test"
16
- tempGribA=temp.$label .1.grib
17
- tempGribB=temp.$label .2.grib
18
- tempFilt=temp.$label .filt
16
+ tempGrib1=temp.$label .1.grib
17
+ tempGrib2=temp.$label .2.grib
19
18
tempLog=temp.$label .log
20
- tempRef=temp.$label .ref
21
19
22
20
sample_grib1=$ECCODES_SAMPLES_PATH /GRIB1.tmpl
23
21
sample_grib2=$ECCODES_SAMPLES_PATH /GRIB2.tmpl
@@ -27,21 +25,42 @@ test_conversion()
27
25
param1=$1 # old paramId in GRIB1
28
26
param2=$2 # new paramId in GRIB2
29
27
short=$3 # new shortName
30
- ${tools_dir} /grib_set -s paramId=$param1 ,edition=2 $sample_grib1 $tempGribA
31
- grib_check_key_equals $tempGribA paramId,shortName " $param2 $short "
32
28
33
- # The old paramId has been removed from GRIB2
29
+ ${tools_dir} /grib_set -s paramId=$param1 $sample_grib1 $tempGrib1
30
+
34
31
set +e
35
- ${tools_dir} /grib_set -s paramId= $param1 $sample_grib2 $tempGribA 2> $REDIRECT
32
+ ${tools_dir} /grib_set -s edition=2 $tempGrib1 $tempGrib2 2> $REDIRECT
36
33
status=$?
37
34
set -e
38
- [ $status -ne 0 ]
35
+ if [ $status -ne 0 ]; then
36
+ ${tools_dir} /grib_set -s stepType=avg,edition=2 $tempGrib1 $tempGrib2
37
+ fi
38
+ grib_check_key_equals $tempGrib2 paramId,shortName " $param2 $short "
39
39
40
+ # Check the old paramId has been removed from GRIB2
41
+ set +e
42
+ ${tools_dir} /grib_set -s paramId=$param1 $sample_grib2 $tempGrib2 > $tempLog 2>&1
43
+ status=$?
44
+ set -e
45
+ [ $status -ne 0 ]
46
+ grep -q " no match for paramId" $tempLog
40
47
}
41
48
42
49
test_conversion 174098 262000 sithick
43
50
test_conversion 151163 262104 t20d
44
51
test_conversion 151145 262124 zos
52
+ test_conversion 130232 235135 mw
53
+ test_conversion 172146 235033 msshf
54
+ test_conversion 172147 235034 mslhf
55
+ test_conversion 55 228004 mean2t
56
+ test_conversion 56 235168 m2d
57
+ test_conversion 172169 235035 msdwswrf
58
+ test_conversion 172175 235036 msdwlwrf
59
+ test_conversion 172176 235037 msnswrf
60
+ test_conversion 172177 235038 msnlwrf
61
+ test_conversion 172178 235039 mtnswrf
62
+ test_conversion 172179 235040 mtnlwrf
63
+
45
64
46
65
# Clean up
47
- rm -f $tempGribA $tempGribB $tempFilt $ tempLog $tempRef
66
+ rm -f $tempGrib1 $tempGrib2 $ tempLog
0 commit comments