Skip to content

Commit

Permalink
Merge branch 'hotfix/2.36.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Jul 15, 2024
2 parents 5c545e3 + 6e112df commit 2564727
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.36.0
2.36.1
13 changes: 13 additions & 0 deletions definitions/grib2/local.98.43.def
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ alias mars.activity = activity;
codetable[2] experiment "grib2/destine_experiment.table" ;
alias mars.experiment = experiment;

# Generation keyword - synergise with DestinE ClimateDT and use this to version the dataset
unsigned[1] generation = 255 : dump;
alias mars.generation = generation;

# Model keyword to index multiple models within EERIE
codetable[2] model "grib2/destine_model.table" : dump;
alias mars.model = model;

# Climate run realization keyword, which relates to an initial condition perturbation
unsigned[1] realization = 255 ;
alias mars.realization = realization;

# Allows simultaneous archiving of resolutions
# high resolution for best available vs standard resolution for quick access and plotting
codetable[2] resolution "grib2/destine_resolution.table" : dump;
alias mars.resolution = resolution;

# Remove mars domain from this data
unalias mars.domain;

Expand Down
9 changes: 9 additions & 0 deletions src/accessor/grib_accessor_class_g2_mars_labeling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ static int extra_set(grib_accessor* a, long val)
long is_chemical_srcsink = 0;
long is_aerosol = 0;
long is_aerosol_optical = 0;
long is_wave = 0, is_wave_prange = 0;

grib_get_long(hand, "is_chemical", &is_chemical);
grib_get_long(hand, "is_chemical_srcsink", &is_chemical_srcsink);
grib_get_long(hand, "is_chemical_distfn", &is_chemical_distfn);
grib_get_long(hand, "is_aerosol", &is_aerosol);
grib_get_long(hand, "is_aerosol_optical", &is_aerosol_optical);

is_wave = grib_is_defined(hand, "waveDirectionNumber");
is_wave_prange = grib_is_defined(hand, "typeOfWavePeriodInterval");

switch (self->index) {
case 0:
/* class */
Expand Down Expand Up @@ -287,6 +291,11 @@ static int extra_set(grib_accessor* a, long val)
return GRIB_INTERNAL_ERROR;
}

if (is_wave || is_wave_prange) {
// ECC-1867
productDefinitionTemplateNumberNew = -1; // disable PDT selection
}

if (productDefinitionTemplateNumberNew >= 0) {
grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber);
if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew)
Expand Down
17 changes: 16 additions & 1 deletion tests/grib2_wave_spectra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

label="grib2_wave_spectra_test"
temp=temp.$label
tempGribA=temp.$label.A.grib
tempGribB=temp.$label.B.grib
tempSample=temp.$label.tmpl
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl

Expand Down Expand Up @@ -52,5 +54,18 @@ grib_check_key_equals $temp firstWavelengthInNanometres '12'
grib_check_key_equals $temp firstWavelengthInMetres '1.2e-08'


# ECC-1867: Unexpected PDT change for wave template for ensemble DA streams
sample_ld=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl # Sample with a mars local def
${tools_dir}/grib_set -s tablesVersion=32,productDefinitionTemplateNumber=99,waveFrequencyNumber=14 $sample_ld $tempGribA
${tools_dir}/grib_set -s stream=ewla $tempGribA $tempGribB
grib_check_key_equals $tempGribB productDefinitionTemplateNumber,waveFrequencyNumber '99 14'
${tools_dir}/grib_compare -b marsStream $tempGribA $tempGribB

${tools_dir}/grib_set -s type=em $tempGribA $tempGribB
${tools_dir}/grib_compare -b marsType,typeOfProcessedData,typeOfGeneratingProcess $tempGribA $tempGribB
${tools_dir}/grib_set -s type=es $tempGribA $tempGribB
${tools_dir}/grib_compare -b marsType,typeOfProcessedData,typeOfGeneratingProcess $tempGribA $tempGribB


# Clean up
rm -f $tempSample $temp
rm -f $tempSample $temp $tempGribA $tempGribB
11 changes: 11 additions & 0 deletions tests/grib_ecc-1766.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,16 @@ ${tools_dir}/grib_set -s activity=1,experiment=1,realization=1 $eerie_sample $te
grib_check_key_equals $temp_grib "activity,experiment,realization" "1 1 1"
grib_check_key_equals $temp_grib "activity:s,experiment:s" "CMIP6 hist"

# ECC-1850: Additional keys added
# Check additional keys are present and correct
grib_check_key_exists $eerie_sample generation,model,resolution
grib_check_key_equals $eerie_sample "generation,model,resolution" "255 0 0"

# Check an example where a few additional things are set
${tools_dir}/grib_set -s generation=1,model=2,resolution=1 $eerie_sample $temp_grib

grib_check_key_equals $temp_grib "generation,model,resolution" "1 2 1"
grib_check_key_equals $temp_grib "model:s,resolution:s" "IFS-NEMO standard"

# Clean up
rm -f $temp_grib $eerie_sample

0 comments on commit 2564727

Please sign in to comment.