GRIB-488: Tighten the condition for ERA-CLIM data

This commit is contained in:
Shahram Najm 2023-10-13 15:34:17 +01:00
parent 993cc42e4c
commit 1c24fa08f5
1 changed files with 14 additions and 8 deletions

View File

@ -209,18 +209,24 @@ static const int u2s[] = {
1800 /* (15) 30 minutes */ 1800 /* (15) 30 minutes */
}; };
/* See GRIB-488 */ // See GRIB-488
static int is_special_expver(grib_handle* h) static bool is_special_expver(const grib_handle* h)
{ {
int ret = 0; int ret = 0;
char strExpVer[50] = {0,}; char strMarsExpVer[50] = {0,};
char strMarsClass[50] = {0,};
size_t slen = 50; size_t slen = 50;
ret = grib_get_string(h, "experimentVersionNumber", strExpVer, &slen); ret = grib_get_string(h, "mars.class", strMarsClass, &slen);
if (ret == GRIB_SUCCESS && !strcmp(strExpVer, "1605")) { if (ret == GRIB_SUCCESS && STR_EQUAL(strMarsClass, "em")) {
return 1; /* Special case of expVer 1605! */ // em = ERA-CLIM model integration for the 20th-century (ERA-20CM)
slen = 50;
ret = grib_get_string(h, "experimentVersionNumber", strMarsExpVer, &slen);
if (ret == GRIB_SUCCESS && STR_EQUAL(strMarsExpVer, "1605")) {
return true; // Special case of expVer 1605 in class "em"
}
} }
return 0; return false;
} }
static int convert_time_range( static int convert_time_range(