Added full functionality to grib tile test to check all aspects of tile template.

This commit is contained in:
Matthew Griffith 2023-03-07 09:39:06 +00:00
parent 1a03903937
commit 68f06e373c
1 changed files with 27 additions and 5 deletions

View File

@ -13,15 +13,37 @@ set -u
REDIRECT=/dev/null
label="grib_generalised_tiles_test"
temp_grib=temp.$label.grib
temp_text=temp.$label.text
temp2_grib=temp2.$label.grib
temp_dump=temp.$label.dump
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -s productDefinitionTemplateNumber=113,tablesVersion=30 ${sample_grib2} ${temp_grib}
grib_check_key_equals ${temp_grib} tileIndex,totalNumberOfTileAttributeCombinations "1 1"
# Check tile related keys are present
${tools_dir}/grib_dump -O -p section_4 $temp_grib > $temp_text
grep -q "Generalised spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time" $temp_text
grib_check_key_exists ${temp_grib} tileClassification,typeOfTile,numberOfUsedSpatialTiles,numberOfUsedTileAttributeCombinationsForTypeOfTile
grib_check_key_exists ${temp_grib} numberOfUsedTileAttributesForTileAttributeCombination,attributeOfTile,totalNumberOfTileAttributeCombinations
grib_check_key_exists ${temp_grib} tileIndex,uuidOfDataGroup
# Check list is working correctly and that associated concept is working correctly
echo 'set numberOfUsedTileAttributesForTileAttributeCombination=2; set attributeOfTile={2, 4}; write;' | grib_filter - ${temp_grib} -o ${temp2_grib}
output=$(echo 'print "[attributeOfTile]";' | grib_filter - ${temp2_grib})
[ "$output" == "2 4" ]
[ "$(grib_get -p tileAttribute ${temp2_grib})" == "SNOW_ICE" ]
# Check template is being picked up correctly
${tools_dir}/grib_dump -O -p section_4 $temp_grib > $temp_dump
grep -q "Generalised spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time" $temp_dump
# Check StatisticalProcessing template also works
${tools_dir}/grib_set -s productDefinitionTemplateNumber=114,tablesVersion=30 ${sample_grib2} ${temp_grib}
grib_check_key_exists ${temp_grib} typeOfTile,typeOfStatisticalProcessing
#...
#infile=${data_dir}/SOME_FILE
@ -32,4 +54,4 @@ grep -q "Generalised spatio-temporal changing tiles at a horizontal level or hor
#${tools_dir}/bufr_set
#...
rm -f $temp_grib $temp_text
rm -f $temp_grib $temp2_grib $temp_dump