Merge pull request #274 from ecmwf/bugfix/ECC-1963-PDTN-44

ECC-1963: GRIB2: Replacement of product definition template 4.44 with 4.50
This commit is contained in:
shahramn 2024-11-19 18:56:27 +00:00 committed by GitHub
commit b22b97b971
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 14 additions and 10 deletions

View File

@ -79,7 +79,7 @@ int grib_accessor_g2_aerosol_t::pack_long(const long* val, size_t* len)
} }
else { else {
if (isInstant) { if (isInstant) {
productDefinitionTemplateNumberNew = 48; // 44 is deprecated productDefinitionTemplateNumberNew = 50; // ECC-1963: 44 is deprecated
} }
else { else {
productDefinitionTemplateNumberNew = 46; productDefinitionTemplateNumberNew = 46;

View File

@ -70,7 +70,7 @@ int grib_accessor_select_step_template_t::pack_long(const long* val, size_t* len
productDefinitionTemplateNumberNew = 41; productDefinitionTemplateNumberNew = 41;
break; break;
case 46: // DET aerosol case 46: // DET aerosol
productDefinitionTemplateNumberNew = 48; // 44 is deprecated productDefinitionTemplateNumberNew = 50; // ECC-1963: 44 is deprecated
break; break;
case 47: // ENS aerosol case 47: // ENS aerosol
productDefinitionTemplateNumberNew = 45; productDefinitionTemplateNumberNew = 45;

View File

@ -1950,12 +1950,13 @@ int grib2_is_PDTN_ChemicalDistFunc(long pdtn)
// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for aerosols // Return 1 if the productDefinitionTemplateNumber (GRIB2) is for aerosols
int grib2_is_PDTN_Aerosol(long pdtn) int grib2_is_PDTN_Aerosol(long pdtn)
{ {
// Notes: PDT 44 is deprecated and replaced by 48 // Notes: PDT 44 is deprecated and replaced by 50
// PDT 47 is deprecated and replaced by 85 // PDT 47 is deprecated and replaced by 85
return ( return (
pdtn == 44 || pdtn == 44 ||
pdtn == 48 || pdtn == 48 ||
pdtn == 49 || pdtn == 49 ||
pdtn == 50 ||
pdtn == 45 || pdtn == 45 ||
pdtn == 46 || pdtn == 46 ||
pdtn == 47 || pdtn == 47 ||
@ -2014,6 +2015,9 @@ int grib2_choose_PDTN(int current_PDTN, bool is_det, bool is_instant)
if (is_interval && is_ens) return 85; if (is_interval && is_ens) return 85;
if (is_interval && is_det) return 46; if (is_interval && is_det) return 46;
} }
if (current_PDTN == 50) {
if (is_instant && is_ens) return 45;
}
return current_PDTN; // no change return current_PDTN; // no change
} }
@ -2102,7 +2106,7 @@ int grib2_select_PDTN(int is_eps, int is_instant,
} }
else { else {
if (is_instant) if (is_instant)
return 48; // 44 is deprecated return 50; // ECC-1963: 44 is deprecated
else else
return 46; return 46;
} }

View File

@ -55,8 +55,8 @@ grib_check_key_equals $temp constituentType,numberOfModeOfDistribution,modeNumbe
# Plain aerosols # Plain aerosols
${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol=1 $sample2 $temp ${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol=1 $sample2 $temp
grib_check_key_equals $temp productDefinitionTemplateNumber '48' grib_check_key_equals $temp productDefinitionTemplateNumber '50'
grib_check_key_equals $temp aerosolType,typeOfSizeInterval,typeOfWavelengthInterval '0 0 0' grib_check_key_equals $temp aerosolType,typeOfSizeInterval '0 0'
# Aerosol optical # Aerosol optical
${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol_optical=1 $sample2 $temp ${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol_optical=1 $sample2 $temp

View File

@ -242,7 +242,7 @@ grib_check_key_equals $temp productDefinitionTemplateNumber '43'
# Aerosol 210072 # Aerosol 210072
$tools_dir/grib_set -s paramId=210072,stepType=instant,eps=0 $input $temp $tools_dir/grib_set -s paramId=210072,stepType=instant,eps=0 $input $temp
grib_check_key_equals $temp productDefinitionTemplateNumber '48' grib_check_key_equals $temp productDefinitionTemplateNumber '50'
$tools_dir/grib_set -s paramId=210072,stepType=instant,eps=1 $input $temp $tools_dir/grib_set -s paramId=210072,stepType=instant,eps=1 $input $temp
grib_check_key_equals $temp productDefinitionTemplateNumber '45' grib_check_key_equals $temp productDefinitionTemplateNumber '45'

View File

@ -222,7 +222,7 @@ ${tools_dir}/grib_set -s productDefinitionTemplateNumber=76,paramId=456000,setLo
grib_check_key_equals $temp shortName drydep_vel_vol grib_check_key_equals $temp shortName drydep_vel_vol
${tools_dir}/grib_set -s paramId=215225,setLocalDefinition=1,localDefinitionNumber=36 $sample_g2 $temp ${tools_dir}/grib_set -s paramId=215225,setLocalDefinition=1,localDefinitionNumber=36 $sample_g2 $temp
grib_check_key_equals $temp productDefinitionTemplateNumber 48 grib_check_key_equals $temp productDefinitionTemplateNumber 50
${tools_dir}/grib_set -s paramId=210251,setLocalDefinition=1,localDefinitionNumber=36 $sample_g2 $temp ${tools_dir}/grib_set -s paramId=210251,setLocalDefinition=1,localDefinitionNumber=36 $sample_g2 $temp

View File

@ -621,7 +621,7 @@ ${tools_dir}/grib_set -s stepUnits=s,paramId=131060 $sample_g2 $temp # probabili
grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 9' grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 9'
${tools_dir}/grib_set -s stepUnits=s,paramId=210073 $sample_g2 $temp # is_aerosol ${tools_dir}/grib_set -s stepUnits=s,paramId=210073 $sample_g2 $temp # is_aerosol
grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 48' grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 50'
${tools_dir}/grib_set -s stepUnits=s,paramId=210170 $sample_g2 $temp # is_chemical_srcsink ${tools_dir}/grib_set -s stepUnits=s,paramId=210170 $sample_g2 $temp # is_chemical_srcsink
grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 76' grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 76'

View File

@ -742,7 +742,7 @@ void test_grib2_select_PDTN()
Assert( 67 == grib2_select_PDTN(!eps, !instant, 0, 0, chemical_distfn, 0, 0) ); Assert( 67 == grib2_select_PDTN(!eps, !instant, 0, 0, chemical_distfn, 0, 0) );
// Aerosols // Aerosols
Assert( 48 == grib2_select_PDTN(!eps, instant, 0, 0, 0, aerosol, 0) ); Assert( 50 == grib2_select_PDTN(!eps, instant, 0, 0, 0, aerosol, 0) );
Assert( 46 == grib2_select_PDTN(!eps, !instant, 0, 0, 0, aerosol, 0) ); Assert( 46 == grib2_select_PDTN(!eps, !instant, 0, 0, 0, aerosol, 0) );
Assert( 45 == grib2_select_PDTN(eps, instant, 0, 0, 0, aerosol, 0) ); Assert( 45 == grib2_select_PDTN(eps, instant, 0, 0, 0, aerosol, 0) );
Assert( 85 == grib2_select_PDTN(eps, !instant, 0, 0, 0, aerosol, 0) ); Assert( 85 == grib2_select_PDTN(eps, !instant, 0, 0, 0, aerosol, 0) );