From 7698634773cdb5b3259b14574fee2a1bb70fb9b8 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 17 Mar 2021 21:23:41 +0000 Subject: [PATCH] Testing: GRIB2 chemical and aerosol PDT selection --- tests/CMakeLists.txt | 1 + tests/grib2_chemicals_aerosols.sh | 50 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100755 tests/grib2_chemicals_aerosols.sh diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0e371b958..e442182c1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -180,6 +180,7 @@ if( HAVE_BUILD_TOOLS ) grib1to3 grib2to3 grib2_templates + grib2_chemicals_aerosols grib3_templates grib_bad grib_ls diff --git a/tests/grib2_chemicals_aerosols.sh b/tests/grib2_chemicals_aerosols.sh new file mode 100755 index 000000000..a82c456cc --- /dev/null +++ b/tests/grib2_chemicals_aerosols.sh @@ -0,0 +1,50 @@ +#!/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-1224-test" +temp=temp.$label +sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +latest=`${tools_dir}/grib_get -p tablesVersionLatest $sample2` + +# CHEMICALS +# ----------- +# Plain chemicals +${tools_dir}/grib_set -s tablesVersion=$latest,is_chemical=1 $sample2 $temp +grib_check_key_equals $temp productDefinitionTemplateNumber '40' +grib_check_key_equals $temp constituentType '0' + +# Chemicals with source and sink +${tools_dir}/grib_set -s tablesVersion=$latest,is_chemical_srcsink=1 $sample2 $temp +grib_check_key_equals $temp productDefinitionTemplateNumber '76' +grib_check_key_equals $temp constituentType,sourceSinkChemicalPhysicalProcess '0 255' + +# Chemicals with distribution function +${tools_dir}/grib_set -s tablesVersion=$latest,is_chemical_distfn=1 $sample2 $temp +grib_check_key_equals $temp productDefinitionTemplateNumber '57' +grib_check_key_equals $temp constituentType,numberOfModeOfDistribution,modeNumber '0 0 0' + +# AEROSOLS +# ---------- +# Plain aerosols +${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol=1 $sample2 $temp +grib_check_key_equals $temp productDefinitionTemplateNumber '48' +grib_check_key_equals $temp aerosolType,typeOfSizeInterval,typeOfWavelengthInterval '0 0 0' + +# Aerosol optical +${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol_optical=1 $sample2 $temp +grib_check_key_equals $temp productDefinitionTemplateNumber '48' +#${tools_dir}/grib_dump -O $temp + + +rm -f $temp