Commit 13f9fff6 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridPrint: print xfirst and xinc if xinc is constant

parent 701bf9c1
2006-05-?? Uwe Schulzweida <schulzweida@dkrz.de> 2006-05-?? Uwe Schulzweida <schulzweida@dkrz.de>
* using GRIB library version 0.6.6
* gridPrint: print xfirst and xinc if xinc is constant
* Version 0.9.7 released * Version 0.9.7 released
2006-03-08 Uwe Schulzweida <schulzweida@dkrz.de> 2006-03-08 Uwe Schulzweida <schulzweida@dkrz.de>
......
...@@ -2442,10 +2442,19 @@ void gridCompress(int gridID) ...@@ -2442,10 +2442,19 @@ void gridCompress(int gridID)
gridptr->xsize = gridsize; gridptr->xsize = gridsize;
gridptr->ysize = gridsize; gridptr->ysize = gridsize;
if ( gridptr->xvals )
gridptr->xvals = (double *) realloc(gridptr->xvals, gridsize*sizeof(double)); gridptr->xvals = (double *) realloc(gridptr->xvals, gridsize*sizeof(double));
if ( gridptr->yvals )
gridptr->yvals = (double *) realloc(gridptr->yvals, gridsize*sizeof(double)); gridptr->yvals = (double *) realloc(gridptr->yvals, gridsize*sizeof(double));
if ( gridptr->area )
gridptr->area = (double *) realloc(gridptr->area, gridsize*sizeof(double)); gridptr->area = (double *) realloc(gridptr->area, gridsize*sizeof(double));
if ( gridptr->xbounds )
gridptr->xbounds = (double *) realloc(gridptr->xbounds, nv*gridsize*sizeof(double)); gridptr->xbounds = (double *) realloc(gridptr->xbounds, nv*gridsize*sizeof(double));
if ( gridptr->ybounds )
gridptr->ybounds = (double *) realloc(gridptr->ybounds, nv*gridsize*sizeof(double)); gridptr->ybounds = (double *) realloc(gridptr->ybounds, nv*gridsize*sizeof(double));
free(gridptr->mask); free(gridptr->mask);
...@@ -2827,6 +2836,21 @@ void gridPrint(int gridID) ...@@ -2827,6 +2836,21 @@ void gridPrint(int gridID)
} }
if ( xvals ) if ( xvals )
{
double xfirst = 0.0, xinc = 0.0;
if ( type == GRID_LONLAT || type == GRID_GAUSSIAN )
{
xfirst = gridInqXval(gridID, 0);
xinc = gridInqXinc(gridID);
}
if ( !DBL_IS_EQUAL(xinc, 0) )
{
fprintf(fp, "xfirst : %g\n", xfirst);
fprintf(fp, "xinc : %g\n", xinc);
}
else
{ {
nbyte0 = fprintf(fp, "xvals : "); nbyte0 = fprintf(fp, "xvals : ");
nbyte = nbyte0; nbyte = nbyte0;
...@@ -2842,6 +2866,7 @@ void gridPrint(int gridID) ...@@ -2842,6 +2866,7 @@ void gridPrint(int gridID)
} }
fprintf(fp, "\n"); fprintf(fp, "\n");
} }
}
if ( xbounds ) if ( xbounds )
{ {
...@@ -2857,6 +2882,21 @@ void gridPrint(int gridID) ...@@ -2857,6 +2882,21 @@ void gridPrint(int gridID)
} }
if ( yvals ) if ( yvals )
{
double yfirst = 0.0, yinc = 0.0;
if ( type == GRID_LONLAT )
{
yfirst = gridInqYval(gridID, 0);
yinc = gridInqYinc(gridID);
}
if ( !DBL_IS_EQUAL(yinc, 0) )
{
fprintf(fp, "yfirst : %g\n", yfirst);
fprintf(fp, "yinc : %g\n", yinc);
}
else
{ {
nbyte0 = fprintf(fp, "yvals : "); nbyte0 = fprintf(fp, "yvals : ");
nbyte = nbyte0; nbyte = nbyte0;
...@@ -2872,6 +2912,7 @@ void gridPrint(int gridID) ...@@ -2872,6 +2912,7 @@ void gridPrint(int gridID)
} }
fprintf(fp, "\n"); fprintf(fp, "\n");
} }
}
if ( ybounds ) if ( ybounds )
{ {
......
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