-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from ecmwf/feature/ECC-1537-TileTemplate
ECC-1537: Tile Template
- Loading branch information
Showing
11 changed files
with
347 additions
and
167 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
definitions/grib2/combinationOfAttributesOfTileConcept.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Concept combinationOfAttributesOfTile | ||
|
||
'UNMOD' = {attributeOfTile = [1];} | ||
'SNOW' = {attributeOfTile = [2];} | ||
'FLOOD' = {attributeOfTile = [3];} | ||
'ICE' = {attributeOfTile = [4];} | ||
'ITCW' = {attributeOfTile = [5];} | ||
'ITCS' = {attributeOfTile = [6];} | ||
'AGG' = {attributeOfTile = [7];} | ||
|
||
'SNOW_FLOOD' = {attributeOfTile = [2,3];} | ||
'SNOW_ICE' = {attributeOfTile = [2,4];} | ||
'SNOW_ITCW' = {attributeOfTile = [2,5];} | ||
'SNOW_ITCS' = {attributeOfTile = [2,6];} | ||
'FLOOD_ICE' = {attributeOfTile = [3,4];} | ||
'FLOOD_ITCW' = {attributeOfTile = [3,5];} | ||
'FLOOD_ITCS' = {attributeOfTile = [3,6];} | ||
'ICE_ITCW' = {attributeOfTile = [4,5];} | ||
'ICE_ITCS' = {attributeOfTile = [4,6];} | ||
'ITCW_ITCS' = {attributeOfTile = [5,6];} | ||
|
||
'SNOW_FLOOD_ICE' = {attributeOfTile = [2,3,4];} | ||
'SNOW_FLOOD_ITCW' = {attributeOfTile = [2,3,5];} | ||
'SNOW_FLOOD_ITCS' = {attributeOfTile = [2,3,6];} | ||
'SNOW_ICE_ITCW' = {attributeOfTile = [2,4,5];} | ||
'SNOW_ICE_ITCS' = {attributeOfTile = [2,4,6];} | ||
'SNOW_ITCW_ITCS' = {attributeOfTile = [2,5,6];} | ||
'FLOOD_ICE_ITCW' = {attributeOfTile = [3,4,5];} | ||
'FLOOD_ICE_ITCS' = {attributeOfTile = [3,4,6];} | ||
'FLOOD_ITCW_ITCS' = {attributeOfTile = [3,5,6];} | ||
'ICE_ITCW_ITCS' = {attributeOfTile = [4,5,6];} | ||
|
||
'SNOW_FLOOD_ICE_ITCW' = {attributeOfTile = [2,3,4,5];} | ||
'SNOW_FLOOD_ICE_ITCS' = {attributeOfTile = [2,3,4,6];} | ||
'SNOW_FLOOD_ITCW_ITCS' = {attributeOfTile = [2,3,5,6];} | ||
'SNOW_ICE_ITCW_ITCS' = {attributeOfTile = [2,4,5,6];} | ||
'FLOOD_ICE_ITCW_ITCS' = {attributeOfTile = [3,4,5,6];} | ||
|
||
'SNOW_FLOOD_ICE_ITCW_ITCS' = {attributeOfTile = [2,3,4,5,6];} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Code table 4.241 - Coverage attributes | ||
0 0 Undefined | ||
1 1 Unmodified | ||
2 2 Snow covered | ||
3 3 Flooded | ||
4 4 Ice covered | ||
5 5 With intercepted water | ||
6 6 With intercepted snow | ||
7 7 Aggregated | ||
0 UNDEF Undefined | ||
1 UNMOD Unmodified | ||
2 SNOW Snow covered | ||
3 FLOOD Flooded | ||
4 ICE Ice covered | ||
5 ITCW With intercepted water | ||
6 ITCS With intercepted snow | ||
7 AGG Aggregated | ||
# 8-191 Reserved | ||
# 192-254 Reserved for local use | ||
255 255 Missing value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Code table 4.242 - Tile classification | ||
0 0 Reserved | ||
1 1 Land use classes according to ESA-GlobCover GCV2009 | ||
2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 | ||
3 3 Land use classes according to ECOCLIMAP | ||
4 4 Land use classes according to ECOCLIMAP-SG | ||
5 5 Land use classes according to USGS EROS Global Land Cover Characterization (GLCC) v2.0 BATS Classification | ||
1 GCV2009 Land use classes according to ESA-GlobCover GCV2009 | ||
2 GLC2000 Land use classes according to European Commission-Global Land Cover Project GLC2000 | ||
3 ECOCLIMAP Land use classes according to ECOCLIMAP | ||
4 ECOCLIMAP-SG Land use classes according to ECOCLIMAP-SG | ||
5 GLCCv2BATS Land use classes according to USGS EROS Global Land Cover Characterization (GLCC) v2.0 BATS Classification | ||
# 6-191 Reserved | ||
# 192-254 Reserved for local use | ||
255 255 Missing value |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# (C) Copyright 2005- ECMWF. | ||
|
||
label "_WIP"; | ||
# TEMPLATE 4.113, Generalised tiles at a horizontal level or horizontal layer at a point in time | ||
|
||
include "grib2/template.4.parameter.def" | ||
include "grib2/template.4.generalised_tile.def" | ||
include "grib2/template.4.generating_process.def" | ||
include "grib2/template.4.forecast_time.def" | ||
include "grib2/template.4.point_in_time.def" | ||
include "grib2/template.4.horizontal.def" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# (C) Copyright 2005- ECMWF. | ||
|
||
label "_WIP"; | ||
# TEMPLATE 4.114, Average, accumulation, and/or extreme values or other statistically processed values on generalised tiles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval | ||
|
||
include "grib2/template.4.parameter.def" | ||
include "grib2/template.4.generalised_tile.def" | ||
include "grib2/template.4.generating_process.def" | ||
include "grib2/template.4.forecast_time.def" | ||
include "grib2/template.4.horizontal.def" | ||
include "grib2/template.4.statistical.def" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# (C) Copyright 2005- ECMWF. | ||
|
||
label "_WIP"; | ||
# TEMPLATE 4.115, Individual ensemble forecast, control and perturbed on generalised tiles at a horizontal level or in a horizontal layer at a point in time | ||
|
||
include "grib2/template.4.parameter.def" | ||
include "grib2/template.4.generalised_tile.def" | ||
include "grib2/template.4.generating_process.def" | ||
include "grib2/template.4.forecast_time.def" | ||
include "grib2/template.4.point_in_time.def" | ||
include "grib2/template.4.horizontal.def" | ||
include "grib2/template.4.leps.def" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# (C) Copyright 2005- ECMWF. | ||
|
||
label "_WIP"; | ||
# TEMPLATE 4.116, Individual ensemble forecast, control and perturbed on generalised tiles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval | ||
|
||
include "grib2/template.4.parameter.def" | ||
include "grib2/template.4.generalised_tile.def" | ||
include "grib2/template.4.generating_process.def" | ||
include "grib2/template.4.forecast_time.def" | ||
include "grib2/template.4.horizontal.def" | ||
include "grib2/template.4.leps.def" | ||
include "grib2/template.4.statistical.def" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# (C) Copyright 2005- ECMWF. | ||
|
||
# Generalised tile specifications | ||
codetable[1] tileClassification ('4.242.table',masterDir,localDir) : dump, string_type; | ||
codetable[2] typeOfTile ('4.252.table',masterDir,localDir) : dump, string_type; | ||
unsigned[1] numberOfUsedSpatialTiles=1 : dump; # Maximum number of tiles used in the entire grid | ||
unsigned[1] numberOfUsedTileAttributeCombinationsForTypeOfTile=1 : dump; # Number of tile attributes for a given tile in the gridbox | ||
unsigned[1] numberOfUsedTileAttributesForTileAttributeCombination=1 : dump; # Number of used attributes in a given combination | ||
listOfUsedTileAttributesInCombination list(numberOfUsedTileAttributesForTileAttributeCombination){ | ||
codetable[1] attributeOfTile ('4.241.table',masterDir,localDir) : dump; | ||
} | ||
unsigned[1] totalNumberOfTileAttributeCombinations=1 : dump; # Sum over all tile-attribute pairs over whole grid. >= 1 | ||
unsigned[1] tileIndex=1 : dump; # Local index of tile | ||
|
||
concept combinationOfAttributesOfTile (unknown,"combinationOfAttributesOfTileConcept.def",conceptsDir2,conceptsDir1): no_copy,dump; | ||
byte[16] uuidOfDataGroup : dump; # UUID of data group | ||
|
||
# Extract long name (title) + part in brackets (grouping) | ||
meta tileGrouping codetable_units(typeOfTile) : dump; | ||
meta tileName codetable_title(typeOfTile) : dump; | ||
|
||
alias uuid=uuidOfDataGroup; | ||
|
||
alias ls.tile=typeOfTile; | ||
alias ls.tileAttribute=combinationOfAttributesOfTile; | ||
|
||
alias tile.tileIndex=tileIndex; | ||
alias tile=typeOfTile; | ||
alias tile.tile=tile; | ||
alias tile.tileName=tileName; | ||
alias tileAttribute=combinationOfAttributesOfTile; | ||
alias tile.tileAttribute=tileAttribute; | ||
alias nTiles=numberOfUsedSpatialTiles; | ||
alias tile.nTiles=nTiles; | ||
alias totalTileAttCombo=totalNumberOfTileAttributeCombinations; | ||
alias tile.totalTileAttCombo=totalTileAttCombo; | ||
alias nTileAttCombo=numberOfUsedTileAttributeCombinationsForTypeOfTile; | ||
alias tile.nTileAttCombo=nTileAttCombo; | ||
alias nTileAtt=numberOfUsedTileAttributesForTileAttributeCombination; | ||
alias tile.nTileAtt=nTileAtt; | ||
|
||
alias mars.tile=typeOfTile; | ||
alias mars.tileAttribute=tileAttribute; | ||
transient paramtype = "tile"; | ||
alias mars.paramType=paramtype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/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 | ||
|
||
label="grib_generalised_tiles_test" | ||
temp_grib_a=temp.$label.a.grib | ||
temp_grib_b=temp2.$label.b.grib | ||
temp_dump=temp.$label.dump | ||
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl | ||
|
||
latest=`${tools_dir}/grib_get -p tablesVersionLatest $sample_grib2` | ||
|
||
${tools_dir}/grib_set -s productDefinitionTemplateNumber=113,tablesVersion=$latest ${sample_grib2} ${temp_grib_a} | ||
|
||
# Check tile related keys are present | ||
|
||
grib_check_key_exists ${temp_grib_a} tileClassification,typeOfTile,numberOfUsedSpatialTiles,numberOfUsedTileAttributeCombinationsForTypeOfTile | ||
|
||
grib_check_key_exists ${temp_grib_a} numberOfUsedTileAttributesForTileAttributeCombination,attributeOfTile,totalNumberOfTileAttributeCombinations | ||
|
||
grib_check_key_exists ${temp_grib_a} tileIndex,uuidOfDataGroup | ||
|
||
# Check list is working correctly and that associated concept is working correctly | ||
|
||
echo 'set numberOfUsedTileAttributesForTileAttributeCombination=2; set attributeOfTile={2, 4}; write;' | ${tools_dir}/grib_filter -o ${temp_grib_b} - ${temp_grib_a} | ||
output=$(echo 'print "[attributeOfTile]";' | ${tools_dir}/grib_filter - ${temp_grib_b}) | ||
[ "$output" = "2 4" ] | ||
[ "$(${tools_dir}/grib_get -p tileAttribute ${temp_grib_b})" = "SNOW_ICE" ] | ||
|
||
# Check template is being picked up correctly | ||
|
||
${tools_dir}/grib_dump -O -p section_4 $temp_grib_a > $temp_dump | ||
grep -q "Generalised 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=$latest ${sample_grib2} ${temp_grib_a} | ||
|
||
grib_check_key_exists ${temp_grib_a} typeOfTile,typeOfStatisticalProcessing | ||
|
||
# Check Ensemble template also works | ||
|
||
${tools_dir}/grib_set -s productDefinitionTemplateNumber=115,tablesVersion=$latest ${sample_grib2} ${temp_grib_a} | ||
|
||
grib_check_key_exists ${temp_grib_a} typeOfTile,perturbationNumber | ||
|
||
# Check Ensemble StatisticalProcessing template also works | ||
|
||
${tools_dir}/grib_set -s productDefinitionTemplateNumber=116,tablesVersion=$latest ${sample_grib2} ${temp_grib_a} | ||
|
||
grib_check_key_exists ${temp_grib_a} typeOfTile,perturbationNumber,typeOfStatisticalProcessing | ||
|
||
# Clean up | ||
rm -f $temp_grib_a $temp_grib_b $temp_dump |