Commit fdc0f2b1 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cleanup gribapi interface

parent 5f032df4
...@@ -13,12 +13,10 @@ ...@@ -13,12 +13,10 @@
#include "vlist.h" #include "vlist.h"
#include "stream_grb.h" #include "stream_grb.h"
#include "gribapi.h"
#if defined (HAVE_LIBGRIB_API) #if defined (HAVE_LIBGRIB_API)
# if defined (HAVE_LIBCGRIBEX)
# include "cgribex.h" /* gribGetSize, gribRead, gribGetZip */ # include "cgribex.h" /* gribGetSize, gribRead, gribGetZip */
# endif # include "gribapi.h"
# include "grib_api.h" # include "grib_api.h"
#endif #endif
...@@ -778,7 +776,7 @@ int gribapiScanTimestep1(int streamID) ...@@ -778,7 +776,7 @@ int gribapiScanTimestep1(int streamID)
} }
gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize); gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize);
GRIB_CHECK(grib_set_double(gh, "missingValue", GRIB_MISSVAL), 0); GRIB_CHECK(grib_set_double(gh, "missingValue", GRIBAPI_MISSVAL), 0);
GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0); GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
...@@ -1019,6 +1017,7 @@ int gribapiScanTimestep2(int streamID) ...@@ -1019,6 +1017,7 @@ int gribapiScanTimestep2(int streamID)
{ {
int rstatus = 0; int rstatus = 0;
#if defined (HAVE_LIBGRIB_API) #if defined (HAVE_LIBGRIB_API)
int status;
off_t recpos = 0; off_t recpos = 0;
unsigned char *gribbuffer = NULL; unsigned char *gribbuffer = NULL;
long buffersize = 0; long buffersize = 0;
...@@ -1119,7 +1118,7 @@ int gribapiScanTimestep2(int streamID) ...@@ -1119,7 +1118,7 @@ int gribapiScanTimestep2(int streamID)
} }
gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize); gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize);
GRIB_CHECK(grib_set_double(gh, "missingValue", GRIB_MISSVAL), 0); GRIB_CHECK(grib_set_double(gh, "missingValue", GRIBAPI_MISSVAL), 0);
GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0); GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
...@@ -1351,6 +1350,7 @@ int gribapiScanTimestep(int streamID) ...@@ -1351,6 +1350,7 @@ int gribapiScanTimestep(int streamID)
{ {
int rstatus = 0; int rstatus = 0;
#if defined (HAVE_LIBGRIB_API) #if defined (HAVE_LIBGRIB_API)
int status = 0;
long recsize = 0; long recsize = 0;
off_t recpos = 0; off_t recpos = 0;
unsigned char *gribbuffer; unsigned char *gribbuffer;
...@@ -1433,8 +1433,8 @@ int gribapiScanTimestep(int streamID) ...@@ -1433,8 +1433,8 @@ int gribapiScanTimestep(int streamID)
} }
readsize = recsize; readsize = recsize;
status = gribRead(fileID, gribbuffer, &readsize); rstatus = gribRead(fileID, gribbuffer, &readsize);
if ( status ) if ( rstatus )
{ {
Error("Inconsistent timestep %d (GRIB record %d/%d)!\n", tsID+1, rindex+1, Error("Inconsistent timestep %d (GRIB record %d/%d)!\n", tsID+1, rindex+1,
streamptr->tsteps[tsID].recordSize); streamptr->tsteps[tsID].recordSize);
...@@ -1452,7 +1452,7 @@ int gribapiScanTimestep(int streamID) ...@@ -1452,7 +1452,7 @@ int gribapiScanTimestep(int streamID)
} }
gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize); gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize);
GRIB_CHECK(grib_set_double(gh, "missingValue", GRIB_MISSVAL), 0); GRIB_CHECK(grib_set_double(gh, "missingValue", GRIBAPI_MISSVAL), 0);
GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0); GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
......
Supports Markdown
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