Commit 4f0ead98 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

app/printinfo.h: update

parent e189adae
......@@ -133,7 +133,7 @@ static
void printGridInfo(int vlistID)
{
int ngrids, index;
int gridID, gridtype, trunc, gridsize, xsize, ysize;
int gridID, gridtype, trunc, gridsize, xsize, ysize, xysize;
int nbyte0;
char xname[CDI_MAX_NAME], yname[CDI_MAX_NAME], xunits[CDI_MAX_NAME], yunits[CDI_MAX_NAME];
char uuidOfHGrid[17];
......@@ -147,12 +147,13 @@ void printGridInfo(int vlistID)
gridsize = gridInqSize(gridID);
xsize = gridInqXsize(gridID);
ysize = gridInqYsize(gridID);
xysize = xsize*ysize;
gridInqXname(gridID, xname);
gridInqYname(gridID, yname);
gridInqXunits(gridID, xunits);
gridInqYunits(gridID, yunits);
nbyte0 = fprintf(stdout, " %4d : %-12s > ", index+1, gridNamePtr(gridtype));
nbyte0 = fprintf(stdout, " %4d : %-12s ", index+1, gridNamePtr(gridtype));
if ( gridtype == GRID_LONLAT ||
gridtype == GRID_LCC2 ||
......@@ -171,13 +172,14 @@ void printGridInfo(int vlistID)
ylast = gridInqYval(gridID, ysize-1);
yinc = gridInqYinc(gridID);
fprintf(stdout, " : points=%d", gridsize);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
fprintf(stdout, "size : dim = %d nlat = %d", gridsize, ysize);
else
fprintf(stdout, "size : dim = %d nx = %d ny = %d", gridsize, xsize, ysize);
fprintf(stdout, " nlat=%d", ysize);
else if ( xysize )
fprintf(stdout, " (%dx%d)", xsize, ysize);
if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED )
fprintf(stdout, " np = %d", gridInqNP(gridID));
fprintf(stdout, " np=%d", gridInqNP(gridID));
fprintf(stdout, "\n");
......@@ -188,7 +190,7 @@ void printGridInfo(int vlistID)
{
if ( gridtype == GRID_GAUSSIAN_REDUCED )
{
fprintf(stdout, "size : dim = %d nlat = %d\n", gridsize, ysize);
fprintf(stdout, " : points=%d nlat=%d\n", gridsize, ysize);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "longitude : reduced\n");
}
......@@ -198,11 +200,14 @@ void printGridInfo(int vlistID)
xlast = gridInqXval(gridID, xsize-1);
xinc = gridInqXinc(gridID);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "%-9s : first = %.9g", xname, xfirst);
if ( xsize > 1 ) fprintf(stdout, " last = %.9g", xlast);
if ( IS_NOT_EQUAL(xinc, 0) )
fprintf(stdout, " inc = %.9g", xinc);
fprintf(stdout, " %s", xunits);
fprintf(stdout, "%-9s : %g", xname, xfirst);
if ( xsize > 1 )
{
fprintf(stdout, " to %g", xlast);
if ( IS_NOT_EQUAL(xinc, 0) )
fprintf(stdout, " by %g", xinc);
}
fprintf(stdout, " %s", xunits);
if ( gridIsCircular(gridID) ) fprintf(stdout, " circular");
fprintf(stdout, "\n");
}
......@@ -211,11 +216,14 @@ void printGridInfo(int vlistID)
if ( ysize > 0 && lycoord )
{
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "%-9s : first = %.9g", yname, yfirst);
if ( ysize > 1 ) fprintf(stdout, " last = %.9g", ylast);
if ( IS_NOT_EQUAL(yinc, 0) && gridtype != GRID_GAUSSIAN && gridtype != GRID_GAUSSIAN_REDUCED )
fprintf(stdout, " inc = %.9g", yinc);
fprintf(stdout, " %s", yunits);
fprintf(stdout, "%-9s : %g", yname, yfirst);
if ( ysize > 1 )
{
fprintf(stdout, " to %g", ylast);
if ( IS_NOT_EQUAL(yinc, 0) && gridtype != GRID_GAUSSIAN && gridtype != GRID_GAUSSIAN_REDUCED )
fprintf(stdout, " by %g", yinc);
}
fprintf(stdout, " %s", yunits);
fprintf(stdout, "\n");
}
......@@ -226,8 +234,8 @@ void printGridInfo(int vlistID)
latpole = gridInqYpole(gridID);
angle = gridInqAngle(gridID);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "northpole : lon = %.9g lat = %.9g", lonpole, latpole);
if ( angle > 0 ) fprintf(stdout, " angle = %.9g", angle);
fprintf(stdout, "northpole : lon=%g lat=%g", lonpole, latpole);
if ( angle > 0 ) fprintf(stdout, " angle=%g", angle);
fprintf(stdout, "\n");
}
......@@ -247,7 +255,7 @@ void printGridInfo(int vlistID)
double a, lon_0, lat_0;
gridInqLaea(gridID, &a, &lon_0, &lat_0);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "projpar : a = %g lon_0 = %g lat_0 = %g\n", a, lon_0, lat_0);
fprintf(stdout, "projpar : a=%g lon_0=%g lat_0=%g\n", a, lon_0, lat_0);
}
if ( gridtype == GRID_LCC2 )
......@@ -255,36 +263,36 @@ void printGridInfo(int vlistID)
double a, lon_0, lat_0, lat_1, lat_2;
gridInqLcc2(gridID, &a, &lon_0, &lat_0, &lat_1, &lat_2);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "projpar : a = %7.0f lon_0 = %g lat_0 = %g lat_1 = %g lat_2 = %g\n",
fprintf(stdout, "projpar : a=%7.0f lon_0=%g lat_0=%g lat_1=%g lat_2=%g\n",
a, lon_0, lat_0, lat_1, lat_2);
}
}
else if ( gridtype == GRID_SPECTRAL )
{
fprintf(stdout, "size : dim = %d nsp = %d truncation = %d\n", gridsize, gridsize/2, trunc);
fprintf(stdout, " : points=%d nsp=%d truncation=%d\n", gridsize, gridsize/2, trunc);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, " complexPacking = %d\n", gridInqComplexPacking(gridID));
fprintf(stdout, " complexPacking=%d\n", gridInqComplexPacking(gridID));
}
else if ( gridtype == GRID_FOURIER )
{
fprintf(stdout, "size : dim = %d nfc = %d truncation = %d\n", gridsize, gridsize/2, trunc);
fprintf(stdout, " : points=%d nfc=%d truncation=%d\n", gridsize, gridsize/2, trunc);
}
else if ( gridtype == GRID_GME )
{
int ni, nd;
ni = gridInqGMEni(gridID);
nd = gridInqGMEnd(gridID);
fprintf(stdout, "size : dim = %d nd = %d ni = %d\n", gridsize, nd, ni);
fprintf(stdout, " : points=%d nd=%d ni=%d\n", gridsize, nd, ni);
}
else if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED )
{
if ( gridtype == GRID_CURVILINEAR )
fprintf(stdout, "size : dim = %d nx = %d ny = %d", gridsize, xsize, ysize);
fprintf(stdout, " : points=%d (%dx%d)", gridsize, xsize, ysize);
else
fprintf(stdout, "size : dim = %d", gridsize);
fprintf(stdout, " : points=%d", gridsize);
if ( gridtype == GRID_UNSTRUCTURED && gridInqNvertex(gridID) > 0 )
fprintf(stdout, " nvertex = %d", gridInqNvertex(gridID));
fprintf(stdout, " nvertex=%d", gridInqNvertex(gridID));
fprintf(stdout, "\n");
......@@ -296,7 +304,7 @@ void printGridInfo(int vlistID)
if ( number > 0 )
{
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "grid : number = %d position = %d\n", number, position);
fprintf(stdout, "grid : number=%d position=%d\n", number, position);
}
if ( gridInqReference(gridID, NULL) )
......@@ -313,8 +321,8 @@ void printGridInfo(int vlistID)
int i;
double *xvals, *yvals;
double xfirst, xlast, yfirst, ylast;
xvals = (double *) malloc(gridsize*sizeof(double));
yvals = (double *) malloc(gridsize*sizeof(double));
xvals = malloc(gridsize*sizeof(double));
yvals = malloc(gridsize*sizeof(double));
gridInqXvals(gridID, xvals);
gridInqYvals(gridID, yvals);
......@@ -326,17 +334,17 @@ void printGridInfo(int vlistID)
for ( i = 1; i < gridsize; i++ )
{
if ( xvals[i] < xfirst ) xfirst = xvals[i];
if ( xvals[i] > xlast ) xlast = xvals[i];
if ( xvals[i] > xlast ) xlast = xvals[i];
if ( yvals[i] < yfirst ) yfirst = yvals[i];
if ( yvals[i] > ylast ) ylast = yvals[i];
if ( yvals[i] > ylast ) ylast = yvals[i];
}
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "%-9s : min = %.9g max = %.9g %s", xname, xfirst, xlast, xunits);
fprintf(stdout, "%-9s : %g to %g %s", xname, xfirst, xlast, xunits);
if ( gridIsCircular(gridID) ) fprintf(stdout, " circular");
fprintf(stdout, "\n");
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "%-9s : min = %.9g max = %.9g %s\n", yname, yfirst, ylast, yunits);
fprintf(stdout, "%-9s : %g to %g %s\n", yname, yfirst, ylast, yunits);
free(xvals);
free(yvals);
......@@ -350,24 +358,24 @@ void printGridInfo(int vlistID)
gridInqLCC(gridID, &originLon, &originLat, &lonParY, &lat1, &lat2, &xincm, &yincm,
&projflag, &scanflag);
fprintf(stdout, "size : dim = %d nx = %d ny = %d ", gridsize, xsize, ysize);
fprintf(stdout, " : points=%d (%dx%d) ", gridsize, xsize, ysize);
if ( (projflag&128) == 0 )
fprintf(stdout, "North Pole\n");
else
fprintf(stdout, "South Pole\n");
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, " originLon = %g originLat = %g lonParY = %g\n",
fprintf(stdout, " originLon=%g originLat=%g lonParY=%g\n",
originLon, originLat, lonParY);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, " lat1 = %g lat2 = %g xinc = %g m yinc = %g m\n",
fprintf(stdout, " lat1=%g lat2=%g xinc=%g m yinc=%g m\n",
lat1, lat2, xincm, yincm);
}
else /* if ( gridtype == GRID_GENERIC ) */
{
if ( ysize == 0 )
fprintf(stdout, "size : dim = %d\n", gridsize);
fprintf(stdout, " : points=%d\n", gridsize);
else
fprintf(stdout, "size : dim = %d nx = %d ny = %d\n", gridsize, xsize, ysize);
fprintf(stdout, " : points=%d (%dx%d)\n", gridsize, xsize, ysize);
}
if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED || gridtype == GRID_LCC )
......
......@@ -342,8 +342,8 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
if ( cgribexGetIsRotated(isec2) )
{
grid->isRotated = TRUE;
grid->ypole = - ISEC2_LatSP * 0.001;
grid->xpole = ISEC2_LonSP * 0.001 - 180;
grid->ypole = - ISEC2_LatSP*0.001;
grid->xpole = ISEC2_LonSP*0.001 - 180;
grid->angle = 0;
}
......
......@@ -2465,7 +2465,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
xpole = gridInqXpole(gridID);
ypole = gridInqYpole(gridID);
angle = gridInqAngle(gridID);
/* change from noth to south pole */
/* change from north to south pole */
ypole = -ypole;
xpole = xpole + 180;
GRIB_CHECK(my_grib_set_double(gh, "latitudeOfSouthernPoleInDegrees", ypole), 0);
......
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