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

grib cleanup

parent 420ce563
......@@ -134,6 +134,11 @@ static int getFiletype(const char *filename, int *byteorder)
filetype = FILETYPE_GRB;
if ( CDI_Debug ) Message(func, "found GRIB file = %s, version %d", filename, version);
}
else if ( version == 2 )
{
filetype = FILETYPE_GRB2;
if ( CDI_Debug ) Message(func, "found GRIB2 file = %s", filename);
}
}
else if ( memcmp(buffer, "CDF\001", 4) == 0 )
{
......@@ -178,7 +183,7 @@ static int getFiletype(const char *filename, int *byteorder)
filetype = FILETYPE_GRB;
if ( CDI_Debug ) Message(func, "found seek GRIB file = %s", filename);
}
if ( version == 2 )
else if ( version == 2 )
{
filetype = FILETYPE_GRB2;
if ( CDI_Debug ) Message(func, "found seek GRIB2 file = %s", filename);
......@@ -350,7 +355,7 @@ The valid CDI file format types are @func{FILETYPE_GRB}, @func{FILETYPE_GRB2}, @
int streamInqFiletype(int streamID)
{
static char func[] = "streamInqFiletype";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -398,7 +403,7 @@ void streamDefByteorder(int streamID, int byteorder)
{
static char func[] = "streamDefByteorder";
int filetype, fileID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -462,7 +467,7 @@ The valid CDI byte order types are @func{CDI_BIGENDIAN} and @func{CDI_LITTLEENDI
int streamInqByteorder(int streamID)
{
static char func[] = "streamInqByteorder";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -487,7 +492,7 @@ char *streamFilesuffix(int filetype)
char *streamFilename(int streamID)
{
static char func[] = "streamFilename";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -502,7 +507,7 @@ int cdiInqTimeSize(int streamID)
static char func[] = "cdiInqTimeSize";
int ntsteps;
int tsID = 0, nrecs;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -526,7 +531,7 @@ int cdiInqContents(int streamID)
int vlistID;
int taxisID;
int status = 0;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -546,7 +551,9 @@ int cdiInqContents(int streamID)
#if defined (HAVE_LIBGRIB_API)
case FILETYPE_GRB2:
{
/* status = grb2InqContents(streamID); */
Message(func, "%s unsupported!", strfiletype(filetype));
status = CDI_ELIBNAVAIL;
/* status = grb2InqContents(streamID); */
break;
}
#endif
......@@ -608,7 +615,7 @@ int streamOpen(const char *filename, const char *filemode, int filetype)
int streamID = CDI_ESYSTEM;
int status;
Record *record = NULL;
STREAM *streamptr = NULL;
stream_t *streamptr = NULL;
if ( CDI_Debug )
Message(func, "Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
......@@ -719,7 +726,7 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
int streamID = CDI_ESYSTEM;
int status;
Record *record = NULL;
STREAM *streamptr = NULL;
stream_t *streamptr = NULL;
if ( CDI_Debug )
Message(func, "Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
......@@ -977,7 +984,7 @@ int streamOpenRead(const char *filenames)
int num_fnames;
char *fnames[MAX_FNAMES];
const char *filename;
STREAM *streamptr = NULL;
stream_t *streamptr = NULL;
num_fnames = get_fnames(filenames, fnames, MAX_FNAMES);
......@@ -1019,7 +1026,7 @@ int streamOpenAppend(const char *filename)
{
int filetype, byteorder;
int streamID;
STREAM *streamptr;
stream_t *streamptr;
filetype = getFiletype(filename, &byteorder);
......@@ -1102,7 +1109,7 @@ void streamClose(int streamID)
int fileID;
int index;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1240,7 +1247,7 @@ void streamSync(int streamID)
int filetype;
int fileID;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1302,7 +1309,7 @@ int streamDefTimestep(int streamID, int tsID)
int newtsID;
int taxisID;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1367,7 +1374,7 @@ int streamInqTimestep(int streamID, int tsID)
int nrecs = 0;
int taxisID;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1481,7 +1488,7 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
{
static char func[] = "streamReadVar";
int filetype;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1569,7 +1576,7 @@ void streamWriteVar(int streamID, int varID, double *data, int nmiss)
{
static char func[] = "streamWriteVar";
int filetype;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1660,7 +1667,7 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
static char func[] = "streamReadVarSlice";
int filetype;
int ierr = 0;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1747,7 +1754,7 @@ void streamWriteVarSlice(int streamID, int varID, int levelID, double *data, int
static char func[] = "streamWriteVarSlice";
int filetype;
int ierr = 0;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1828,7 +1835,7 @@ void streamWriteContents(int streamID, char *cname)
int i;
off_t recpos, position;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1975,7 +1982,7 @@ void cdiPrintVersion(void)
int streamNtsteps(int streamID)
{
static char func[] = "streamNtsteps";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1987,7 +1994,7 @@ int streamNtsteps(int streamID)
off_t streamNvals(int streamID)
{
static char func[] = "streamNvals";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2015,7 +2022,7 @@ void streamDefVlist(int streamID, int vlistID)
static char func[] = "streamDefVlist";
int nvars, varID;
int gridID, zaxisID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2067,7 +2074,7 @@ The function @func{streamInqVlist} returns the variable list of a stream.
int streamInqVlist(int streamID)
{
static char func[] = "streamInqVlist";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2080,7 +2087,7 @@ int streamInqVlist(int streamID)
void streamDefZtype(int streamID, int ztype)
{
static char func[] = "streamDefZtype";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2093,7 +2100,7 @@ void streamDefZtype(int streamID, int ztype)
void streamDefZlevel(int streamID, int zlevel)
{
static char func[] = "streamDefZlevel";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2106,7 +2113,7 @@ void streamDefZlevel(int streamID, int zlevel)
int streamInqZtype(int streamID)
{
static char func[] = "streamInqZtype";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2119,7 +2126,7 @@ int streamInqZtype(int streamID)
int streamInqZlevel(int streamID)
{
static char func[] = "streamInqZlevel";
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......
......@@ -432,8 +432,8 @@ int cdfCopyRecord(int streamID2, int streamID1)
int nmiss;
int ierr = 0;
int vlistID1, vlistID2;
STREAM *streamptr1;
STREAM *streamptr2;
stream_t *streamptr1;
stream_t *streamptr2;
streamptr1 = stream_to_pointer(streamID1);
streamptr2 = stream_to_pointer(streamID2);
......@@ -473,7 +473,7 @@ int cdfInqRecord(int streamID, int *varID, int *levelID)
{
static char func[] = "cdfInqRecord";
int tsID, recID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -505,7 +505,7 @@ int cdfDefRecord(int streamID)
{
static char func[] = "cdfDefRecord";
int ierr = 0;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -525,7 +525,7 @@ void cdfWriteGridTraj(int streamID, int gridID)
size_t index;
double xlon, xlat;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -555,7 +555,7 @@ void cdfReadGridTraj(int streamID, int gridID)
size_t index;
double xlon, xlat;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -610,7 +610,7 @@ void cdfDefVarDeflate(int ncid, int ncvarid, int deflate_level)
void cdfDefMissval(int streamID, int varID, int dtype)
{
#if defined (HAVE_LIBNETCDF)
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -648,7 +648,7 @@ void cdfWriteRecord(int streamID, double *data, int nmiss)
static char func[] = "cdfWriteRecord";
int varID;
int levelID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -667,7 +667,7 @@ int cdfReadRecord(int streamID, double *data, int *nmiss)
static char func[] = "cdfReadRecord";
int ierr = 0;
int levelID, varID, tsID, recID, vrecID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -694,7 +694,7 @@ void cdfDefTimeValue(int streamID, int tsID)
int ncvarid;
size_t index;
TAXIS *taxis;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -764,7 +764,7 @@ void cdfDefTime(int streamID)
char calstr[80];
size_t len;
TAXIS *taxis;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -874,7 +874,7 @@ void cdfDefComplex(int streamID, int gridID)
int fileID;
int dimlen;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -929,7 +929,7 @@ void cdfDefSpc(int streamID, int gridID)
int fileID;
int dimlen, dimlen0;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -995,7 +995,7 @@ void cdfDefTrajLon(int streamID, int gridID)
int ncvarid;
int vlistID;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1055,7 +1055,7 @@ void cdfDefTrajLat(int streamID, int gridID)
int ncvarid;
int vlistID;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1121,7 +1121,7 @@ void cdfDefXaxis(int streamID, int gridID)
int nvertex = 2, nvdimID = -1;
int vlistID;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1285,7 +1285,7 @@ void cdfDefYaxis(int streamID, int gridID)
int nvdimID = -1;
int vlistID;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1455,7 +1455,7 @@ void cdfDefLonLat2D(int streamID, int gridID)
int nvertex = 4, nvdimID = -1;
int vlistID;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1624,7 +1624,7 @@ void cdfDefRgrid(int streamID, int gridID)
int dimlen, dimlen0;
int vlistID;
int lwarn = TRUE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1694,7 +1694,7 @@ void cdfDefGdim(int streamID, int gridID)
int fileID;
int dimlen, dimlen0;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1792,7 +1792,7 @@ void cdfDefCell(int streamID, int gridID)
int nvertex, nvdimID = -1;
int vlistID;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -1937,7 +1937,7 @@ void cdfDefVCT(int streamID, int zaxisID)
#if defined (HAVE_LIBNETCDF)
static char func[] = "cdfDefVCT";
int type;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2084,7 +2084,7 @@ void cdfDefZaxis(int streamID, int zaxisID)
int vlistID;
int zaxisindex;
int xtype = NC_DOUBLE;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2395,7 +2395,7 @@ void cdfDefGrid(int streamID, int gridID)
int gridtype, size;
int gridindex;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2499,7 +2499,7 @@ int cdfDefVar(int streamID, int varID)
int vlistID;
int iax = 0;
char axis[5];
STREAM *streamptr;
stream_t *streamptr;
int retval;
streamptr = stream_to_pointer(streamID);
......@@ -2788,7 +2788,7 @@ void cdfReadVarDP(int streamID, int varID, double *data, int *nmiss)
double missval;
int laddoffset, lscalefactor;
double addoffset, scalefactor;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -2916,7 +2916,7 @@ void cdfWriteVarDP(int streamID, int varID, double *data, int nmiss)
int i;
int dtype;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -3074,7 +3074,7 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
double missval;
int laddoffset, lscalefactor;
double addoffset, scalefactor;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -3300,7 +3300,7 @@ int cdfWriteVarSliceDP(int streamID, int varID, int levelID, double *data, int n
int i;
int dtype;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
extern int CDF_Debug;
streamptr = stream_to_pointer(streamID);
......@@ -3451,7 +3451,7 @@ void cdfCreateRecords(int streamID, int tsID)
RECORD *records = NULL;
int *recIDs = NULL;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -4414,7 +4414,7 @@ int cdfInqContents(int streamID)
NCDIM *ncdims;
NCVAR *ncvars;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
int format = 0;
streamptr = stream_to_pointer(streamID);
......@@ -5815,7 +5815,7 @@ int cdfInqTimestep(int streamID, int tsID)
int fileID;
size_t index;
TAXIS *taxis;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -5876,7 +5876,7 @@ void cdfEndDef(int streamID)
int varID, ncvarid;
int nvars;
int fileID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -5908,7 +5908,7 @@ void cdfDefInstitut(int streamID)
char *longname;
size_t len;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -5937,7 +5937,7 @@ void cdfDefSource(int streamID)
char *longname;
size_t len;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -5965,7 +5965,7 @@ void cdfDefGlobalAtts(int streamID)
#if defined (HAVE_LIBNETCDF)
int fileID, vlistID;
VLIST *vlistptr;
STREAM *streamptr;
stream_t *streamptr;
int natts;
streamptr = stream_to_pointer(streamID);
......@@ -6001,7 +6001,7 @@ void cdfDefLocalAtts(int streamID)
size_t len;
int ncvarid;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -6038,7 +6038,7 @@ void cdfDefHistory(int streamID, int size, char *history)
{
#if defined (HAVE_LIBNETCDF)
int ncid;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -6052,7 +6052,7 @@ int cdfInqHistorySize(int streamID)
size_t size = 0;
#if defined (HAVE_LIBNETCDF)
int ncid;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -6069,7 +6069,7 @@ void cdfInqHistoryString(int streamID, char *history)
{
#if defined (HAVE_LIBNETCDF)
int ncid;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -6090,7 +6090,7 @@ void cdfDefVars(int streamID)
/*
int ncvarid;
*/
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......
......@@ -67,7 +67,7 @@ int extInqRecord(int streamID, int *varID, int *levelID)
int header[4];
int vlistID;
EXTREC *extp;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -112,7 +112,7 @@ int extReadRecord(int streamID, double *data, int *nmiss)
int i, size;
double missval;
EXTREC *extp;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -162,8 +162,8 @@ int extCopyRecord(int streamID2, int streamID1)
off_t recpos;
int status = 0;
char *buffer;
STREAM *streamptr1;
STREAM *streamptr2;
stream_t *streamptr1;
stream_t *streamptr2;
streamptr1 = stream_to_pointer(streamID1);
streamptr2 = stream_to_pointer(streamID2);
......@@ -203,7 +203,7 @@ int extDefRecord(int streamID)
int status = 0;
int datatype;
EXTREC *extp;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -234,7 +234,7 @@ int extWriteRecord(int streamID, const double *data)
int fileID;
int status = 0;
EXTREC *extp;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -262,7 +262,7 @@ void extAddRecord(int streamID, int code, int level, int xysize,
RECORD *record;
grid_t grid;
int vlistID;
STREAM *streamptr;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
......@@ -314,7 +314,7 @@ void extCmpRecord(int streamID, int tsID, int recID, off_t position, int code,