Commit 83199fc2 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapi: time dependet metadata [Feature #4720]

parent 748c5384
2014-12-04 Uwe Schulzweida
2014-12-14 Uwe Schulzweida
* Version 1.6.6.1 released
* Version 1.6.7 released
2014-12-03 Uwe Schulzweida
* gribapi: time dependet metadata [Feature #4720]
2014-12-01 Uwe Schulzweida
......
......@@ -3096,7 +3096,6 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
long datasize, const double *data, int nmiss, unsigned char **gribbuffer, size_t *gribbuffersize,
int comptype, void *gribContainer)
{
size_t nbytes = 0;
size_t recsize = 0;
void *dummy = NULL;
int datatype;
......@@ -3108,7 +3107,6 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
long bitsPerValue;
long editionNumber = 2;
char name[256];
grib_handle *gh = NULL;
gribContainer_t *gc = (gribContainer_t *) gribContainer;
// extern unsigned char _grib_template_GRIB2[];
......@@ -3120,9 +3118,9 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
vlistInqVarName(vlistID, varID, name);
#if defined(GRIBAPIENCODETEST)
gh = (grib_handle *) gribHandleNew(editionNumber);
grib_handle *gh = (grib_handle *) gribHandleNew(editionNumber);
#else
gh = gc->gribHandle;
grib_handle *gh = gc->gribHandle;
#endif
GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
......@@ -3165,15 +3163,15 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
/* Local change: 2013-01-28, FP (DWD) */
/* ---------------------------------- */
vlist_t *vlistptr;
vlistptr = vlist_to_pointer(vlistID);
vlist_t *vlistptr = vlist_to_pointer(vlistID);
//if (!gc->init)
{
for (int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++)
for ( int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++ )
{
if ( vlistptr->vars[varID].opt_grib_dbl_update[i] )
{
vlistptr->vars[varID].opt_grib_dbl_update[i] = FALSE;
//DR: Fix for multi-level fields (otherwise only the 1st level is correct)
if ( zaxisInqSize(zaxisID)==(levelID+1) ) vlistptr->vars[varID].opt_grib_dbl_update[i] = FALSE;
int ret = my_grib_set_double(gh, vlistptr->vars[varID].opt_grib_dbl_keyword[i],
vlistptr->vars[varID].opt_grib_dbl_val[i]);
if (ret != 0) {
......@@ -3184,11 +3182,12 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
GRIB_CHECK(ret, 0);
}
}
for (int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++)
for ( int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++ )
{
if ( vlistptr->vars[varID].opt_grib_int_update[i] )
{
vlistptr->vars[varID].opt_grib_int_update[i] = FALSE;
//DR: Fix for multi-level fields (otherwise only the 1st level is correct)
if ( zaxisInqSize(zaxisID)==(levelID+1) ) vlistptr->vars[varID].opt_grib_int_update[i] = FALSE;
int ret = my_grib_set_long(gh, vlistptr->vars[varID].opt_grib_int_keyword[i],
vlistptr->vars[varID].opt_grib_int_val[i]);
if (ret != 0) {
......@@ -3225,9 +3224,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
gc->init = TRUE;
nbytes = recsize;
return (nbytes);
return (recsize);
}
#endif
......
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