Commit 2b1e78ef authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Maintain coordinates attribute and added maximal string length to functions

parent c03ae90d
......@@ -558,7 +558,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
char coordinates[CDI_MAX_NAME]; coordinates[0] = 0;
if ( zaxis_is_scalar )
if ( zaxis_is_scalar || zaxisInqType(zaxisID) == ZAXIS_CHAR )
{
int nczvarID = streamptr->nczvarID[zaxisindex];
if ( nczvarID != CDI_UNDEFID )
......
......@@ -1011,11 +1011,17 @@ void zaxisPrint(int zaxisID);
void zaxisDefLevels(int zaxisID, const double levels[]);
/* zaxisDefCvals: Define area types of a Z-axis */
void zaxisDefCvals(int zaxisID, const char *cvals[]);
void zaxisDefCvals(int zaxisID, const char *cvals[], size_t clength);
/* zaxisInqLevels: Get all levels of a Z-axis */
int zaxisInqLevels(int zaxisID, double levels[]);
/* zaxisInqCLen: Get maximal string length of character Z-axis */
int zaxisInqCLen(int zaxisID);
/* zaxisInqCLevels: Get all string values of a character Z-axis */
int zaxisInqCLevels(int zaxisID, char ***clevels);
/* zaxisDefLevel: Define one level of a Z-axis */
void zaxisDefLevel(int zaxisID, int levelID, double levels);
......
......@@ -2853,6 +2853,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
double *zvar = NULL;
char **zcvals = NULL;
size_t zclength = 0;
int zaxisType = CDI_UNDEFID;
if ( zvarid != CDI_UNDEFID ) zaxisType = ncvars[zvarid].zaxistype;
......@@ -2880,8 +2881,8 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if ( ncvars[zvarid].ndims == 2 )
{
zprec = CDI_DATATYPE_UINT8;
size_t strlength = ncdims[ncvars[zvarid].dimids[1]].len;
cdf_load_cvals(zsize*strlength, zvarid, ncvar, &zcvals, zsize);
zclength = ncdims[ncvars[zvarid].dimids[1]].len;
cdf_load_cvals(zsize*zclength, zvarid, ncvar, &zcvals, zsize);
}
}
......@@ -2946,7 +2947,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
return CDI_EDIMSIZE;
}
ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, (const char **)zcvals, with_bounds, lbounds, ubounds,
ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, (const char **)zcvals, zclength, with_bounds, lbounds, ubounds,
(int)vctsize, vct, pname, plongname, punits, zprec, 1, 0);
int zaxisID = ncvar->zaxisID;
......
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