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

grb2 read: added support for projection CDI_PROJ_RLL.

parent 55a27d6e
2016-08-01 Uwe Schulzweida 2016-08-01 Uwe Schulzweida
* grb write: added support for projection CDI_PROJ_RLL * grb write: added support for projection CDI_PROJ_RLL
* ieg read: added support for projection CDI_PROJ_RLL * grb, grb2, ieg read: added support for projection CDI_PROJ_RLL
2016-07-30 Uwe Schulzweida 2016-07-30 Uwe Schulzweida
......
This diff is collapsed.
...@@ -164,6 +164,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, double *fsec2, int *isec4, ...@@ -164,6 +164,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, double *fsec2, int *isec4,
grid_init(grid); grid_init(grid);
cdiGridTypeInit(grid, gridtype, 0); cdiGridTypeInit(grid, gridtype, 0);
if ( gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || projtype == CDI_PROJ_RLL ) if ( gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || projtype == CDI_PROJ_RLL )
{ {
if ( ISEC4_NumValues != ISEC2_NumLon*ISEC2_NumLat ) if ( ISEC4_NumValues != ISEC2_NumLon*ISEC2_NumLat )
......
...@@ -459,12 +459,24 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh, ...@@ -459,12 +459,24 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
// I. e. kick the fixed size array and allocate enough space, whatever that may be. // I. e. kick the fixed size array and allocate enough space, whatever that may be.
strncpy(record->varname, varname, sizeof(record->varname)); strncpy(record->varname, varname, sizeof(record->varname));
grid_t *grid = (grid_t *)Malloc(sizeof (*grid)); grid_t *grid = (grid_t *)Malloc(sizeof(*grid));
gribapiGetGrid(gh, grid); gribapiGetGrid(gh, grid);
struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0);
int gridID = gridAdded.Id; int gridID = gridAdded.Id;
if (!gridAdded.isNew) Free(grid); if ( !gridAdded.isNew ) Free(grid);
else if ( grid->projtype == CDI_PROJ_RLL )
{
double xpole = 0, ypole = 0, angle = 0;
grib_get_double(gh, "latitudeOfSouthernPoleInDegrees", &ypole);
grib_get_double(gh, "longitudeOfSouthernPoleInDegrees", &xpole);
grib_get_double(gh, "angleOfRotation", &angle);
xpole = xpole - 180;
if ( fabs(ypole) > 0 ) ypole = -ypole; // change from south to north pole
if ( fabs(angle) > 0 ) angle = -angle;
gridDefProjParamRLL(gridID, xpole, ypole, angle);
}
int zaxistype = gribapiGetZaxisType(gribEditionNumber(gh), leveltype1); int zaxistype = gribapiGetZaxisType(gribEditionNumber(gh), leveltype1);
......
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