Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions definitions/grib2/local.destine.on-demand-extremes-dt.def
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@

ascii[8] georef = "s0000000" : dump ;
alias mars.georef = georef;

# ECC-2222: We want model in on-demand-extremes-dt
# Concept and aliasing into mars namespace must be done post metadata
# otherwise the metadata for the modelName are not yet defined since
# they come in Section 4
# Thus we use logic in post_meta_data.hook for productionstatus 12/13
20 changes: 2 additions & 18 deletions definitions/grib2/post_meta_data.hook.products_12.def
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# (C) Copyright 2005- ECMWF.
# Hooks post meta-data for DestinE (productionStatusOfProcessedData=12)

# conceptsDir2 --> datasetForLocal
concept gridSpecification(unknown, "gridSpecificationConcept.def", conceptsDir2, conceptsDir1): no_copy, read_only, dump;
concept destineOrigin(unknown, "destineOriginConcept.def", conceptsDir2, conceptsDir1): no_copy, dump;

# ECC-1794: DestinE data does not have the domain key
unalias mars.domain;

# ECC-1796: stepRange indexing for DestinE ExtremesDT and On-Demand ExtremesDT data
# ECC-2161: only for pre-MTG2 data
if ( defined(dataset) && dataset isnot "climate-dt" && MTG2Switch == 0 ) {
alias mars.step=stepRange;
}
# Hooks post meta-data for DestinE (productionStatusOfProcessedData=12)

# ECC-2161: We want timespan by default
# Timespan key comes after stream.type.def in section 4 and so we need to unalias it here for climate-dt
if ( defined(dataset) && dataset is "climate-dt" ) {
unalias mars.timespan;
}
include "grib2/post_meta_data.hook.products_destine.def"
20 changes: 2 additions & 18 deletions definitions/grib2/post_meta_data.hook.products_13.def
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# (C) Copyright 2005- ECMWF.
# Hooks post meta-data for DestinE test (productionStatusOfProcessedData=13)

# conceptsDir2 --> datasetForLocal
concept gridSpecification(unknown, "gridSpecificationConcept.def", conceptsDir2, conceptsDir1): no_copy, read_only, dump;
concept destineOrigin(unknown, "destineOriginConcept.def", conceptsDir2, conceptsDir1): no_copy, dump;

# ECC-1794: DestinE data does not have the domain key
unalias mars.domain;

# ECC-1796: stepRange indexing for DestinE ExtremesDT and On-Demand ExtremesDT data
# ECC-2161: only for pre-MTG2 data
if ( defined(dataset) && dataset isnot "climate-dt" && MTG2Switch == 0 ) {
alias mars.step=stepRange;
}
# Hooks post meta-data for DestinE test (productionStatusOfProcessedData=13)

# ECC-2161: We want timespan by default
# Timespan key comes after stream.type.def in section 4 and so we need to unalias it here for climate-dt
if ( defined(dataset) && dataset is "climate-dt" ) {
unalias mars.timespan;
}
include "grib2/post_meta_data.hook.products_destine.def"
33 changes: 33 additions & 0 deletions definitions/grib2/post_meta_data.hook.products_destine.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# (C) Copyright 2005- ECMWF.

# Hooks post meta-data for DestinE (productionStatusOfProcessedData=12)

# conceptsDir2 --> datasetForLocal
concept gridSpecification(unknown, "gridSpecificationConcept.def", conceptsDir2, conceptsDir1): no_copy, read_only, dump;
concept destineOrigin(unknown, "destineOriginConcept.def", conceptsDir2, conceptsDir1): no_copy, dump;

# ECC-1794: DestinE data does not have the domain key
unalias mars.domain;

# ECC-1796: stepRange indexing for DestinE ExtremesDT and On-Demand ExtremesDT data
# ECC-2161: only for pre-MTG2 data
if ( defined(dataset) && dataset isnot "climate-dt" && MTG2Switch == 0 ) {
alias mars.step=stepRange;
}

# ECC-2161: We want timespan by default
# Timespan key comes after stream.type.def in section 4 and so we need to unalias it here for climate-dt
if ( defined(dataset) && dataset is "climate-dt" ) {
unalias mars.timespan;
}

