Use Identifier to set product kind

This commit is contained in:
Shahram Najm 2018-12-19 15:51:19 +00:00
parent c2c601d55c
commit 704ff67397
1 changed files with 8 additions and 8 deletions

View File

@ -369,15 +369,15 @@ static int determine_product_kind(grib_handle* h, ProductKind* prod_kind)
{
int err = 0;
size_t len = 0;
char prod_kind_str[256]={0,};
err = grib_get_length(h, "kindOfProduct", &len);
err = grib_get_length(h, "identifier", &len);
if (!err) {
err = grib_get_string(h, "kindOfProduct", prod_kind_str, &len);
if (grib_inline_strcmp(prod_kind_str, "GRIB")==0) *prod_kind = PRODUCT_GRIB;
else if (grib_inline_strcmp(prod_kind_str, "BUFR")==0) *prod_kind = PRODUCT_BUFR;
else if (grib_inline_strcmp(prod_kind_str, "META")==0) *prod_kind = PRODUCT_METAR;
else if (grib_inline_strcmp(prod_kind_str, "GTS")==0) *prod_kind = PRODUCT_GTS;
else if (grib_inline_strcmp(prod_kind_str, "TAF")==0) *prod_kind = PRODUCT_TAF;
char id_str[64]={0,};
err = grib_get_string(h, "identifier", id_str, &len);
if (grib_inline_strcmp(id_str, "GRIB")==0) *prod_kind = PRODUCT_GRIB;
else if (grib_inline_strcmp(id_str, "BUFR")==0) *prod_kind = PRODUCT_BUFR;
else if (grib_inline_strcmp(id_str, "METAR")==0) *prod_kind = PRODUCT_METAR;
else if (grib_inline_strcmp(id_str, "GTS")==0) *prod_kind = PRODUCT_GTS;
else if (grib_inline_strcmp(id_str, "TAF")==0) *prod_kind = PRODUCT_TAF;
else *prod_kind = PRODUCT_ANY;
}
return err;