Commit 1a02a03a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added support for netCDF timeseries with only one grid axis

parent b0504dd5
......@@ -6,6 +6,7 @@
* changed encode/decode_time to seconds
* ieg: added support for Gaussian grids [request: Ralf Podzun]
* added support for netCDF timeseries without grid
* added support for netCDF timeseries with only one grid axis
* julday_add_seconds: bug fix for adjusting negative seconds
* Version 1.4.0 released
......
......@@ -113,35 +113,49 @@ static void printGridInfo(int vlistID)
yfirst = gridInqYval(gridID, 0);
ylast = gridInqYval(gridID, ysize-1);
yinc = gridInqYinc(gridID);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
fprintf(stdout, "size : dim = %d nlat = %d\n", gridsize, ysize);
else
fprintf(stdout, "size : dim = %d nlon = %d nlat = %d\n", gridsize, xsize, ysize);
if ( xsize > 0 )
{
fprintf(stdout, "size : dim = %d nlat = %d\n", gridsize, ysize);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "longitude : reduced\n");
if ( gridtype == GRID_GAUSSIAN_REDUCED )
{
fprintf(stdout, "size : dim = %d nlat = %d\n", gridsize, ysize);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "longitude : reduced\n");
}
else
{
xfirst = gridInqXval(gridID, 0);
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);
if ( gridIsCircular(gridID) )
fprintf(stdout, " circular");
fprintf(stdout, "\n");
}
}
else
if ( ysize > 0 )
{
xfirst = gridInqXval(gridID, 0);
xlast = gridInqXval(gridID, xsize-1);
xinc = gridInqXinc(gridID);
fprintf(stdout, "size : dim = %d nlon = %d nlat = %d\n", gridsize, xsize, ysize);
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "%-9s : first = %.9g last = %.9g", xname, xfirst, xlast);
if ( IS_NOT_EQUAL(xinc, 0) )
fprintf(stdout, " inc = %.9g", xinc);
fprintf(stdout, " %s", xunits);
if ( gridIsCircular(gridID) )
fprintf(stdout, " circular");
fprintf(stdout, "%-9s : first = %.9g", yname, yfirst);
if ( ysize > 1 ) fprintf(stdout, "last = %.9g", ylast);
if ( IS_NOT_EQUAL(yinc, 0) &&
(gridtype == GRID_LONLAT || gridtype == GRID_SINUSOIDAL ||
gridtype == GRID_LCC2 || gridtype == GRID_LAEA) )
fprintf(stdout, " inc = %.9g", yinc);
fprintf(stdout, " %s", yunits);
fprintf(stdout, "\n");
}
fprintf(stdout, "%*s", nbyte0, "");
fprintf(stdout, "%-9s : first = %.9g last = %.9g", yname, yfirst, ylast);
if ( IS_NOT_EQUAL(yinc, 0) &&
(gridtype == GRID_LONLAT || gridtype == GRID_SINUSOIDAL ||
gridtype == GRID_LCC2 || gridtype == GRID_LAEA) )
fprintf(stdout, " inc = %.9g", yinc);
fprintf(stdout, " %s", yunits);
fprintf(stdout, "\n");
if ( gridIsRotated(gridID) )
{
......
......@@ -2361,14 +2361,14 @@ void cdfDefGrid(int streamID, int gridID)
{
/* no grid information */
}
else if ( gridInqXsize(gridID) == 0 || gridInqYsize(gridID) == 0 )
else if ( gridtype == GRID_GENERIC && (gridInqXsize(gridID) == 0 || gridInqYsize(gridID) == 0) )
{
cdfDefGdim(streamID, gridID);
}
else
{
cdfDefXaxis(streamID, gridID);
cdfDefYaxis(streamID, gridID);
if ( gridInqXsize(gridID) > 0 ) cdfDefXaxis(streamID, gridID);
if ( gridInqYsize(gridID) > 0 ) cdfDefYaxis(streamID, gridID);
}
if ( gridIsRotated(gridID) ) cdfDefPole(streamID, gridID);
......@@ -4406,8 +4406,8 @@ int cdfInqContents(int streamID)
{
if ( ncvars[ncvarid].ndims == 1 )
{
if ( ncvars[ncvarid].isvar != TRUE ) cdfSetVar(ncvars, ncvarid, FALSE);
//if ( ncvars[ncvarid].isvar != FALSE ) cdfSetVar(ncvars, ncvarid, TRUE);
//if ( ncvars[ncvarid].isvar != TRUE ) cdfSetVar(ncvars, ncvarid, FALSE);
if ( ncvars[ncvarid].isvar != FALSE ) cdfSetVar(ncvars, ncvarid, TRUE);
if ( ncdimid == ncvars[ncvarid].dimids[0] && ncdims[ncdimid].ncvarid == UNDEFID )
if ( strcmp(ncvars[ncvarid].name, ncdims[ncdimid].name) == 0 )
......@@ -5023,6 +5023,17 @@ int cdfInqContents(int streamID)
else
ncvars[ncvarid].gridtype = GRID_LONLAT;
}
else if ( islat && !islon && xsize == 0 )
{
if ( isGaussGrid(ysize, yinc, grid.yvals) )
ncvars[ncvarid].gridtype = GRID_GAUSSIAN;
else
ncvars[ncvarid].gridtype = GRID_LONLAT;
}
else if ( islon && !islat && ysize == 0 )
{
ncvars[ncvarid].gridtype = GRID_LONLAT;
}
else
ncvars[ncvarid].gridtype = GRID_GENERIC;
}
......
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