Commit 76537e0b authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Convert ncgrid ydimID into array member, too.

parent 092865f6
......@@ -24,7 +24,7 @@ void cdfReadGridTraj(stream_t *streamptr, int gridID)
int gridindex = vlistGridIndex(vlistID, gridID);
int lonID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
int latID = streamptr->ncgrid[gridindex].ydimID;
int latID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
int tsID = streamptr->curTsID;
size_t index = (size_t)tsID;
......@@ -57,7 +57,7 @@ void cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[4], s
else
{
xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
yid = streamptr->ncgrid[gridindex].ydimID;
yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
}
int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
int zid = streamptr->zaxisID[zaxisindex];
......@@ -374,7 +374,7 @@ void cdfInqDimIds(stream_t *streamptr, int varId, int (*outDimIds)[3])
default:
(*outDimIds)[0] = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
(*outDimIds)[1] = streamptr->ncgrid[gridindex].ydimID;
(*outDimIds)[1] = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
break;
}
......
......@@ -356,7 +356,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
if ( gridtype != GRID_TRAJECTORY )
{
xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
yid = streamptr->ncgrid[gridindex].ydimID;
yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
if ( xid != CDI_UNDEFID ) cdf_inq_dimlen(fileID, xid, &xsize);
if ( yid != CDI_UNDEFID ) cdf_inq_dimlen(fileID, yid, &ysize);
}
......@@ -755,7 +755,7 @@ void cdfWriteGridTraj(stream_t *streamptr, int gridID)
{
int gridindex = nc_grid_index(streamptr, gridID);
int lonID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
int latID = streamptr->ncgrid[gridindex].ydimID;
int latID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
double xlon = gridInqXval(gridID, 0);
double xlat = gridInqYval(gridID, 0);
......@@ -981,7 +981,7 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
{
int gridindex = nc_grid_index(streamptr, gridID);
xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
yid = streamptr->ncgrid[gridindex].ydimID;
yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
}
int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
......@@ -1078,7 +1078,7 @@ void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
{
int gridindex = nc_grid_index(streamptr, gridID);
xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
yid = streamptr->ncgrid[gridindex].ydimID;
yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
}
int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
......@@ -1176,7 +1176,7 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
{
int gridindex = nc_grid_index(streamptr, gridID);
xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
yid = streamptr->ncgrid[gridindex].ydimID;
yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
}
int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
......
......@@ -219,12 +219,12 @@ VCT;
#ifdef HAVE_LIBNETCDF
enum {
CDF_DIMID_X,
CDF_DIMID_Y,
CDF_SIZE_ncIDs,
};
typedef struct {
int gridID;
int ncIDs[CDF_SIZE_ncIDs];
int ydimID;
int xvarID;
int yvarID;
int avarID;
......
......@@ -894,7 +894,6 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr->ncgrid[i].gridID = CDI_UNDEFID;
for (size_t j = 0; j < CDF_SIZE_ncIDs; ++j)
streamptr->ncgrid[i].ncIDs[j] = CDI_UNDEFID;
streamptr->ncgrid[i].ydimID = CDI_UNDEFID;
streamptr->ncgrid[i].xvarID = CDI_UNDEFID;
streamptr->ncgrid[i].yvarID = CDI_UNDEFID;
streamptr->ncgrid[i].avarID = CDI_UNDEFID;
......
......@@ -2655,7 +2655,7 @@ void cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nv
int gridindex = vlistGridIndex(vlistID, gridID);
ncgrid[gridindex].gridID = gridID;
ncgrid[gridindex].ncIDs[CDF_DIMID_X] = xdimid;
ncgrid[gridindex].ydimID = ydimid;
ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ydimid;
if ( xdimid == CDI_UNDEFID && ydimid == CDI_UNDEFID && grid->size == 1 )
gridDefHasDims(gridID, FALSE);
......@@ -2999,7 +2999,7 @@ void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int model
int gridindex = vlistGridIndex(vlistID, gridID);
int xdimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X];
int ydimid = streamptr->ncgrid[gridindex].ydimID;
int ydimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
int zdimid = streamptr->zaxisID[zaxisindex];
......
......@@ -382,7 +382,7 @@ cdfDefSPorFC(stream_t *streamptr, int gridID, int gridindex,
for ( int index = 0; index < gridindex; index++ )
{
if ( ncgrid[index].ydimID != CDI_UNDEFID )
if ( ncgrid[index].ncIDs[CDF_DIMID_Y] != CDI_UNDEFID )
{
int gridID0 = ncgrid[index].gridID;
int gridtype0 = gridInqType(gridID0);
......@@ -391,7 +391,7 @@ cdfDefSPorFC(stream_t *streamptr, int gridID, int gridindex,
size_t dimlen0 = (size_t)gridInqSize(gridID0)/2;
if ( dimlen == dimlen0 )
{
dimID = ncgrid[index].ydimID;
dimID = ncgrid[index].ncIDs[CDF_DIMID_Y];
break;
}
else
......@@ -415,7 +415,7 @@ cdfDefSPorFC(stream_t *streamptr, int gridID, int gridindex,
}
ncgrid[gridindex].gridID = gridID;
ncgrid[gridindex].ydimID = dimID;
ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = dimID;
}
static
......@@ -510,7 +510,7 @@ cdfDefTrajLatLon(stream_t *streamptr, int gridID, int gridindex,
if ( dimtype == 'X' )
ncvarid = ncgrid[gridindex].ncIDs[CDF_DIMID_X];
else
ncvarid = ncgrid[gridindex].ydimID;
ncvarid = ncgrid[gridindex].ncIDs[CDF_DIMID_Y];
if ( ncvarid == CDI_UNDEFID )
{
......@@ -531,7 +531,7 @@ cdfDefTrajLatLon(stream_t *streamptr, int gridID, int gridindex,
if ( dimtype == 'X' )
ncgrid[gridindex].ncIDs[CDF_DIMID_X] = ncvarid; /* var ID for trajectory !!! */
else
ncgrid[gridindex].ydimID = ncvarid; /* var ID for trajectory !!! */
ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ncvarid; /* var ID for trajectory !!! */
}
static
......@@ -690,7 +690,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
if ( IS_EQUAL(inqVal(gridID0, 0), inqVal(gridID, 0)) &&
IS_EQUAL(inqVal(gridID0, (int)dimlen-1), inqVal(gridID, (int)dimlen-1)) )
{
dimID = (dimKey == CDI_KEY_XDIMNAME) ? ncgrid[index].ncIDs[CDF_DIMID_X] : ncgrid[index].ydimID;
dimID = (dimKey == CDI_KEY_XDIMNAME) ? ncgrid[index].ncIDs[CDF_DIMID_X] : ncgrid[index].ncIDs[CDF_DIMID_Y];
break;
}
}
......@@ -785,7 +785,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
if ( dimKey == CDI_KEY_XDIMNAME )
ncgrid[gridindex].ncIDs[CDF_DIMID_X] = dimID;
else
ncgrid[gridindex].ydimID = dimID;
ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = dimID;
}
static
......@@ -859,7 +859,7 @@ void cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridindex)
IS_EQUAL(gridInqYval(gridID0, (int)dimlen-1), gridInqYval(gridID, (int)dimlen-1)) )
{
xdimID = ncgrid[index].ncIDs[CDF_DIMID_X];
ydimID = ncgrid[index].ydimID;
ydimID = ncgrid[index].ncIDs[CDF_DIMID_Y];
ncxvarid = ncgrid[index].xvarID;
ncyvarid = ncgrid[index].yvarID;
break;
......@@ -983,7 +983,7 @@ void cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridindex)
ncgrid[gridindex].gridID = gridID;
ncgrid[gridindex].ncIDs[CDF_DIMID_X] = xdimID;
ncgrid[gridindex].ydimID = ydimID;
ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ydimID;
ncgrid[gridindex].xvarID = ncxvarid;
ncgrid[gridindex].yvarID = ncyvarid;
ncgrid[gridindex].avarID = ncavarid;
......@@ -1078,7 +1078,7 @@ void cdfDefGdim(stream_t *streamptr, int gridID, int gridindex)
if ( gridInqXsize(gridID) == 0 )
for ( int index = 0; index < gridindex; index++ )
{
if ( ncgrid[index].ydimID != CDI_UNDEFID )
if ( ncgrid[index].ncIDs[CDF_DIMID_Y] != CDI_UNDEFID )
{
int gridID0 = ncgrid[index].gridID;
int gridtype0 = gridInqType(gridID0);
......@@ -1087,7 +1087,7 @@ void cdfDefGdim(stream_t *streamptr, int gridID, int gridindex)
size_t dimlen0 = (size_t)gridInqSize(gridID0);
if ( dimlen == dimlen0 )
{
dimID = ncgrid[index].ydimID;
dimID = ncgrid[index].ncIDs[CDF_DIMID_Y];
break;
}
else
......@@ -2078,7 +2078,7 @@ void cdfDefVars(stream_t *streamptr)
{
streamptr->ncgrid[index].gridID = CDI_UNDEFID;
streamptr->ncgrid[index].ncIDs[CDF_DIMID_X] = CDI_UNDEFID;
streamptr->ncgrid[index].ydimID = CDI_UNDEFID;
streamptr->ncgrid[index].ncIDs[CDF_DIMID_Y] = CDI_UNDEFID;
streamptr->ncgrid[index].xvarID = CDI_UNDEFID;
streamptr->ncgrid[index].yvarID = CDI_UNDEFID;
streamptr->ncgrid[index].avarID = CDI_UNDEFID;
......
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