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

vlistPrintKernel: print nsubtypes and subtypeID

parent b090b297
...@@ -178,7 +178,7 @@ enum { ...@@ -178,7 +178,7 @@ enum {
#define MAX_KV_PAIRS_MATCH 10 #define MAX_KV_PAIRS_MATCH 10
/* Data structure defining a key-value search, possibly with multiple /* Data structure defining a key-value search, possibly with multiple
key-value pairs in combination. key-value pairs in combination.
Currently, only multiple pairs combined by AND are supported. Currently, only multiple pairs combined by AND are supported.
*/ */
......
...@@ -84,7 +84,7 @@ typedef struct ...@@ -84,7 +84,7 @@ typedef struct
int productDefinitionTemplate; int productDefinitionTemplate;
/* meta-data for specification of tiles (currently only GRIB-API: */ /* meta-data for specification of tiles (currently only GRIB-API: */
subtype_t *tiles; subtype_t *tiles;
int opt_grib_nentries; /* current no. key-value pairs */ int opt_grib_nentries; /* current no. key-value pairs */
int opt_grib_kvpair_size; /* current allocated size */ int opt_grib_kvpair_size; /* current allocated size */
...@@ -235,7 +235,7 @@ static int tileNewEntry(int varID) ...@@ -235,7 +235,7 @@ static int tileNewEntry(int varID)
if (vartable[varID].nsubtypes_alloc == 0) if (vartable[varID].nsubtypes_alloc == 0)
{ {
/* create table for the first time. */ /* create table for the first time. */
vartable[varID].nsubtypes_alloc = 2; vartable[varID].nsubtypes_alloc = 2;
vartable[varID].nsubtypes = 0; vartable[varID].nsubtypes = 0;
vartable[varID].recordTable = vartable[varID].recordTable =
(subtypetable_t *)xmalloc((size_t)vartable[varID].nsubtypes_alloc * sizeof (subtypetable_t)); (subtypetable_t *)xmalloc((size_t)vartable[varID].nsubtypes_alloc * sizeof (subtypetable_t));
...@@ -608,7 +608,7 @@ int cmpparam(const void* s1, const void* s2) ...@@ -608,7 +608,7 @@ int cmpparam(const void* s1, const void* s2)
void cdi_generate_vars(stream_t *streamptr) void cdi_generate_vars(stream_t *streamptr)
{ {
int gridID, zaxisID, tilesetID; int gridID, zaxisID;
int instID, modelID, tableID; int instID, modelID, tableID;
int param, zaxistype, ltype1, ltype2; int param, zaxistype, ltype1, ltype2;
...@@ -792,7 +792,7 @@ void cdi_generate_vars(stream_t *streamptr) ...@@ -792,7 +792,7 @@ void cdi_generate_vars(stream_t *streamptr)
free(dlevels); free(dlevels);
/* define new subtype for tile set */ /* define new subtype for tile set */
tilesetID = vlistDefTileSubtype(vlistID, vartable[varid].tiles); int tilesetID = vlistDefTileSubtype(vlistID, vartable[varid].tiles);
/* generate new variable */ /* generate new variable */
int varID = stream_new_var(streamptr, gridID, zaxisID, tilesetID); int varID = stream_new_var(streamptr, gridID, zaxisID, tilesetID);
......
...@@ -966,6 +966,14 @@ int vlistNzaxis(int vlistID) ...@@ -966,6 +966,14 @@ int vlistNzaxis(int vlistID)
} }
int vlistNsubtypes(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
return (vlistptr->nsubtypes);
}
void vlistDefNtsteps(int vlistID, int nts) void vlistDefNtsteps(int vlistID, int nts)
{ {
vlist_t *vlistptr = vlist_to_pointer(vlistID); vlist_t *vlistptr = vlist_to_pointer(vlistID);
...@@ -994,25 +1002,27 @@ void vlistPrintKernel(vlist_t *vlistptr, FILE *fp) ...@@ -994,25 +1002,27 @@ void vlistPrintKernel(vlist_t *vlistptr, FILE *fp)
int nvars = vlistptr->nvars; int nvars = vlistptr->nvars;
fprintf(fp, "nvars %d\n" fprintf(fp, "nvars : %d\n"
"ngrids %d\n" "ngrids : %d\n"
"nzaxis %d\n" "nzaxis : %d\n"
"taxisID %d\n" "nsubtypes: %d\n"
"instID %d\n" "taxisID : %d\n"
"modelID %d\n" "instID : %d\n"
"tableID %d\n", "modelID : %d\n"
nvars, vlistptr->ngrids, vlistptr->nzaxis, vlistptr->taxisID, "tableID : %d\n",
nvars, vlistptr->ngrids, vlistptr->nzaxis, vlistptr->nsubtypes, vlistptr->taxisID,
vlistptr->instID, vlistptr->modelID, vlistptr->tableID); vlistptr->instID, vlistptr->modelID, vlistptr->tableID);
if ( nvars > 0 ) if ( nvars > 0 )
{ {
fprintf(fp, " varID param gridID zaxisID tsteptype flag iorank" fprintf(fp, " varID param gridID zaxisID stypeID tsteptype flag iorank"
" name longname units\n"); " name longname units\n");
for ( int varID = 0; varID < nvars; varID++ ) for ( int varID = 0; varID < nvars; varID++ )
{ {
int param = vlistptr->vars[varID].param; int param = vlistptr->vars[varID].param;
int gridID = vlistptr->vars[varID].gridID; int gridID = vlistptr->vars[varID].gridID;
int zaxisID = vlistptr->vars[varID].zaxisID; int zaxisID = vlistptr->vars[varID].zaxisID;
int subtypeID = vlistptr->vars[varID].subtypeID;
int tsteptype = vlistptr->vars[varID].tsteptype; int tsteptype = vlistptr->vars[varID].tsteptype;
const char *name = vlistptr->vars[varID].name; const char *name = vlistptr->vars[varID].name;
const char *longname = vlistptr->vars[varID].longname; const char *longname = vlistptr->vars[varID].longname;
...@@ -1021,8 +1031,8 @@ void vlistPrintKernel(vlist_t *vlistptr, FILE *fp) ...@@ -1021,8 +1031,8 @@ void vlistPrintKernel(vlist_t *vlistptr, FILE *fp)
int iorank = vlistptr->vars[varID].iorank; int iorank = vlistptr->vars[varID].iorank;
cdiParamToString(param, paramstr, sizeof(paramstr)); cdiParamToString(param, paramstr, sizeof(paramstr));
fprintf(fp, "%6d %-8s %6d %6d %6d %5d %6d %-8s %s [%s]\n", fprintf(fp, "%6d %-8s %6d %6d %6d %6d %5d %6d %-8s %s [%s]\n",
varID, paramstr, gridID, zaxisID, tsteptype, flag, iorank, varID, paramstr, gridID, zaxisID, subtypeID, tsteptype, flag, iorank,
name?name:"", longname?longname:"", units?units:""); name?name:"", longname?longname:"", units?units:"");
} }
......
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