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

Changed -1 to UNDEFID.

parent f4849954
...@@ -2037,7 +2037,7 @@ void cdf_set_grid_to_similar_vars(ncvar_t *ncvar1, ncvar_t *ncvar2, int gridtype ...@@ -2037,7 +2037,7 @@ void cdf_set_grid_to_similar_vars(ncvar_t *ncvar1, ncvar_t *ncvar2, int gridtype
if ( ncvar2->isvar == TRUE && ncvar2->gridID == UNDEFID ) if ( ncvar2->isvar == TRUE && ncvar2->gridID == UNDEFID )
{ {
int xdimid2 = UNDEFID, ydimid2 = UNDEFID, zdimid2 = UNDEFID; int xdimid2 = UNDEFID, ydimid2 = UNDEFID, zdimid2 = UNDEFID;
int xdimidx = -1, ydimidx = -1; int xdimidx = UNDEFID, ydimidx = UNDEFID;
int ndims2 = ncvar2->ndims; int ndims2 = ncvar2->ndims;
for ( int i = 0; i < ndims2; i++ ) for ( int i = 0; i < ndims2; i++ )
...@@ -2102,25 +2102,25 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int ...@@ -2102,25 +2102,25 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
for ( int ncvarid = 0; ncvarid < nvars; ++ncvarid ) for ( int ncvarid = 0; ncvarid < nvars; ++ncvarid )
{ {
ncvar_t *ncvar = &ncvars[ncvarid]; ncvar_t *ncvar = &ncvars[ncvarid];
int gmapvarid = ncvar->gmapid;
if ( ncvar->isvar && ncvar->gridID == UNDEFID ) if ( ncvar->isvar && ncvar->gridID == UNDEFID )
{ {
bool islon = false, islat = false; bool islon = false, islat = false;
int vdimid = -1; int gmapvarid = ncvar->gmapid;
int ndims = ncvar->ndims; int ndims = ncvar->ndims;
int *dimtype = ncvar->dimtype; int *dimtype = ncvar->dimtype;
int vdimid = UNDEFID;
size_t size = 0; size_t size = 0;
size_t xsize = 0, ysize = 0; size_t xsize = 0, ysize = 0;
struct addIffNewRes projAdded = { .Id = CDI_UNDEFID, .isNew = 0 }, struct addIffNewRes projAdded = { .Id = CDI_UNDEFID, .isNew = 0 },
gridAdded = { .Id = CDI_UNDEFID, .isNew = 0 }; gridAdded = { .Id = CDI_UNDEFID, .isNew = 0 };
int xdimid = -1, ydimid = -1; int xdimid = UNDEFID, ydimid = UNDEFID;
int nydims = cdf_get_xydimid(ndims, ncvar->dimids, dimtype, &xdimid, &ydimid); int nydims = cdf_get_xydimid(ndims, ncvar->dimids, dimtype, &xdimid, &ydimid);
int xvarid = ncvar->xvarid != UNDEFID int xvarid = ncvar->xvarid != UNDEFID
? ncvar->xvarid : (xdimid != UNDEFID ? ncdims[xdimid].ncvarid : -1); ? ncvar->xvarid : (xdimid != UNDEFID ? ncdims[xdimid].ncvarid : UNDEFID);
int yvarid = ncvar->yvarid != UNDEFID int yvarid = ncvar->yvarid != UNDEFID
? ncvar->yvarid : (ydimid != UNDEFID ? ncdims[ydimid].ncvarid : -1); ? ncvar->yvarid : (ydimid != UNDEFID ? ncdims[ydimid].ncvarid : UNDEFID);
if ( xdimid != UNDEFID ) xsize = ncdims[xdimid].len; if ( xdimid != UNDEFID ) xsize = ncdims[xdimid].len;
if ( ydimid != UNDEFID ) ysize = ncdims[ydimid].len; if ( ydimid != UNDEFID ) ysize = ncdims[ydimid].len;
...@@ -2327,7 +2327,7 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int ...@@ -2327,7 +2327,7 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
grid->y.size = (int)ysize; grid->y.size = (int)ysize;
if ( xvarid != UNDEFID ) if ( xvarid != UNDEFID )
{ {
grid->xdef = 1; grid->xdef = 1;
if ( ncvars[xvarid].bounds != UNDEFID ) if ( ncvars[xvarid].bounds != UNDEFID )
{ {
int nbdims = ncvars[ncvars[xvarid].bounds].ndims; int nbdims = ncvars[ncvars[xvarid].bounds].ndims;
...@@ -2342,13 +2342,13 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int ...@@ -2342,13 +2342,13 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
} }
if ( yvarid != UNDEFID ) if ( yvarid != UNDEFID )
{ {
grid->ydef = 1; grid->ydef = 1;
if ( ncvars[yvarid].bounds != UNDEFID ) if ( ncvars[yvarid].bounds != UNDEFID )
{ {
int nbdims = ncvars[ncvars[yvarid].bounds].ndims; int nbdims = ncvars[ncvars[yvarid].bounds].ndims;
if ( nbdims == 2 || nbdims == 3 ) if ( nbdims == 2 || nbdims == 3 )
{ {
if ( vdimid == -1 ) if ( vdimid == UNDEFID )
{ {
vdimid = ncvars[ncvars[xvarid].bounds].dimids[nbdims-1]; vdimid = ncvars[ncvars[xvarid].bounds].dimids[nbdims-1];
size_t nvertex = ncdims[vdimid].len; size_t nvertex = ncdims[vdimid].len;
...@@ -2544,7 +2544,7 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int ...@@ -2544,7 +2544,7 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if ( grid->type == GRID_UNSTRUCTURED ) if ( grid->type == GRID_UNSTRUCTURED )
{ {
int zdimid = UNDEFID; int zdimid = UNDEFID;
int xdimidx = -1, ydimidx = -1; int xdimidx = UNDEFID, ydimidx = UNDEFID;
for ( int i = 0; i < ndims; i++ ) for ( int i = 0; i < ndims; i++ )
{ {
...@@ -2633,13 +2633,13 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int ...@@ -2633,13 +2633,13 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
int gridindex = vlistGridIndex(vlistID, ncvar->gridID); int gridindex = vlistGridIndex(vlistID, ncvar->gridID);
streamptr->xdimID[gridindex] = xdimid; streamptr->xdimID[gridindex] = xdimid;
streamptr->ydimID[gridindex] = ydimid; streamptr->ydimID[gridindex] = ydimid;
if ( xdimid == -1 && ydimid == -1 && grid->size == 1 ) if ( xdimid == UNDEFID && ydimid == UNDEFID && grid->size == 1 )
gridDefHasDims(ncvar->gridID, FALSE); gridDefHasDims(ncvar->gridID, FALSE);
int gridID = ncvar->gridID; int gridID = ncvar->gridID;
if ( xdimid != -1 ) cdiGridDefKeyStr(gridID, CDI_KEY_XDIMNAME, (int)(strlen(ncdims[xdimid].name)+1), ncdims[xdimid].name); if ( xdimid != UNDEFID ) cdiGridDefKeyStr(gridID, CDI_KEY_XDIMNAME, (int)(strlen(ncdims[xdimid].name)+1), ncdims[xdimid].name);
if ( ydimid != -1 ) cdiGridDefKeyStr(gridID, CDI_KEY_YDIMNAME, (int)(strlen(ncdims[ydimid].name)+1), ncdims[ydimid].name); if ( ydimid != UNDEFID ) cdiGridDefKeyStr(gridID, CDI_KEY_YDIMNAME, (int)(strlen(ncdims[ydimid].name)+1), ncdims[ydimid].name);
if ( vdimid != -1 ) cdiGridDefKeyStr(gridID, CDI_KEY_VDIMNAME, (int)(strlen(ncdims[vdimid].name)+1), ncdims[vdimid].name); if ( vdimid != UNDEFID ) cdiGridDefKeyStr(gridID, CDI_KEY_VDIMNAME, (int)(strlen(ncdims[vdimid].name)+1), ncdims[vdimid].name);
if ( CDI_Debug ) if ( CDI_Debug )
Message("gridID %d %d %s", ncvar->gridID, ncvarid, ncvar->name); Message("gridID %d %d %s", ncvar->gridID, ncvarid, ncvar->name);
......
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