# ECC-2222: We want model in on-demand-extremes-dt
if ( defined(dataset) && dataset is "on-demand-extremes-dt" ) {
concept modelName(unknown, "modelNameConcept.def", conceptsDir2, conceptsLocalDirAll): no_copy, dump;
if (modelName isnot "unknown") {
concept modelVersion(unknown, "modelVersionConcept.[modelName].def", conceptsDir2, conceptsLocalDirAll): no_copy, dump, read_only;
alias ls.model = modelName;
alias mars.model = modelName;

}
}
10 changes: 7 additions & 3 deletions tests/grib_destine_mars_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
tablesVersionLatest=$( ${tools_dir}/grib_get -p tablesVersionLatest $sample_grib2 )

# Setup Destine pseudo-centre GRIB message
# !!!!!!
# This ensures the dataset key is created which is needed for subsequent logic based on its value
# !!!!!!
# First latest tables version and add local section with MARS labeling
${tools_dir}/grib_set -s tablesVersion=$tablesVersionLatest,setLocalDefinition=1,grib2LocalSectionNumber=1 $sample_grib2 $temp_grib_a

Expand Down Expand Up @@ -101,14 +104,15 @@ ${tools_dir}/grib_compare -b productionStatusOfProcessedData $sample_grib2 $temp
# Check setting dataset to on-demand-extremes-dt (4). Check keys are present and equal defaults
${tools_dir}/grib_set -s dataset=4 $destine_sample $temp_grib_a

grib_check_key_exists $temp_grib_a dataset,georef
grib_check_key_equals $temp_grib_a "dataset,dataset:s,georef,mars.georef" "4 on-demand-extremes-dt s0000000 s0000000"
grib_check_key_exists $temp_grib_a dataset,georef,model
grib_check_key_equals $temp_grib_a "dataset,dataset:s,georef,mars.georef,model,mars.model" "4 on-demand-extremes-dt s0000000 s0000000 IFS IFS"

# Check an example where a few additional things are set in on-demand-extremes-dt

${tools_dir}/grib_set -s dataset=4,georef=gcpkd2eu $destine_sample $temp_grib_a
${tools_dir}/grib_set -s dataset=4,georef=gcpkd2eu,model=HARMONIE-AROME $destine_sample $temp_grib_a

grib_check_key_equals $temp_grib_a "georef" "gcpkd2eu"
grib_check_key_equals $temp_grib_a "model" "HARMONIE-AROME"

# ECC-2161: We replace mars.step=stepRange with mars.step=endStep (default) and mars.timespan
# in extremes-dt. We continue to unalias timespan in climate-dt streams clte/clmn (checked above)
Expand Down
12 changes: 9 additions & 3 deletions tests/grib_destine_test_mars_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
tablesVersionLatest=$( ${tools_dir}/grib_get -p tablesVersionLatest $sample_grib2 )

# Setup Destine pseudo-centre GRIB message
# !!!!!!
# This ensures the dataset key is created which is needed for subsequent logic based on its value
# !!!!!!
# First latest tables version and add local section with MARS labeling
${tools_dir}/grib_set -s tablesVersion=$tablesVersionLatest,setLocalDefinition=1,grib2LocalSectionNumber=1 $sample_grib2 $temp_grib_a

Expand Down Expand Up @@ -101,14 +104,17 @@ ${tools_dir}/grib_compare -b productionStatusOfProcessedData $sample_grib2 $temp
# Check setting dataset to on-demand-extremes-dt (4). Check keys are present and equal defaults
${tools_dir}/grib_set -s dataset=4 $destine_sample $temp_grib_a

grib_check_key_exists $temp_grib_a dataset,georef
grib_check_key_equals $temp_grib_a "dataset,dataset:s,georef,mars.georef" "4 on-demand-extremes-dt s0000000 s0000000"
grib_check_key_exists $temp_grib_a dataset,georef,model
grib_check_key_equals $temp_grib_a "dataset,dataset:s,georef,mars.georef,model,mars.model" "4 on-demand-extremes-dt s0000000 s0000000 IFS IFS"

# Check an example where a few additional things are set in on-demand-extremes-dt

${tools_dir}/grib_set -s dataset=4,georef=gcpkd2eu $destine_sample $temp_grib_a

${tools_dir}/grib_set -s dataset=4,georef=gcpkd2eu,model=HARMONIE-AROME $destine_sample $temp_grib_a

grib_check_key_equals $temp_grib_a "georef" "gcpkd2eu"
grib_check_key_equals $temp_grib_a "model" "HARMONIE-AROME"


# ECC-2161: We replace mars.step=stepRange with mars.step=endStep (default) and mars.timespan
# in extremes-dt. We continue to unalias timespan in climate-dt streams clte/clmn (checked above)
Expand Down
Loading