mirror of https://github.com/ecmwf/eccodes.git
ECC-1806: GRIB: Change of paramId in conversion from GRIB1 to GRIB2 (Try 1)
This commit is contained in:
parent
21fdb254ee
commit
e6e3c58f3c
|
@ -325,3 +325,10 @@ if (stepTypeForConversion is "accum" || stepTypeForConversion is "max" || stepTy
|
||||||
meta md5Section1 md5(offsetSection1,section1Length);
|
meta md5Section1 md5(offsetSection1,section1Length);
|
||||||
# md5(start,length,blacklisted1,blacklisted2,...);
|
# md5(start,length,blacklisted1,blacklisted2,...);
|
||||||
meta md5Product md5(offsetSection1,section1Length,gridDefinition,section1Flags,decimalScaleFactor);
|
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;
|
||||||
|
|
|
@ -53,3 +53,6 @@ concept isTemplateDeprecated(false) {
|
||||||
concept isTemplateExperimental(false) {
|
concept isTemplateExperimental(false) {
|
||||||
1 = { template_is_experimental = 1; }
|
1 = { template_is_experimental = 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ECC-1806
|
||||||
|
transient paramIdForConversion = 0;
|
||||||
|
|
|
@ -455,6 +455,20 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
//if(*len > 1)
|
//if(*len > 1)
|
||||||
// return GRIB_NOT_IMPLEMENTED;
|
// 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;
|
s = strlen(buf) + 1;
|
||||||
return pack_string(a, buf, &s);
|
return pack_string(a, buf, &s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue