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

Added function reshGetTxCode().

parent 3dcd8e5b
......@@ -379,17 +379,15 @@ static listElem_t *
reshGetElem(const char *caller, const char* expressionString, cdiResH resH, const resOps *ops)
{
listElem_t *listElem;
int nsp;
namespaceTuple_t nspT;
xassert ( ops );
LIST_INIT(1);
LIST_LOCK();
nsp = namespaceGetActive ();
int nsp = namespaceGetActive ();
nspT = namespaceResHDecode ( resH );
namespaceTuple_t nspT = namespaceResHDecode ( resH );
assert(nspT.idx >= 0);
if (nspT.nsp == nsp &&
......@@ -583,9 +581,35 @@ void reshPackBufferDestroy ( char ** buffer )
/**************************************************************/
int reshGetTxCode(cdiResH resH)
{
int type = 0;
LIST_LOCK();
int nsp = namespaceGetActive ();
namespaceTuple_t nspT = namespaceResHDecode ( resH );
assert(nspT.idx >= 0);
if (nspT.nsp == nsp &&
nspT.idx < resHList[nsp].size)
{
listElem_t *listElem = resHList[nsp].resources + nspT.idx;
xassert ( listElem->res.v.ops );
type = listElem->res.v.ops->valTxCode();
}
LIST_UNLOCK();
return type;
}
/**************************************************************/
int reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
{
int i, packBufferPos = 0;
int packBufferPos = 0;
int end = END;
xassert ( packBuffer );
......@@ -603,7 +627,7 @@ int reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
}
listElem_t *r = resHList[nsp].resources;
for ( i = 0; i < resHList[nsp].size; i++ )
for ( int i = 0; i < resHList[nsp].size; i++ )
if (r[i].status & RESH_SYNC_BIT)
{
if (r[i].status == RESH_DESYNC_DELETED)
......@@ -630,6 +654,7 @@ int reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
LIST_UNLOCK();
serializePack(&end, 1, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
return packBufferPos;
}
......
......@@ -99,6 +99,7 @@ enum reshListMismatch {
int reshListCompare(int nsp0, int nsp1);
void reshListPrint(FILE *fp);
int reshGetTxCode(cdiResH resH);
#endif
/*
......
......@@ -2382,7 +2382,7 @@ bool cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int xdimid, int ydim
static
void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varname)
{
nc_type atttype;
nc_type attrtype;
size_t attlen;
char attname[CDI_MAX_NAME];
enum {attstringlen = 8192}; char attstring[attstringlen];
......@@ -2403,26 +2403,28 @@ void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varn
{
cdf_inq_attname(ncid, gmapvarid, iatt, attname);
cdf_inq_attlen(ncid, gmapvarid, attname, &attlen);
cdf_inq_atttype(ncid, gmapvarid, attname, &atttype);
cdf_inq_atttype(ncid, gmapvarid, attname, &attrtype);
if ( xtypeIsInt(atttype) )
if ( xtypeIsInt(attrtype) )
{
int attint[attlen];
cdfGetAttInt(ncid, gmapvarid, attname, (int)attlen, attint);
printf("atttype: %d attname: %s attr: %d\n", atttype, attname, attint[0]);
printf("attrtype: %d attname: %s attr: %d\n", attrtype, attname, attint[0]);
}
else if ( xtypeIsFloat(atttype) )
else if ( xtypeIsFloat(attrtype) )
{
double attflt[attlen];
cdfGetAttDouble(ncid, gmapvarid, attname, (int)attlen, attflt);
printf("atttype: %d attname: %s attr: %g\n", atttype, attname, attflt[0]);
printf("attrtype: %d attname: %s attr: %g\n", attrtype, attname, attflt[0]);
int datatype = (attrtype == NC_FLOAT) ? DATATYPE_FLT32 : DATATYPE_FLT64;
// gridDefAttFlt(projID, attname, datatype, (int)attlen, attflt);
int varID = vlistDefVar(projID, CDI_UNDEFID, CDI_UNDEFID, CDI_UNDEFID);
printf("varID = %d\n", varID);
// vlistDefAttFlt(projID, varID, attname, datatype, (int)attlen, attflt);
}
else if ( xtypeIsText(atttype) && strcmp(attname, "grid_mapping_name") )
else if ( xtypeIsText(attrtype) && strcmp(attname, "grid_mapping_name") )
{
cdfGetAttText(ncid, gmapvarid, attname, attstringlen, attstring);
printf("atttype: %d attname: %s attr: %s\n", atttype, attname, attstring);
printf("attrtype: %d attname: %s attr: %s\n", attrtype, attname, attstring);
}
}
}
......
......@@ -134,6 +134,7 @@ void vlistCheckVarID(const char *caller, int vlistID, int varID)
int vlistDefVarTiles(int vlistID, int gridID, int zaxisID, int tsteptype, int tilesetID)
{
// printf("ObjID %d TxCode: %d\n", vlistID, reshGetTxCode(vlistID));
vlist_t *vlistptr = vlist_to_pointer(vlistID);
if ( CDI_Debug )
Message("gridID = %d zaxisID = %d tsteptype = %d", gridID, zaxisID, tsteptype);
......
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