eccodes/tests/grib_ecc-1319.sh

87 lines
2.0 KiB
Bash
Raw Normal View History

2021-12-15 17:41:09 +00:00
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
2021-12-15 17:41:09 +00:00
2022-06-06 14:41:18 +00:00
label="grib_ecc-1319_test"
2021-12-15 17:41:09 +00:00
temp=temp.$label.grib
temp1=temp1.$label.grib
temp2=temp2.$label.grib
2021-12-15 17:41:09 +00:00
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
2022-01-27 14:55:30 +00:00
typeOfLevels="
2021-12-15 17:41:09 +00:00
surface
tropopause
nominalTop
mostUnstableParcel
mixedLayerParcel
isobaricInPa
isobaricInhPa
isobaricLayer
meanSea
heightAboveGround
heightAboveGroundLayer
hybrid
hybridHeight
hybridLayer
depthBelowLand
depthBelowLandLayer
theta
thetaLayer
potentialVorticity
soil
soilLayer
entireAtmosphere
entireOcean
snow
snowLayer
seaIce
seaIceLayer"
ok_levtypes="hhl ml o2d pl pt pv sfc sol"
check_levtype()
{
2022-01-27 14:55:30 +00:00
_arg=$1
result=1
for n in $ok_levtypes; do
if [ "$_arg" = "$n" ]; then result=0; break; fi
done
return $result
2021-12-15 17:41:09 +00:00
}
2022-01-27 14:55:30 +00:00
for a_typeOfLevel in $typeOfLevels; do
${tools_dir}/grib_set -s tablesVersion=27,typeOfLevel=$a_typeOfLevel $sample_grib2 $temp
levtype=`${tools_dir}/grib_get -p mars.levtype $temp`
check_levtype $levtype
2021-12-15 17:41:09 +00:00
done
2022-01-27 16:44:24 +00:00
# Also check specific cases
# --------------------------
# 260649 = Sea ice surface temperature (UERRA)
${tools_dir}/grib_set -s productionStatusOfProcessedData=8 $sample_grib2 $temp1
${tools_dir}/grib_set -s paramId=260649 $temp1 $temp2
grib_check_key_equals $temp2 levtype sfc
# 260650 = Snow on ice total depth (UERRA)
${tools_dir}/grib_set -s paramId=260650 $temp1 $temp2
grib_check_key_equals $temp2 levtype sfc
2022-01-27 16:44:24 +00:00
# Lake ice surface temperature
${tools_dir}/grib_set -s paramId=228013 $sample_grib2 $temp
grib_check_key_equals $temp levtype sfc
# Lake ice total depth
${tools_dir}/grib_set -s paramId=228014 $sample_grib2 $temp
grib_check_key_equals $temp levtype sfc
2021-12-15 17:41:09 +00:00
rm -f $temp $temp1 $temp2