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

ECC-1963: GRIB2: Replacement of product definition template 4.44 with 4.50 #274

Merged
merged 2 commits into from
Nov 19, 2024
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
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g2_aerosol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int grib_accessor_g2_aerosol_t::pack_long(const long* val, size_t* len)
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 48; // 44 is deprecated
productDefinitionTemplateNumberNew = 50; // ECC-1963: 44 is deprecated
}
else {
productDefinitionTemplateNumberNew = 46;
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_select_step_template.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int grib_accessor_select_step_template_t::pack_long(const long* val, size_t* len
productDefinitionTemplateNumberNew = 41;
break;
case 46: // DET aerosol
productDefinitionTemplateNumberNew = 48; // 44 is deprecated
productDefinitionTemplateNumberNew = 50; // ECC-1963: 44 is deprecated
break;
case 47: // ENS aerosol
productDefinitionTemplateNumberNew = 45;
Expand Down
8 changes: 6 additions & 2 deletions src/grib_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1950,12 +1950,13 @@ int grib2_is_PDTN_ChemicalDistFunc(long pdtn)
// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for aerosols
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
return (
pdtn == 44 ||
pdtn == 48 ||
pdtn == 49 ||
pdtn == 50 ||
pdtn == 45 ||
pdtn == 46 ||
pdtn == 47 ||
Expand Down Expand Up @@ -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_det) return 46;
}
if (current_PDTN == 50) {
if (is_instant && is_ens) return 45;
}

return current_PDTN; // no change
}
Expand Down Expand Up @@ -2102,7 +2106,7 @@ int grib2_select_PDTN(int is_eps, int is_instant,
}
else {
if (is_instant)
return 48; // 44 is deprecated
return 50; // ECC-1963: 44 is deprecated
else
return 46;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/grib2_chemicals_aerosols.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ grib_check_key_equals $temp constituentType,numberOfModeOfDistribution,modeNumbe

# Plain aerosols
${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol=1 $sample2 $temp
grib_check_key_equals $temp productDefinitionTemplateNumber '48'
grib_check_key_equals $temp aerosolType,typeOfSizeInterval,typeOfWavelengthInterval '0 0 0'
grib_check_key_equals $temp productDefinitionTemplateNumber '50'
grib_check_key_equals $temp aerosolType,typeOfSizeInterval '0 0'

# Aerosol optical
${tools_dir}/grib_set -s tablesVersion=$latest,is_aerosol_optical=1 $sample2 $temp
Expand Down
2 changes: 1 addition & 1 deletion tests/grib2_templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ grib_check_key_equals $temp productDefinitionTemplateNumber '43'

# Aerosol 210072
$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
grib_check_key_equals $temp productDefinitionTemplateNumber '45'
Expand Down
2 changes: 1 addition & 1 deletion tests/grib_local_ECMWF.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ ${tools_dir}/grib_set -s productDefinitionTemplateNumber=76,paramId=456000,setLo
grib_check_key_equals $temp shortName drydep_vel_vol

${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

Expand Down
2 changes: 1 addition & 1 deletion tests/grib_sub_hourly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'

${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
grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange,stepUnits:s,productDefinitionTemplateNumber' '13 s 76'
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void test_grib2_select_PDTN()
Assert( 67 == grib2_select_PDTN(!eps, !instant, 0, 0, chemical_distfn, 0, 0) );

// 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( 45 == grib2_select_PDTN(eps, instant, 0, 0, 0, aerosol, 0) );
Assert( 85 == grib2_select_PDTN(eps, !instant, 0, 0, 0, aerosol, 0) );
Expand Down
Loading