Commit 65d9b6a7 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added patch from Florian Prill

parent 4e12dce6
...@@ -72,7 +72,10 @@ static inline int my_grib_set_double(grib_handle* h, const char* key, double val ...@@ -72,7 +72,10 @@ static inline int my_grib_set_double(grib_handle* h, const char* key, double val
if ( cdiGribApiDebug ) if ( cdiGribApiDebug )
fprintf(stderr, "grib_set_double(\tgrib_handle* h, \"%s\", %f)\n", key, val); fprintf(stderr, "grib_set_double(\tgrib_handle* h, \"%s\", %f)\n", key, val);
return grib_set_double(h, key, val); int ret_val = grib_set_double(h, key, val);
if (ret_val != 0)
fprintf(stderr, "!!! failed call to grib_set_double(\tgrib_handle* h, \"%s\", %f) !!!\n", key, val);
return ret_val;
} }
static inline int my_grib_set_long(grib_handle* h, const char* key, long val) static inline int my_grib_set_long(grib_handle* h, const char* key, long val)
...@@ -80,7 +83,10 @@ static inline int my_grib_set_long(grib_handle* h, const char* key, long val) ...@@ -80,7 +83,10 @@ static inline int my_grib_set_long(grib_handle* h, const char* key, long val)
if ( cdiGribApiDebug ) if ( cdiGribApiDebug )
fprintf(stderr, "grib_set_long( \tgrib_handle* h, \"%s\", %ld)\n", key, val); fprintf(stderr, "grib_set_long( \tgrib_handle* h, \"%s\", %ld)\n", key, val);
return grib_set_long(h, key, val); int ret_val = grib_set_long(h, key, val);
if (ret_val != 0)
fprintf(stderr, "!!! failed call to grib_set_long( \tgrib_handle* h, \"%s\", %ld) !!!\n", key, val);
return ret_val;
} }
static inline int my_grib_set_string(grib_handle* h, const char* key, const char* val, size_t* length) static inline int my_grib_set_string(grib_handle* h, const char* key, const char* val, size_t* length)
...@@ -88,7 +94,10 @@ static inline int my_grib_set_string(grib_handle* h, const char* key, const char ...@@ -88,7 +94,10 @@ static inline int my_grib_set_string(grib_handle* h, const char* key, const char
if ( cdiGribApiDebug ) if ( cdiGribApiDebug )
fprintf(stderr, "grib_set_string(\tgrib_handle* h, \"%s\", \"%s\")\n", key, val); fprintf(stderr, "grib_set_string(\tgrib_handle* h, \"%s\", \"%s\")\n", key, val);
return grib_set_string(h, key, val, length); int ret_val = grib_set_string(h, key, val, length);
if (ret_val != 0)
fprintf(stderr, "!!! grib_set_string(\tgrib_handle* h, \"%s\", \"%s\") !!!\n", key, val);
return ret_val;
} }
static inline void gribHandleDelete(void *gh) static inline void gribHandleDelete(void *gh)
......
...@@ -2276,7 +2276,7 @@ void grib2DefLevel(grib_handle *gh, int gcinit, long leveltype1, long leveltype2 ...@@ -2276,7 +2276,7 @@ void grib2DefLevel(grib_handle *gh, int gcinit, long leveltype1, long leveltype2
} }
static static
void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID, int levelID, int gcinit) void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID, int levelID, int gcinit, int proddef_template_num)
{ {
int lbounds = 0; int lbounds = 0;
static int warning = 1; static int warning = 1;
...@@ -2326,7 +2326,15 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID, ...@@ -2326,7 +2326,15 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
} }
else else
{ {
grib2DefLevel(gh, gcinit, grib2ltype, grib2ltype, lbounds, level, dlevel1, dlevel2); /* PRODUCT DEFINITION TEMPLATE NUMBER 32:
"Analysis or forecast at a horizontal level or in a horizontal layer at a point
in time for simulate (synthetic) satellite data"
The key/value pairs that are set in "grib2DefLevel" do not exist for this template.
*/
if ( proddef_template_num != 32 )
grib2DefLevel(gh, gcinit, grib2ltype, grib2ltype, lbounds, level, dlevel1, dlevel2);
} }
break; break;
...@@ -2624,7 +2632,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI ...@@ -2624,7 +2632,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
gribapiDefGrid((int)editionNumber, gh, gridID, comptype, lieee, datatype, nmiss, gc->init); gribapiDefGrid((int)editionNumber, gh, gridID, comptype, lieee, datatype, nmiss, gc->init);
gribapiDefLevel((int)editionNumber, gh, param, zaxisID, levelID, gc->init); gribapiDefLevel((int)editionNumber, gh, param, zaxisID, levelID, gc->init, productDefinitionTemplate);
vlist_t *vlistptr = vlist_to_pointer(vlistID); vlist_t *vlistptr = vlist_to_pointer(vlistID);
//if (!gc->init) //if (!gc->init)
......
...@@ -1281,7 +1281,7 @@ void varDefOptGribDbl(int varID, int tile_index, double dval, const char *keywor ...@@ -1281,7 +1281,7 @@ void varDefOptGribDbl(int varID, int tile_index, double dval, const char *keywor
Free(vartable[varID].opt_grib_kvpair[idx].keyword); Free(vartable[varID].opt_grib_kvpair[idx].keyword);
} }
vartable[varID].opt_grib_kvpair[idx].data_type = t_double; vartable[varID].opt_grib_kvpair[idx].data_type = t_double;
vartable[varID].opt_grib_kvpair[idx].dbl_val = (int) dval; vartable[varID].opt_grib_kvpair[idx].dbl_val = dval;
vartable[varID].opt_grib_kvpair[idx].keyword = strdupx(keyword); vartable[varID].opt_grib_kvpair[idx].keyword = strdupx(keyword);
vartable[varID].opt_grib_kvpair[idx].subtype_index = tile_index; vartable[varID].opt_grib_kvpair[idx].subtype_index = tile_index;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment