#!/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.sh set -u label="grib_ecc-1319-test" temp=temp.$label.grib sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl typeOfLevels=" 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() { _arg=$1 result=1 for n in $ok_levtypes; do if [ "$_arg" = "$n" ]; then result=0; break; fi done return $result } 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 done # Also check specific cases # -------------------------- # Sea ice surface temperature ${tools_dir}/grib_set -s paramId=260649 $sample_grib2 $temp grib_check_key_equals $temp levtype o2d # Snow on ice total depth ${tools_dir}/grib_set -s paramId=260650 $sample_grib2 $temp grib_check_key_equals $temp levtype o2d # 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 rm -f $temp