diff --git a/definitions/grib1/section.1.def b/definitions/grib1/section.1.def index 2bda52ec7..4136b0395 100644 --- a/definitions/grib1/section.1.def +++ b/definitions/grib1/section.1.def @@ -325,3 +325,10 @@ if (stepTypeForConversion is "accum" || stepTypeForConversion is "max" || stepTy meta md5Section1 md5(offsetSection1,section1Length); # md5(start,length,blacklisted1,blacklisted2,...); meta md5Product md5(offsetSection1,section1Length,gridDefinition,section1Flags,decimalScaleFactor); + +# ECC-1806 +concept_nofail paramIdForConversion(zero) { + 262000 = {gribTablesVersionNo=174;indicatorOfParameter=98; centre=98;} # 174098 -> 262000 + 262104 = {gribTablesVersionNo=151;indicatorOfParameter=163;centre=98;} # 151163 -> 262104 + 262124 = {gribTablesVersionNo=151;indicatorOfParameter=145;centre=98;} # 151145 -> 262124 +} : long_type; diff --git a/definitions/grib2/boot.def b/definitions/grib2/boot.def index d2c44fb74..7cba8747b 100644 --- a/definitions/grib2/boot.def +++ b/definitions/grib2/boot.def @@ -53,3 +53,6 @@ concept isTemplateDeprecated(false) { concept isTemplateExperimental(false) { 1 = { template_is_experimental = 1; } } + +# ECC-1806 +transient paramIdForConversion = 0; diff --git a/src/grib_accessor_class_concept.cc b/src/grib_accessor_class_concept.cc index efda63e55..cdfb31245 100644 --- a/src/grib_accessor_class_concept.cc +++ b/src/grib_accessor_class_concept.cc @@ -455,6 +455,20 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) //if(*len > 1) // return GRIB_NOT_IMPLEMENTED; + // ECC-1806: GRIB: Change of paramId in conversion from GRIB1 to GRIB2 + if (STR_EQUAL(a->name,"paramId")) { + grib_handle* h = grib_handle_of_accessor(a); + long edition = 0; + if (grib_get_long(h, "edition", &edition) == GRIB_SUCCESS && edition == 2) { + long newParamId = 0; + if (grib_get_long(h, "paramIdForConversion", &newParamId) == GRIB_SUCCESS) { + if (newParamId > 0) { + snprintf(buf, sizeof(buf), "%ld", newParamId); + } + } + } + } + s = strlen(buf) + 1; return pack_string(a, buf, &s); }