Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ECC-1691 destinE climateDT #169

Merged
merged 61 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
debc4b6
Added necessary local definition files to support new keys for Destin…
mjg41 Aug 10, 2023
d18cc08
Added definitions of d1 and d2, destine and destine test where they a…
mjg41 Aug 10, 2023
0f1ba8f
Merge branch 'ecmwf:develop' into feature/destine-layout
mjg41 Aug 10, 2023
47d3667
Merge branch 'ecmwf:develop' into feature/destine-layout
mjg41 Aug 11, 2023
a25977a
Work to add additional concepts for DE layout
mjg41 Sep 1, 2023
ee5aa4e
Merge branch 'feature/destine-layout' of github.com:mjg41/eccodes int…
mjg41 Sep 1, 2023
a7b9fc1
Missed file
mjg41 Sep 1, 2023
4277509
Merge remote-tracking branch 'origin/develop' into feature/destine-la…
mjg41 Sep 1, 2023
0afe8de
Changed to using dataset specific def file;
mjg41 Sep 4, 2023
2f7c58a
Clean up and fixing bugs
mjg41 Sep 13, 2023
fbc4d3a
Merge commit '7e78533dfe9a6cf6e0c2e98dadcf6482493ff3fb' into feature/…
mjg41 Sep 13, 2023
e818053
Bugs fixed!
mjg41 Sep 13, 2023
033a60d
New table entries and definition for ODEDT
mjg41 Sep 14, 2023
df615ca
Added some grids to the gridSpecification
mjg41 Sep 15, 2023
e8f1a3f
Make grid_spec read_only;
mjg41 Sep 19, 2023
c8445bb
Merge branch 'ecmwf:develop' into feature/destine-layout
mjg41 Sep 20, 2023
6c693fb
Remove reference to d2;
mjg41 Sep 21, 2023
1357d24
Merge branch 'feature/destine-layout' of github.com:mjg41/eccodes int…
mjg41 Sep 21, 2023
f11d305
Preparation for develop;
mjg41 Sep 21, 2023
172f1ed
Moved model to climateDT only;
mjg41 Sep 21, 2023
d145099
ECC-1691: Commit to link branch to JIRA ticket
mjg41 Sep 21, 2023
c3b9767
Missed quotation
mjg41 Sep 21, 2023
9cf3ebe
Merge branch 'ecmwf:develop' into feature/destine-layout
mjg41 Sep 21, 2023
4df1188
Reworking to accommodate PR comment;
mjg41 Sep 25, 2023
2dd5e69
Merge branch 'feature/destine-layout' of github.com:mjg41/eccodes int…
mjg41 Sep 25, 2023
0d2f802
Merge branch 'feature/destine-layout' of github.com:mjg41/eccodes int…
mjg41 Sep 25, 2023
a0af146
Merge branch 'ecmwf:develop' into feature/destine-layout
mjg41 Sep 25, 2023
3dc564b
Merge commit '2dd5e69c302ebc5bc9800b22a3b7c25cd19efd44' into feature/…
mjg41 Sep 25, 2023
b92f0d0
Merge branch 'feature/destine-layout' of github.com:mjg41/eccodes int…
mjg41 Sep 25, 2023
e0d45c7
Merge pull request #162 from mjg41/feature/destine-layout
shahramn Sep 26, 2023
98659cc
ECC-1691: Tests
shahramn Sep 27, 2023
6554d0b
ECC-1691: Fix test re mars.step
shahramn Sep 27, 2023
91c2fdc
Merge branch 'develop' into feature/ECC-1691-DestineClimateDT
shahramn Sep 27, 2023
8f84ece
ECC-1691: Additional modifications from Matthew
shahramn Sep 27, 2023
fd7ea99
ECC-1691: Formatting
shahramn Sep 28, 2023
2bbf810
Merge branch 'develop' into feature/ECC-1691-DestineClimateDT
shahramn Sep 29, 2023
3f437f7
ECC-1691: Updates from Matt
shahramn Sep 29, 2023
dc90679
Added medium resolution to code table
mjg41 Oct 9, 2023
17cb981
Merge branch 'develop' into feature/ECC-1691-DestineClimateDT
shahramn Oct 9, 2023
12c2516
Merge branch 'feature/ECC-1691-DestineClimateDT' of github.com:ecmwf/…
mjg41 Oct 9, 2023
979b52f
ECC-1691: Remove future entries from GRIB2 table version 31
shahramn Oct 9, 2023
68d8bc0
ECC-1691: Fixed a typo and reverted some changes
mjg41 Oct 9, 2023
8339dcf
Merge branch 'feature/ECC-1691-DestineClimateDT' of github.com:ecmwf/…
mjg41 Oct 9, 2023
6f6f431
ECC-1691: Removed type and stream from products;
mjg41 Oct 10, 2023
da51abe
ECC-1691: Deleted some model entries
mjg41 Oct 10, 2023
ec0fd03
ECC-1691: Added mars streams and definition files;
mjg41 Oct 12, 2023
6faa0d1
ECC-1691: Validity time needs to be padded as str;
mjg41 Oct 13, 2023
9d4ce9b
ECC-1691: Don't want origin in mars namespace
mjg41 Oct 13, 2023
e25954b
ECC-1691: Sticking to CMIP format we use US format;
mjg41 Oct 13, 2023
878b2bd
ECC-1691: Removed hyphen which fdb has issues with
mjg41 Oct 13, 2023
64a3dc9
ECC-1691: Need to change climateDT related file
mjg41 Oct 13, 2023
80e7e88
ECC-1691: Back to "climate-dt";
mjg41 Oct 13, 2023
3cfccfd
ECC-1691: Changed dash to underscores in dataset;
mjg41 Oct 16, 2023
0f5dde6
ECC-1691: Tweaked test to change from "-" to "_".
mjg41 Oct 17, 2023
12a9094
ECC-1691: Update "-" to "_" in filename.
mjg41 Oct 17, 2023
1dd8815
Merge branch 'develop' into feature/ECC-1691-DestineClimateDT
shahramn Oct 17, 2023
86118f3
ECC-1691: Changed stream name from clim to clte;
mjg41 Oct 19, 2023
820aba0
Merge remote-tracking branch 'origin/develop' into feature/ECC-1691-D…
mjg41 Oct 19, 2023
32d3ce7
ECC-1691: Edited destineOrigin concept
mjg41 Oct 20, 2023
b94723f
ECC-1691: Revert underscores to dashes in dataset
mjg41 Oct 24, 2023
4d54dc8
Merge remote-tracking branch 'origin/develop' into feature/ECC-1691-D…
mjg41 Oct 24, 2023
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
1 change: 1 addition & 0 deletions definitions/grib2/destineLocalVersion.table
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 MARS labeling
4 changes: 4 additions & 0 deletions definitions/grib2/destine_activity.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 unknown unknown
1 CMIP6 Coupled Model Intercomparison Project Phase 6
2 ScenarioMIP Scenario Model Intercomparison Project
65535 65535 Missing
6 changes: 6 additions & 0 deletions definitions/grib2/destine_dataset.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0 unknown unknown
1 climate-dt Climate change adaptation digital twin
2 extremes-dt Weather and geophysical extremes digital twin
3 on-demand-climate-dt On-demand climate change adaptation digital twin
4 on-demand-extremes-dt On-demand weather and geophysical extremes digital twin
65535 65535 Missing
9 changes: 9 additions & 0 deletions definitions/grib2/destine_experiment.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
0 unknown unknown
1 hist Historical
2 amip Atmospheric Model Intercomparison Project
3 SSP1-1.9 Shared Socio-economic Pathways 1-1.9
4 SSP1-2.6 Shared Socio-economic Pathways 1-2.6
5 SSP2-4.5 Shared Socio-economic Pathways 2-4.5
6 SSP3-7.0 Shared Socio-economic Pathways 3-7.0
7 SSP5-8.5 Shared Socio-economic Pathways 5-8.5
65535 65535 Missing
6 changes: 6 additions & 0 deletions definitions/grib2/destine_model.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0 unknown unknown
1 IFS IFS with no ocean model
2 IFS-NEMO IFS with NEMO ocean model
3 IFS-FESOM IFS with FESOM ocean model
4 ICON ICON with no ocean model
65535 65535 Missing
4 changes: 4 additions & 0 deletions definitions/grib2/destine_resolution.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 unknown unknown
1 standard Standard resolution model output with longer availability
2 highres High resolution model output with limited availability
65535 65535 Missing
7 changes: 7 additions & 0 deletions definitions/grib2/local.destine.1.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# DestinE MARS layout

