Commit 5e0b6bb5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added support for rotated grids on south pole

parent b7c47912
2009-??-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2009-??-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* add env CDI_SORTNAME to sort netCDF names * added env CDI_SORTNAME to sort netCDF names
* added support for rotated grids on south pole [request: Beate Geyer]
* timeval2vtime: bug fix for timeunit TUNIT_MONTH
* streamSync: extent to non netCDF files * streamSync: extent to non netCDF files
* Version 1.3.2 released * Version 1.3.2 released
2009-04-16 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2009-04-16 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.3.0 * using GRIB library version 1.3.0
* add support for NaN in DBL_IS_EQUAL * added support for NaN in DBL_IS_EQUAL
* add support for GRID type LCC2 (LCC PROJ.4 version) * added support for GRID type LCC2 (LCC PROJ.4 version)
* add support for TUNIT_QUARTER (15 minutes) * added support for TUNIT_QUARTER (15 minutes)
* use env GRIB_INVENTORY_MODE=timestep to skip double entries * use env GRIB_INVENTORY_MODE=timestep to skip double entries
* grbDefTime: define tunit also for absolute time [report: Pruek Pongprueksa] * grbDefTime: define tunit also for absolute time [report: Pruek Pongprueksa]
* set default calendar with env CDI_DEFAULT_CALENDAR * set default calendar with env CDI_DEFAULT_CALENDAR
......
...@@ -534,6 +534,8 @@ double gridInqYpole(int gridID); ...@@ -534,6 +534,8 @@ double gridInqYpole(int gridID);
void gridDefYpole(int gridID, double ypole); void gridDefYpole(int gridID, double ypole);
double gridInqAngle(int gridID); double gridInqAngle(int gridID);
void gridDefAngle(int gridID, double angle); void gridDefAngle(int gridID, double angle);
double gridInqNpole(int gridID);
void gridDefNpole(int gridID, double npole);
void gridDefTrunc(int gridID, int trunc); void gridDefTrunc(int gridID, int trunc);
int gridInqTrunc(int gridID); int gridInqTrunc(int gridID);
/* Hexagonal GME grid */ /* Hexagonal GME grid */
......
...@@ -3153,6 +3153,7 @@ void gridPrint(int gridID, int opt) ...@@ -3153,6 +3153,7 @@ void gridPrint(int gridID, int opt)
{ {
if ( xsize > 0 ) fprintf(fp, "xnpole = %g\n", gridptr->xpole); if ( xsize > 0 ) fprintf(fp, "xnpole = %g\n", gridptr->xpole);
if ( ysize > 0 ) fprintf(fp, "ynpole = %g\n", gridptr->ypole); if ( ysize > 0 ) fprintf(fp, "ynpole = %g\n", gridptr->ypole);
if ( gridptr->angle > 0 ) fprintf(fp, "angle = %g\n", gridptr->angle);
} }
if ( xvals ) if ( xvals )
......
...@@ -2212,7 +2212,7 @@ void cdfDefPole(int streamID, int gridID) ...@@ -2212,7 +2212,7 @@ void cdfDefPole(int streamID, int gridID)
int fileID; int fileID;
int ncvarid = UNDEFID; int ncvarid = UNDEFID;
int ncerr; int ncerr;
double xpole, ypole; double xpole, ypole, angle;
char varname[] = "rotated_pole"; char varname[] = "rotated_pole";
char mapname[] = "rotated_latitude_longitude"; char mapname[] = "rotated_latitude_longitude";
...@@ -2220,6 +2220,7 @@ void cdfDefPole(int streamID, int gridID) ...@@ -2220,6 +2220,7 @@ void cdfDefPole(int streamID, int gridID)
ypole = gridInqYpole(gridID); ypole = gridInqYpole(gridID);
xpole = gridInqXpole(gridID); xpole = gridInqXpole(gridID);
angle = gridInqAngle(gridID);
cdf_redef(fileID); cdf_redef(fileID);
...@@ -2229,6 +2230,8 @@ void cdfDefPole(int streamID, int gridID) ...@@ -2229,6 +2230,8 @@ void cdfDefPole(int streamID, int gridID)
cdf_put_att_text(fileID, ncvarid, "grid_mapping_name", strlen(mapname), mapname); cdf_put_att_text(fileID, ncvarid, "grid_mapping_name", strlen(mapname), mapname);
cdf_put_att_double(fileID, ncvarid, "grid_north_pole_latitude", NC_DOUBLE, 1L, &ypole); cdf_put_att_double(fileID, ncvarid, "grid_north_pole_latitude", NC_DOUBLE, 1L, &ypole);
cdf_put_att_double(fileID, ncvarid, "grid_north_pole_longitude", NC_DOUBLE, 1L, &xpole); cdf_put_att_double(fileID, ncvarid, "grid_north_pole_longitude", NC_DOUBLE, 1L, &xpole);
if ( angle > 0 )
cdf_put_att_double(fileID, ncvarid, "north_pole_grid_longitude", NC_DOUBLE, 1L, &angle);
} }
cdf_enddef(fileID); cdf_enddef(fileID);
...@@ -2421,7 +2424,7 @@ int cdfDefVar(int streamID, int varID) ...@@ -2421,7 +2424,7 @@ int cdfDefVar(int streamID, int varID)
char *stdname = NULL; char *stdname = NULL;
char *units = NULL; char *units = NULL;
int dims[4]; int dims[4];
size_t chunks[4]; size_t chunks[4] = {0,0,0,0};
int tableID; int tableID;
int ndims = 0; int ndims = 0;
int len; int len;
...@@ -5129,9 +5132,11 @@ int cdfInqContents(int streamID) ...@@ -5129,9 +5132,11 @@ int cdfInqContents(int streamID)
{ {
cdfGetAttDouble(fileID, ncvars[ncvarid].gmapid, attname, 1, &grid.xpole); cdfGetAttDouble(fileID, ncvars[ncvarid].gmapid, attname, 1, &grid.xpole);
} }
else if ( strcmp(attname, "north_pole_grid_longitude") == 0 )
{
cdfGetAttDouble(fileID, ncvars[ncvarid].gmapid, attname, 1, &grid.angle);
}
} }
grid.angle = 0.0;
} }
if ( CDI_Debug ) if ( CDI_Debug )
......
...@@ -1021,15 +1021,19 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime) ...@@ -1021,15 +1021,19 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
if ( timeunit == TUNIT_MONTH || timeunit == TUNIT_YEAR ) if ( timeunit == TUNIT_MONTH || timeunit == TUNIT_YEAR )
{ {
int nmon;
if ( timeunit == TUNIT_YEAR ) timevalue *= 12; if ( timeunit == TUNIT_YEAR ) timevalue *= 12;
if ( (NINT(timevalue*10))%10 && lwarn ) if ( (NINT(timevalue*10))%10 && lwarn )
{ {
Warning(func, "Possible wrong calculation of date/time!\nTime offset must be integer for time unit MONTH and YEAR!"); Warning(func, "Possible wrong calculation of date/time!\n"
"Time offset isn't integer for time unit MONTH and YEAR!");
lwarn = FALSE; lwarn = FALSE;
} }
month += NINT(timevalue); nmon = (int) (timevalue+0.001);
month += nmon;
while ( month > 12 ) { month -= 12; year++; } while ( month > 12 ) { month -= 12; year++; }
while ( month < 1 ) { month += 12; year--; } while ( month < 1 ) { month += 12; year--; }
......
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