Commit 80c58532 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

new attribute routines: vlistInqNatts, vlistInqAttr, vlistDefAttr nd vlistInqAttr

parent 01db1cc0
......@@ -156,6 +156,7 @@ src/varscan.h -text
src/version.c -text
src/vlist.c -text
src/vlist.h -text
src/vlist_att.c -text
src/vlist_var.c -text
src/zaxis.c -text
tests/Makefile.am -text
......
2007-12-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.0.7
* new attribute routines: vlistInqNatts, vlistInqAttr, vlistDefAttr
and vlistInqAttr for Int, Flt and Txt
* add support for Lambert conformal grids
* Version 1.0.9 released
......
......@@ -416,6 +416,18 @@ static void printShortinfo(int streamID, int vlistID, int vardis)
{
fprintf(stdout, "size : dim = %d nvertex = %d\n", gridsize, gridInqNvertex(gridID));
}
else if ( gridtype == GRID_LAMBERT )
{
double originLon, originLat, lonParY, lat1, lat2, xincm, yincm;
gridInqLambert(gridID, &originLon, &originLat, &lonParY, &lat1, &lat2, &xincm, &yincm);
fprintf(stdout, "size : dim = %d nx = %d ny = %d\n", gridsize, xsize, ysize);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, " originLon = %g originLat = %g lonParY = %g\n",
originLon, originLat, lonParY);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, " lat1 = %g lat2 = %g xinc = %gm yinc = %gm\n",
lat1, lat2, xincm, yincm);
}
else /* if ( gridtype == GRID_GENERIC ) */
{
if ( ysize == 0 )
......@@ -431,7 +443,8 @@ static void printShortinfo(int streamID, int vlistID, int vardis)
}
}
if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_CELL || gridtype == GRID_GENERIC )
if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_CELL ||
gridtype == GRID_GENERIC || gridtype == GRID_LAMBERT )
{
if ( gridInqXvals(gridID, NULL) || gridInqYvals(gridID, NULL) || gridHasArea(gridID) ||
gridInqXbounds(gridID, NULL) || gridInqYbounds(gridID, NULL) )
......
......@@ -20,6 +20,7 @@ libcdi_a_SOURCES = \
timebase.c \
vlist.c \
vlist_var.c \
vlist_att.c \
basetime.c \
stream_history.c \
stream_grb.c \
......
......@@ -102,6 +102,7 @@ libcdi_a_SOURCES = \
timebase.c \
vlist.c \
vlist_var.c \
vlist_att.c \
basetime.c \
stream_history.c \
stream_grb.c \
......@@ -175,15 +176,15 @@ am_libcdi_a_OBJECTS = cdiFortran.$(OBJEXT) cdi_error.$(OBJEXT) \
dmemory.$(OBJEXT) model.$(OBJEXT) institution.$(OBJEXT) \
table.$(OBJEXT) util.$(OBJEXT) varscan.$(OBJEXT) \
calendar.$(OBJEXT) timebase.$(OBJEXT) vlist.$(OBJEXT) \
vlist_var.$(OBJEXT) basetime.$(OBJEXT) stream_history.$(OBJEXT) \
stream_grb.$(OBJEXT) stream_cdf.$(OBJEXT) stream_srv.$(OBJEXT) \
stream_ext.$(OBJEXT) stream_ieg.$(OBJEXT) grid.$(OBJEXT) \
grid_rot.$(OBJEXT) grid_gme.$(OBJEXT) zaxis.$(OBJEXT) \
stream.$(OBJEXT) stream_var.$(OBJEXT) stream_record.$(OBJEXT) \
tsteps.$(OBJEXT) stream_int.$(OBJEXT) servicelib.$(OBJEXT) \
extralib.$(OBJEXT) ieglib.$(OBJEXT) cdf.$(OBJEXT) \
cdf_int.$(OBJEXT) file.$(OBJEXT) binary.$(OBJEXT) \
swap.$(OBJEXT) griblib.$(OBJEXT)
vlist_var.$(OBJEXT) vlist_att.$(OBJEXT) basetime.$(OBJEXT) \
stream_history.$(OBJEXT) stream_grb.$(OBJEXT) \
stream_cdf.$(OBJEXT) stream_srv.$(OBJEXT) stream_ext.$(OBJEXT) \
stream_ieg.$(OBJEXT) grid.$(OBJEXT) grid_rot.$(OBJEXT) \
grid_gme.$(OBJEXT) zaxis.$(OBJEXT) stream.$(OBJEXT) \
stream_var.$(OBJEXT) stream_record.$(OBJEXT) tsteps.$(OBJEXT) \
stream_int.$(OBJEXT) servicelib.$(OBJEXT) extralib.$(OBJEXT) \
ieglib.$(OBJEXT) cdf.$(OBJEXT) cdf_int.$(OBJEXT) file.$(OBJEXT) \
binary.$(OBJEXT) swap.$(OBJEXT) griblib.$(OBJEXT)
libcdi_a_OBJECTS = $(am_libcdi_a_OBJECTS)
DEFS = @DEFS@
......@@ -212,8 +213,8 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/taxis.Po ./$(DEPDIR)/timebase.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tsteps.Po ./$(DEPDIR)/util.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/varscan.Po ./$(DEPDIR)/version.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/vlist.Po ./$(DEPDIR)/vlist_var.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zaxis.Po
@AMDEP_TRUE@ ./$(DEPDIR)/vlist.Po ./$(DEPDIR)/vlist_att.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/vlist_var.Po ./$(DEPDIR)/zaxis.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
......@@ -331,6 +332,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varscan.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist_att.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist_var.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zaxis.Po@am__quote@
......
......@@ -8,6 +8,7 @@ extern "C" {
#endif
#define CDI_UNDEFID -1
#define CDI_GLOBAL -1 /* Global var ID for vlist */
/* Byte order */
......@@ -16,6 +17,7 @@ extern "C" {
/* Error identifier */
#define CDI_NOERR 0 /* No Error */
#define CDI_ESYSTEM -10 /* Operating system error */
#define CDI_EINVAL -20 /* Invalid argument */
#define CDI_EUFTYPE -21 /* Unsupported file type */
......@@ -25,7 +27,7 @@ extern "C" {
/* File types */
#define FILETYPE_GRB 1 /* File type GRIB */
#define FILETYPE_G2 2 /* File type GRIB version 2 */
#define FILETYPE_GB2 2 /* File type GRIB version 2 */
#define FILETYPE_NC 3 /* File type netCDF */
#define FILETYPE_NC2 4 /* File type netCDF version 2 */
#define FILETYPE_SRV 5 /* File type SERVICE */
......@@ -38,7 +40,7 @@ extern "C" {
#define COMPRESS_GZIP 2
#define COMPRESS_BZIP2 3
/* Data types */
/* external data types */
#define DATATYPE_PACK 0
#define DATATYPE_PACK1 1
......@@ -79,6 +81,13 @@ extern "C" {
#define DATATYPE_INT16 216
#define DATATYPE_INT32 232
/* internal data types */
#define DATATYPE_INT 251
#define DATATYPE_FLT 252
#define DATATYPE_TXT 253
/* GRID types */
#define GRID_GENERIC 1
......@@ -277,7 +286,6 @@ void vlistDefInstitut(int vlistID, int instID);
int vlistInqInstitut(int vlistID);
void vlistDefModel(int vlistID, int modelID);
int vlistInqModel(int vlistID);
void vlistDefAttribute(int vlistID, const char *attname, const char *attstring);
/* VLIST VAR routines */
......@@ -362,6 +370,23 @@ int vlistFindVar(int vlistID, int fvarID);
int vlistFindLevel(int vlistID, int fvarID, int flevelID);
/* VLIST attributes */
int vlistInqNatts(int vlistID, int varID, int *nattsp);
int vlistInqAttr(int vlistID, int varID, int attrnum, char *name, int *typep, int *lenp);
int vlistDelAttr(int vlistID, int varID, const char *name);
int vlistDefAttrInt(int vlistID, int varID, const char *name, int len, const int *ip);
int vlistDefAttrFlt(int vlistID, int varID, const char *name, int len, const double *dp);
int vlistDefAttrTxt(int vlistID, int varID, const char *name, int len, const char *tp);
int vlistInqAttrInt(int vlistID, int varID, const char *name, int mlen, int *ip);
int vlistInqAttrFlt(int vlistID, int varID, const char *name, int mlen, double *dp);
int vlistInqAttrTxt(int vlistID, int varID, const char *name, int mlen, char *tp);
/* GRID routines */
void gridName(int gridtype, char *gridname);
......@@ -491,6 +516,12 @@ void gridDefGMEni2(int gridID, int ni2);
int gridInqGMEni3(int gridID);
void gridDefGMEni3(int gridID, int ni3);
/* Lambert grid */
void gridDefLambert(int gridID, double originLon, double originLat, double lonParY,
double lat1, double lat2, double xinc, double yinc);
void gridInqLambert(int gridID, double *originLon, double *originLat, double *lonParY,
double *lat1, double *lat2, double *xinc, double *yinc);
void gridDefArea(int gridID, double *area);
void gridInqArea(int gridID, double *area);
int gridHasArea(int gridID);
......
......@@ -182,9 +182,14 @@ static void grid_init_entry(GRID *gridptr)
gridptr->nrowlon = 0;
gridptr->xinc = 0.0;
gridptr->yinc = 0.0;
gridptr->lov = 0.0;
gridptr->lats1 = 0.0;
gridptr->lats2 = 0.0;
gridptr->lam_originLon = 0.0;
gridptr->lam_originLat = 0.0;
gridptr->lam_lonParY = 0.0;
gridptr->lam_lat1 = 0.0;
gridptr->lam_lat2 = 0.0;
gridptr->lam_xinc = 0.0;
gridptr->lam_yinc = 0.0;
gridptr->lam_defined = FALSE;
gridptr->trunc = 0;
gridptr->nvertex = 0;
gridptr->nd = 0;
......@@ -2347,6 +2352,10 @@ int gridGenerate(GRID grid)
gridDefArea(gridID, grid.area);
}
if ( grid.type == GRID_LAMBERT )
gridDefLambert(gridID, grid.lam_originLon, grid.lam_originLat, grid.lam_lonParY,
grid.lam_lat1, grid.lam_lat2, grid.lam_xinc, grid.lam_yinc);
break;
}
case GRID_GAUSSIAN_REDUCED:
......@@ -3684,3 +3693,54 @@ const double *gridInqYvalsPtr(int gridID)
return ( gridptr->yvals );
}
void gridDefLambert(int gridID, double originLon, double originLat, double lonParY,
double lat1, double lat2, double xinc, double yinc)
{
static char func[] = "gridDefLambert";
GRID *gridptr;
gridptr = grid_to_pointer(gridID);
if ( gridptr->type != GRID_LAMBERT )
Warning(func, "Lambert grid definition for %s grid not allowed!", gridNamePtr(gridptr->type));
gridptr->lam_originLon = originLon;
gridptr->lam_originLat = originLat;
gridptr->lam_lonParY = lonParY;
gridptr->lam_lat1 = lat1;
gridptr->lam_lat2 = lat2;
gridptr->lam_xinc = xinc;
gridptr->lam_yinc = yinc;
gridptr->lam_defined = TRUE;
}
void gridInqLambert(int gridID, double *originLon, double *originLat, double *lonParY,
double *lat1, double *lat2, double *xinc, double *yinc)
{
static char func[] = "gridDefLambert";
GRID *gridptr;
gridptr = grid_to_pointer(gridID);
if ( gridptr->type != GRID_LAMBERT )
Warning(func, "Lambert grid definition for %s grid not available!", gridNamePtr(gridptr->type));
else
{
if ( gridptr->lam_defined )
{
*originLon = gridptr->lam_originLon;
*originLat = gridptr->lam_originLat;
*lonParY = gridptr->lam_lonParY;
*lat1 = gridptr->lam_lat1;
*lat2 = gridptr->lam_lat2;
*xinc = gridptr->lam_xinc;
*yinc = gridptr->lam_yinc;
}
else
Warning(func, "Lambert grid undefined (gridID = %d)", gridID);
}
}
......@@ -15,7 +15,14 @@ typedef struct {
double xfirst, yfirst;
double xlast, ylast;
double xinc, yinc;
double lov, lats1, lats2; /* lambert grid */
double lam_originLon; /* lambert */
double lam_originLat;
double lam_lonParY;
double lam_lat1;
double lam_lat2;
double lam_xinc;
double lam_yinc;
int lam_defined;
double xpole, ypole, angle; /* rotated north pole */
int isCyclic; /* TRUE for global cyclic grids */
int isRotated; /* TRUE for rotated grids */
......
......@@ -64,6 +64,7 @@ c="dmemory.c \
util.c \
varscan.c \
vlist.c \
vlist_att.c \
vlist_var.c \
basetime.c \
servicelib.c \
......
......@@ -3268,7 +3268,8 @@ int cdfInqContents(int streamID)
if ( xtype == NC_CHAR )
{
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen);
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen-1);
attstring[attlen+1] = 0;
if ( attlen > 0 && attstring[0] != 0 )
{
......@@ -3278,14 +3279,14 @@ int cdfInqContents(int streamID)
}
else if ( strcmp(attname, "institution") == 0 )
{
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen);
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen-1);
instID = institutInq(0, 0, NULL, attstring);
if ( instID == UNDEFID )
instID = institutDef(0, 0, NULL, attstring);
}
else if ( strcmp(attname, "source") == 0 )
{
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen);
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen-1);
modelID = modelInq(-1, 0, attstring);
}
else if ( strcmp(attname, "Conventions") == 0 )
......@@ -3299,15 +3300,15 @@ int cdfInqContents(int streamID)
}
else
{
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen);
vlistDefAttribute(vlistID, attname, attstring);
cdfGetAttText(fileID, NC_GLOBAL, attname, attstring, attstringlen-1);
vlistDefAttrTxt(vlistID, CDI_GLOBAL, attname, (int)strlen(attstring)+1, attstring);
}
}
}
else if ( xtype == NC_INT )
else if ( xtype == NC_INT && attlen == 1 )
{
cdfGetAttInt(fileID, NC_GLOBAL, attname, &attint);
vlistDefIntAttribute(vlistID, attname, attint);
vlistDefAttrInt(vlistID, CDI_GLOBAL, attname, 1, &attint);
}
}
......@@ -3398,14 +3399,14 @@ int cdfInqContents(int streamID)
else if ( strcmp(attname, "trunc_type") == 0 )
{
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
if ( strncmp(attstring, "Triangular", attlen) == 0 )
ncvars[ncvarid].gridtype = GRID_SPECTRAL;
}
else if ( strcmp(attname, "grid_type") == 0 )
{
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
if ( strncmp(attstring, "gaussian", attlen) == 0 )
ncvars[ncvarid].gridtype = GRID_GAUSSIAN;
......@@ -3465,7 +3466,7 @@ int cdfInqContents(int streamID)
{
int status, ncboundsid;
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
status = nc_inq_varid(fileID, attstring, &ncboundsid);
......@@ -3482,7 +3483,7 @@ int cdfInqContents(int streamID)
{
char *pstring, *cell_measures = NULL, *cell_var = NULL;
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
pstring = attstring;
while ( isspace((int) *pstring) ) pstring++;
......@@ -3522,7 +3523,7 @@ int cdfInqContents(int streamID)
{
char *pstring, *xvarname = NULL, *yvarname = NULL;
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
pstring = attstring;
while ( isspace((int) *pstring) ) pstring++;
......@@ -3551,7 +3552,7 @@ int cdfInqContents(int streamID)
int dimvarid;
extern int cdiIgnoreAttCoordinates;
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
pstring = attstring;
for ( i = 0; i < 4; i++ )
......@@ -3582,7 +3583,7 @@ int cdfInqContents(int streamID)
int status;
int nc_gmap_id;
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
status = nc_inq_varid(fileID, attstring, &nc_gmap_id);
if ( status == NC_NOERR )
......@@ -3598,7 +3599,7 @@ int cdfInqContents(int streamID)
else if ( strcmp(attname, "positive") == 0 )
{
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
if ( strncmp(attstring, "down", attlen) == 0 ) ncvars[ncvarid].positive = -1;
else if ( strncmp(attstring, "up", attlen) == 0 ) ncvars[ncvarid].positive = 1;
......@@ -3619,7 +3620,7 @@ int cdfInqContents(int streamID)
}
else if ( strcmp(attname, "axis") == 0 )
{
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, attname, attstring, attstringlen-1);
cdf_inq_attlen(fileID, ncvarid, attname, &attlen);
/* attlen = strlen(attstring); */
/* check attlen */
......@@ -4344,7 +4345,7 @@ int cdfInqContents(int streamID)
if ( strcmp(attname, "grid_mapping_name") == 0 )
{
cdfGetAttText(fileID, ncvars[ncvarid].gmapid, attname, attstring, attstringlen);
cdfGetAttText(fileID, ncvars[ncvarid].gmapid, attname, attstring, attstringlen-1);
if ( strcmp(attstring, "rotated_latitude_longitude") == 0 )
grid.isRotated = TRUE;
......@@ -4685,7 +4686,7 @@ int cdfInqContents(int streamID)
TAXIS *taxis;
taxis = &streamptr->tsteps[0].taxis;
cdfGetAttText(fileID, ncvarid, "units", attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, "units", attstring, attstringlen-1);
if ( splitBasetime(attstring, taxis) == 1 )
streamptr->basetime.ncvarid = UNDEFID;
}
......@@ -4696,7 +4697,7 @@ int cdfInqContents(int streamID)
if ( ncvarid != -1 )
if ( ncvars[ncvarid].calendar == TRUE )
{
cdfGetAttText(fileID, ncvarid, "calendar", attstring, attstringlen);
cdfGetAttText(fileID, ncvarid, "calendar", attstring, attstringlen-1);
if ( strcmp(attstring, "standard") == 0 ||
strcmp(attstring, "gregorian") == 0 )
......@@ -4908,6 +4909,13 @@ void cdfDefGlobalAtts(int streamID)
size_t len;
VLIST *vlistptr;
STREAM *streamptr;
int natts;
char attrname[256];
int attrtype;
int attrlen;
int attrint;
double attrflt;
char attrtxt[2048];
streamptr = stream_to_pointer(streamID);
......@@ -4918,38 +4926,42 @@ void cdfDefGlobalAtts(int streamID)
vlistptr = vlist_to_pointer(vlistID);
if ( vlistptr->natts > 0 )
{
if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
for ( iatt = 0; iatt < vlistptr->natts; iatt++ )
{
if ( vlistptr->attstrings[iatt] )
{
len = strlen(vlistptr->attstrings[iatt]);
cdf_put_att_text(fileID, NC_GLOBAL, vlistptr->attnames[iatt],
len, vlistptr->attstrings[iatt]);
}
}
if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
}
cdfDefSource(streamID);
cdfDefInstitut(streamID);
if ( vlistptr->niatts > 0 )
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
if ( natts > 0 && streamptr->ncmode == 2 ) cdf_redef(fileID);
for ( iatt = 0; iatt < natts; ++iatt )
{
if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
for ( iatt = 0; iatt < vlistptr->niatts; iatt++ )
vlistInqAttr(vlistID, CDI_GLOBAL, iatt, attrname, &attrtype, &attrlen);
if ( attrtype == DATATYPE_TXT )
{
cdf_put_att_int(fileID, NC_GLOBAL, vlistptr->iattnames[iatt], NC_INT, 1L, &vlistptr->iatts[iatt]);
vlistInqAttrTxt(vlistID, CDI_GLOBAL, attrname, sizeof(attrtxt), attrtxt);
len = strlen(attrtxt);
cdf_put_att_text(fileID, NC_GLOBAL, attrname, len+1, attrtxt);
}
else if ( attrtype == DATATYPE_INT )
{
vlistInqAttrInt(vlistID, CDI_GLOBAL, attrname, 1, &attrint);
cdf_put_att_int(fileID, NC_GLOBAL, attrname, NC_INT, 1L, &attrint);
}
else if ( attrtype == DATATYPE_FLT )
{
vlistInqAttrFlt(vlistID, CDI_GLOBAL, attrname, 1, &attrflt);
cdf_put_att_double(fileID, NC_GLOBAL, attrname, NC_DOUBLE, 1L, &attrflt);
}
if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
}
if ( natts > 0 && streamptr->ncmode == 2 ) cdf_enddef(fileID);
streamptr->globalatts = 1;
#endif
}
void cdfDefLocalAtts(int streamID)
{
#if defined (HAVE_LIBNETCDF)
......
......@@ -846,19 +846,18 @@ void grbAddRecord(int streamID, int code, int *isec1, int *isec2, double *fsec2,
grid.size = ISEC4_NumValues;
grid.xsize = ISEC2_NumLon;
grid.ysize = ISEC2_NumLat;
grid.xinc = ISEC2_Xinc;
grid.yinc = ISEC2_Yinc;
grid.xfirst = ISEC2_FirstLon * 0.001;
grid.xdef = 0;
grid.lam_xinc = ISEC2_Xinc;
grid.lam_yinc = ISEC2_Yinc;
grid.lam_originLon = ISEC2_FirstLon * 0.001;
grid.lam_originLat = ISEC2_FirstLat * 0.001;
grid.lam_lonParY = ISEC2_LoV * 0.001;
grid.lam_lat1 = ISEC2_LatS1 * 0.001;
grid.lam_lat2 = ISEC2_LatS2 * 0.001;
grid.yfirst = ISEC2_FirstLat * 0.001;
grid.xdef = 0;
grid.ydef = 0;
grid.lov = ISEC2_LoV * 0.001;
grid.lats1 = ISEC2_LatS1 * 0.001;
grid.lats2 = ISEC2_LatS2 * 0.001;
break;
}
case GRID_SPECTRAL:
......@@ -1836,10 +1835,10 @@ void grbDefGrid(int *isec1, int *isec2, int gridID)
}
else
{
nlon = (int) gridInqXsize(gridID);
nlon = gridInqXsize(gridID);
}
nlat = (int) gridInqYsize(gridID);
nlat = gridInqYsize(gridID);
if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED )
ISEC2_GridType = 4;
else if ( gridtype == GRID_LONLAT && gridIsRotated(gridID) )
......
......@@ -154,9 +154,9 @@ static void vlist_init_entry(VLIST *vlistptr)
vlistptr->modelID = cdiDefaultModelID;
vlistptr->tableID = cdiDefaultTableID;
vlistptr->varsAllocated = 0;
vlistptr->natts = 0;
vlistptr->niatts = 0;
vlistptr->ntsteps = CDI_UNDEFID;
vlistptr->atts.nalloc = MAX_ATTRIBUTES;
vlistptr->atts.nelems = 0;
}
......@@ -309,15 +309,9 @@ void vlistDestroy(int vlistID)
else
{
int nvars = vlistptr->nvars;
int varID, attID;
int varID;
for ( attID = 0; attID < vlistptr->natts; attID++ )
{
free(vlistptr->attnames[attID]);
if ( vlistptr->attstrings[attID] )
free(vlistptr->attstrings[attID]);
}
vlistDelAtts(vlistID, CDI_GLOBAL);
for ( varID = 0; varID < nvars; varID++ )
if ( vlistptr->vars[varID].levinfo ) free(vlistptr->vars[varID].levinfo);
......@@ -384,7 +378,6 @@ The function @func{vlistCopy} copies all entries from vlistID1 to vlistID2.
void vlistCopy(int vlistID2, int vlistID1)
{
static char func[] = "vlistCopy";
int attID;
VLIST *vlistptr1, *vlistptr2;