ECC-1867: GRIB: Unexpected PDT change for GRIB2 wave template for ensemble DA streams

This commit is contained in:
shahramn 2024-07-12 16:40:34 +01:00
parent f0e58efc32
commit 6e112df32a
2 changed files with 25 additions and 1 deletions

View File

@ -101,6 +101,7 @@ 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);
@ -108,6 +109,9 @@ static int extra_set(grib_accessor* a, long val)
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 */
@ -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)

View File

@ -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
@ -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