Commit 49b22a8a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Merge declaration and definition.

parent 39c059da
......@@ -41,10 +41,7 @@
void *Showinfo(void *argument)
{
int vdate, vtime;
int nrecs;
int nlevs, levelID;
int ltype;
int date0 = 0;
int year, month, day;
int month0 = 0, year0 = 0;
......@@ -78,21 +75,18 @@ void *Showinfo(void *argument)
if ( operatorID == SHOWYEAR )
{
// int nyear = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
{
vdate = taxisInqVdate(taxisID);
int vdate = taxisInqVdate(taxisID);
cdiDecodeDate(vdate, &year, &month, &day);
if ( tsID == 0 || year0 != year )
{
// if ( nyear == 10 ) { nyear = 0; fprintf(stdout, "\n"); }
year0 = year;
fprintf(stdout, " %4d", year0);
// nyear++;
}
tsID++;
......@@ -101,21 +95,18 @@ void *Showinfo(void *argument)
}
else if ( operatorID == SHOWMON )
{
// int nmonth = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
{
vdate = taxisInqVdate(taxisID);
int vdate = taxisInqVdate(taxisID);
cdiDecodeDate(vdate, &year, &month, &day);
if ( tsID == 0 || month0 != month )
{
// if ( nmonth == 12 ) { nmonth = 0; fprintf(stdout, "\n"); }
month0 = month;
fprintf(stdout, " %2d", month0);
// nmonth++;
}
tsID++;
......@@ -125,21 +116,18 @@ void *Showinfo(void *argument)
else if ( operatorID == SHOWDATE )
{
char vdatestr[32];
// int ndate = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
{
vdate = taxisInqVdate(taxisID);
int vdate = taxisInqVdate(taxisID);
date2str(vdate, vdatestr, sizeof(vdatestr));
if ( tsID == 0 || date0 != vdate )
{
// if ( ndate == 10 ) { ndate = 0; fprintf(stdout, "\n"); }
date0 = vdate;
fprintf(stdout, " %s", vdatestr);
// ndate++;
}
tsID++;
......@@ -149,50 +137,41 @@ void *Showinfo(void *argument)
else if ( operatorID == SHOWTIME )
{
char vtimestr[32];
// int nout = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
{
// if ( nout == 4 ) { nout = 0; fprintf(stdout, "\n"); }
vtime = taxisInqVtime(taxisID);
int vtime = taxisInqVtime(taxisID);
time2str(vtime, vtimestr, sizeof(vtimestr));
fprintf(stdout, " %s", vtimestr);
tsID++;
// nout++;
}
fprintf(stdout, "\n");
}
else if ( operatorID == SHOWTIMESTAMP )
{
char vdatetimestr[64];
// int nout = 0;
int tsID = 0;
if ( ntsteps != 0 )
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
{
// if ( nout == 4 ) { nout = 0; fprintf(stdout, "\n"); }
vdate = taxisInqVdate(taxisID);
vtime = taxisInqVtime(taxisID);
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
datetime2str(vdate, vtime, vdatetimestr, sizeof(vdatetimestr));
fprintf(stdout, " %s", vdatetimestr);
tsID++;
// nout++;
}
fprintf(stdout, "\n");
}
else if ( operatorID == SHOWCODE )
{
// int nout = 0;
for ( int varID = 0; varID < nvars; varID++ )
{
// if ( nout == 20 ) { nout = 0; fprintf(stdout, "\n"); }
fprintf(stdout, " %d", vlistInqVarCode(vlistID, varID));
// nout++;
}
fprintf(stdout, "\n");
}
......@@ -211,25 +190,20 @@ void *Showinfo(void *argument)
else if ( operatorID == SHOWUNIT )
{
char varunits[CDI_MAX_NAME];
//int nout = 0;
for ( int varID = 0; varID < nvars; varID++ )
{
varunits[0] = 0;
vlistInqVarUnits(vlistID, varID, varunits);
// if ( nout == 20 ) { nout = 0; fprintf(stdout, "\n"); }
if ( strlen(varunits) ) fprintf(stdout, " %s", varunits);
// nout++;
}
fprintf(stdout, "\n");
}
else if ( operatorID == SHOWPARAM )
{
int param;
char paramstr[32];
for ( int varID = 0; varID < nvars; varID++ )
{
param = vlistInqVarParam(vlistID, varID);
int param = vlistInqVarParam(vlistID, varID);
cdiParamToString(param, paramstr, sizeof(paramstr));
fprintf(stdout, " %s", paramstr);
......@@ -252,10 +226,7 @@ void *Showinfo(void *argument)
for ( int varID = 0; varID < nvars; varID++ )
{
vlistInqVarStdname(vlistID, varID, stdname);
if ( stdname[0] != 0 )
fprintf(stdout, " %s", stdname);
else
fprintf(stdout, " unknown");
fprintf(stdout, " %s", stdname[0] != 0 ? stdname : "unknown");
}
fprintf(stdout, "\n");
}
......@@ -264,8 +235,8 @@ void *Showinfo(void *argument)
for ( int varID = 0; varID < nvars; varID++ )
{
int zaxisID = vlistInqVarZaxis(vlistID, varID);
nlevs = zaxisInqSize(zaxisID);
for ( levelID = 0; levelID < nlevs; levelID++ )
int nlevs = zaxisInqSize(zaxisID);
for ( int levelID = 0; levelID < nlevs; levelID++ )
fprintf(stdout, " %.9g", cdoZaxisInqLevel(zaxisID, levelID));
fprintf(stdout, "\n");
}
......@@ -276,8 +247,7 @@ void *Showinfo(void *argument)
for ( int index = 0; index < nzaxis; index++ )
{
int zaxisID = vlistZaxis(vlistID, index);
ltype = zaxis2ltype(zaxisID);
int ltype = zaxis2ltype(zaxisID);
if ( ltype != -1 ) fprintf(stdout, " %d", ltype);
}
......
Supports Markdown
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