# Base keywords for all datasets
include "grib2/local.destine.base.def";

# Keywords based on dataset
template_nofail datasetTemplate "grib2/local.destine.[dataset:s].def";
4 changes: 4 additions & 0 deletions definitions/grib2/local.destine.base.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DestinE MARS base keywords

codetable[2] dataset "grib2/destine_dataset.table" : dump;
alias mars.dataset = dataset;
19 changes: 19 additions & 0 deletions definitions/grib2/local.destine.climate-dt.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# DestinE MARS ClimateDT keywords

codetable[2] activity "grib2/destine_activity.table" : dump;
alias mars.activity = activity;

codetable[2] experiment "grib2/destine_experiment.table" : dump;
alias mars.experiment = experiment;

unsigned[1] generation = 255 : dump;
alias mars.generation = generation;

codetable[2] model "grib2/destine_model.table" : dump;
alias mars.model = model;

unsigned[1] realization = 255 : dump;
alias mars.realization = realization;

codetable[2] resolution "grib2/destine_resolution.table" : dump;
alias mars.resolution = resolution;
10 changes: 10 additions & 0 deletions definitions/grib2/localConcepts/destine/destineOriginConcept.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Concept destineOrigin
"DWD" = { centre=98; subCentre=78; }
"Meteo-France" = { centre=98; subCentre=84; }
"Meteo-France" = { centre=98; subCentre=85; }
"MPI-M" = { centre=98; subCentre=252; }
"AWI" = { centre=98; subCentre=253; }
"BSC" = { centre=98; subCentre=1000; }
"CSC" = { centre=98; subCentre=1001; }
"DKRZ" = { centre=98; subCentre=1002; }
"Climate DT consortium (CSC,AWI,BSC,MPI-M)" = { centre=98; subCentre=1003; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Concept gridSpecification
'H16' = {numberOfDataPoints=3072; gridDefinitionTemplateNumber=150; Nside=16;}
'H32' = {numberOfDataPoints=12288; gridDefinitionTemplateNumber=150; Nside=32;}
'H64' = {numberOfDataPoints=49152; gridDefinitionTemplateNumber=150; Nside=64;}
'H128' = {numberOfDataPoints=196608; gridDefinitionTemplateNumber=150; Nside=128;}
'H256' = {numberOfDataPoints=786432; gridDefinitionTemplateNumber=150; Nside=256;}
'H512' = {numberOfDataPoints=3145728; gridDefinitionTemplateNumber=150; Nside=512;}
'H1024' = {numberOfDataPoints=12582912; gridDefinitionTemplateNumber=150; Nside=1024;}
'O1280' = {numberOfDataPoints=6599680; gridDefinitionTemplateNumber=40; Nj=2560;}
'O2560' = {numberOfDataPoints=26306560; gridDefinitionTemplateNumber=40; Nj=5120;}
'O8000' = {numberOfDataPoints=256288000; gridDefinitionTemplateNumber=40; Nj=16000;}
'F90' = {numberOfDataPoints=65160; gridDefinitionTemplateNumber=0; Ni=360; Nj=181; }
'F360' = {numberOfDataPoints=1038240; gridDefinitionTemplateNumber=0; Ni=1440; Nj=721; }
8 changes: 8 additions & 0 deletions definitions/grib2/post_meta_data.hook.products_12.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# (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;

5 changes: 5 additions & 0 deletions definitions/grib2/products_12.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# (C) Copyright 2005- ECMWF.

# Destination Earth (DestinE)

include "grib2/products_destine.def"
21 changes: 21 additions & 0 deletions definitions/grib2/products_destine.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# (C) Copyright 2005- ECMWF.

alias mars.expver = experimentVersionNumber;
alias parameter.paramId=paramId;
alias parameter.shortName=shortName;
alias parameter.units=units;
alias parameter.name=name;

alias mars.class = marsClass;
alias mars.param = paramId;

# Special rule for level type 103 'Specified height level above ground (m)'
if(typeOfFirstFixedSurface == 103) {
# only the parameters above 10m
if (level > 10) {
constant heightLevelName = 'hl';
alias mars.levtype = heightLevelName;
# levelist was unaliased in template.4.horizontal.def so we must have it back
alias mars.levelist = level;
}
}
6 changes: 6 additions & 0 deletions definitions/grib2/section.2.def
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ if ( addEmptySection2 == 0 ) {
template crraSection "grib2/local.crra.[crraLocalVersion:l].def";
}

if(productionStatusOfProcessedData == 12 || productionStatusOfProcessedData == 13) {
# destine = Destination Earth
codetable[2] destineLocalVersion 'grib2/destineLocalVersion.table' = 1 : dump;
template destineSection "grib2/local.destine.[destineLocalVersion:l].def";
}

codetable[2] grib2LocalSectionNumber 'grib2/grib2LocalSectionNumber.[centreForLocal:l].table' = 1 : dump;

if (grib2LocalSectionNumber!=0) {
Expand Down
2 changes: 2 additions & 0 deletions definitions/grib2/sections.def
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ meta md5Headers md5(startOfHeaders,lengthOfHeaders);

lookup[1] sectionNumber(4) ;

template_nofail hook_post_meta_data "grib2/post_meta_data.hook.products_[productionStatusOfProcessedData].def";

if (!headersOnly) {
if (sectionNumber == 5 or new() ) {
position sectionPosition;
Expand Down
6 changes: 6 additions & 0 deletions definitions/mars/grib.clmn.fc.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
alias mars.year = year;
alias mars.month = month;
unalias mars.date;
unalias mars.time;
unalias mars.step;
unalias mars.domain;
5 changes: 5 additions & 0 deletions definitions/mars/grib.clte.fc.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alias mars.date = validityDate;
meta padded_vtime sprintf("%.4d", validityTime): no_copy;
alias mars.time = padded_vtime;
unalias mars.step;
unalias mars.domain;
2 changes: 2 additions & 0 deletions definitions/mars/stream.table
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
1095 wamf Wave monthly forecast
1096 wmfm Wave monthly forecast means
1097 smma Seasonal monthly means anomalies
1098 clte Climate run output
1099 clmn Climate run monthly means output
1110 seap Sensitive area prediction
1120 eefh Extended ensemble forecast hindcast
1121 eehs Extended ensemble forecast hindcast statistics
Expand Down
Binary file added samples/destine_grib2.tmpl
Binary file not shown.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ if( HAVE_BUILD_TOOLS )
grib_ecc-1560
grib_ecc-1571
grib_ecc-1654
grib_ecc-1691
bufr_ecc-1028
bufr_ecc-1195
bufr_ecc-1259
Expand Down
95 changes: 95 additions & 0 deletions tests/grib_ecc-1691.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/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

REDIRECT=/dev/null

# ECC-1691: Destination Earth ClimateDT metadata support

label="grib_ecc-1691_test"
temp_grib_a=temp.$label.a.grib
temp_grib_b=temp.$label.b.grib
destine_sample=temp.$label.destine.grib
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl

tablesVersionLatest=$( ${tools_dir}/grib_get -p tablesVersionLatest $sample_grib2 )

# Setup Destine pseudo-centre GRIB message
# 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

# Then change to processed data = 12 --> DestinE
${tools_dir}/grib_set -s productionStatusOfProcessedData=12,class=d1 $temp_grib_a $destine_sample

# Check DestinE base related keys are present and correct
grib_check_key_exists $destine_sample destineLocalVersion,dataset,marsClass,marsType,marsStream,experimentVersionNumber
grib_check_key_equals $destine_sample "marsClass,dataset,destineLocalVersion" "d1 0 1"

# Check setting dataset to climate-dt (1). Check keys are present and equal defaults
${tools_dir}/grib_set -s dataset=1 $destine_sample $temp_grib_a

grib_check_key_exists $temp_grib_a dataset,generation,activity,experiment,model,realization,resolution
grib_check_key_equals $temp_grib_a "dataset,generation,activity,experiment,model,realization,resolution" "1 255 0 0 0 255 0"

# Check an example where a few additional things are set in climate-dt
${tools_dir}/grib_set -s dataset=1,generation=2,activity=1,experiment=1,model=2,realization=1,resolution=1 $destine_sample $temp_grib_a

grib_check_key_equals $temp_grib_a "dataset,generation,activity,experiment,model,realization,resolution" "1 2 1 1 2 1 1"
grib_check_key_equals $temp_grib_a "dataset:s,activity:s,experiment:s,model:s,resolution:s" "climate-dt CMIP6 hist IFS-NEMO standard"

# Check setting dataset to extremes-dt (2). This time we will check string also
${tools_dir}/grib_set -s dataset=2 $destine_sample $temp_grib_a

grib_check_key_equals $temp_grib_a "dataset,dataset:s" "2 extremes-dt"

# Check concepts. First check default value and then example of mapping
grib_check_key_exists $destine_sample destineOrigin,gridSpecification
grib_check_key_equals $destine_sample "destineOrigin,gridSpecification" "unknown unknown"

# Below mapping is for MeteoFrance
${tools_dir}/grib_set -s centre=98,subCentre=85 $destine_sample $temp_grib_a

grib_check_key_equals $temp_grib_a "destineOrigin" "Meteo-France"

# Below mapping is for H1024
${tools_dir}/grib_set -s numberOfDataPoints=12582912,gridDefinitionTemplateNumber=150,Nside=1024 $destine_sample $temp_grib_a

grib_check_key_equals $temp_grib_a "gridSpecification" "H1024"

# Now check streams.
# Setting stream clte and type fc should set mars.date and mars.time to validityDate and validityTime,
# and mars.step should be unaliased

${tools_dir}/grib_set -s stream=clte,type=fc $destine_sample $temp_grib_a

result1=$( ${tools_dir}/grib_get -p mars.date,mars.time $temp_grib_a )
result2=$( ${tools_dir}/grib_get -p validityDate,validityTime $temp_grib_a )
[ "$result1" = "$result2" ]

${tools_dir}/grib_ls -jm $temp_grib_a
[ $( ${tools_dir}/grib_get -f -p mars.step $temp_grib_a ) = "not_found" ]

# Setting stream clmn and type fc should set mars.year and mars.month to year and month,
# and mars.date, mars.time, mars.step should be unaliased

${tools_dir}/grib_set -s stream=clmn,type=fc $destine_sample $temp_grib_a

result1=$( ${tools_dir}/grib_get -p mars.year,mars.month $temp_grib_a )
result2=$( ${tools_dir}/grib_get -p year,month $temp_grib_a )
[ "$result1" = "$result2" ]

${tools_dir}/grib_ls -jm $temp_grib_a
[ $( ${tools_dir}/grib_get -f -p mars.date $temp_grib_a ) = "not_found" ]
[ $( ${tools_dir}/grib_get -f -p mars.time $temp_grib_a ) = "not_found" ]
[ $( ${tools_dir}/grib_get -f -p mars.step $temp_grib_a ) = "not_found" ]

# Clean up
rm -f $temp_grib_a $temp_grib_b $destine_sample
Loading