Commit 67e304ba authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added support for datatype of grid mapping var.

parent b286f3b6
......@@ -2768,8 +2768,8 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
{
const int projID = lgrid ? grid->proj : gridID;
const int ncid = ncvars[gmapvarid].ncid;
const int gmapvartype = cdfInqDatatype(ncvars[gmapvarid].xtype, ncvars[gmapvarid].lunsigned);
if (gmapvartype != -1) cdiDefKeyInt(projID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, gmapvartype);
const int gmapvartype = ncvars[gmapvarid].xtype;
cdiDefKeyInt(projID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, gmapvartype);
const char *gmapvarname = ncvars[gmapvarid].name;
cdf_read_mapping_atts(ncid, gmapvarid, projID, gmapvarname);
cdiGridDefKeyStr(projID, CDI_KEY_GRIDMAP_VARNAME, (int)(strlen(gmapvarname)+1), gmapvarname);
......
......@@ -1624,7 +1624,7 @@ void cdf_def_mapping(stream_t *streamptr, int gridID)
nc_type gmapvartype = NC_INT;
int datatype = -1;
int status = cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, &datatype);
if (status == CDI_NOERR) gmapvartype = cdfDefDatatype(datatype, streamptr);
if (status == CDI_NOERR) gmapvartype = (nc_type) datatype;
char gmapvarname[CDI_MAX_NAME]; gmapvarname[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_VARNAME, CDI_MAX_NAME, gmapvarname);
......@@ -1638,7 +1638,7 @@ void cdf_def_mapping(stream_t *streamptr, int gridID)
cdf_enddef(fileID);
if ( ncerrcode == NC_NOERR )
if ( ncerrcode == NC_NOERR && gmapvartype != NC_CHAR )
{
int dummy = 1;
cdf_put_var_int(fileID, ncvarid, &dummy);
......
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