Commit 95d7bb27 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Read of reduced Gaussian grid description file failed [Bug #8146].

parent 3756fd1d
2018-02-25 Uwe Schulzweida
* Using CDI library version 1.9.3
* Version 1.9.3 release
2017-12-26 Uwe Schulzweida
* read of reduced Gaussian grid description file failed [Bug #8146]
2017-12-06 Uwe Schulzweida
* remapdis/remapnn without extrapolation on non global curvilinear grids:
......
......@@ -271,7 +271,7 @@ void grid_print_kernel(int gridID, int opt, FILE *fp)
}
}
if ( nxvals > 0 )
if ( nxvals > 0 && type != GRID_GAUSSIAN_REDUCED )
{
double xfirst = 0.0, xinc = 0.0;
......
......@@ -81,6 +81,7 @@ void grid_read_data(size_t ikv, size_t nkv, kvmap_t *kvmap, griddes_t *grid, siz
if ( STR_IS_EQ(gridtype, "lonlat") ) grid->type = GRID_LONLAT;
else if ( STR_IS_EQ(gridtype, "latlon") ) grid->type = GRID_LONLAT;
else if ( STR_IS_EQ(gridtype, "gaussian") ) grid->type = GRID_GAUSSIAN;
else if ( STR_IS_EQ(gridtype, "gaussian_reduced") ) grid->type = GRID_GAUSSIAN_REDUCED;
else if ( STR_IS_EQ(gridtype, "curvilinear") ) grid->type = GRID_CURVILINEAR;
else if ( STR_IS_EQ(gridtype, "unstructured") ) grid->type = GRID_UNSTRUCTURED;
else if ( STR_IS_EQ(gridtype, "cell") ) grid->type = GRID_UNSTRUCTURED;
......@@ -88,7 +89,7 @@ void grid_read_data(size_t ikv, size_t nkv, kvmap_t *kvmap, griddes_t *grid, siz
else if ( STR_IS_EQ(gridtype, "gme") ) grid->type = GRID_GME;
else if ( STR_IS_EQ(gridtype, "projection") ) grid->type = GRID_PROJECTION;
else if ( STR_IS_EQ(gridtype, "generic") ) grid->type = GRID_GENERIC;
else cdoAbort("Invalid gridtype : %s (grid description file: %s)", gridtype, dname);
else cdoAbort("Invalid gridtype: %s (grid description file: %s)", gridtype, dname);
if ( grid->type == GRID_LONLAT || grid->type == GRID_GAUSSIAN ) grid->nvertex = 2;
else if ( grid->type == GRID_CURVILINEAR ) grid->nvertex = 4;
......@@ -99,7 +100,7 @@ void grid_read_data(size_t ikv, size_t nkv, kvmap_t *kvmap, griddes_t *grid, siz
if ( STR_IS_EQ(datatype, "double") ) grid->datatype = CDI_DATATYPE_FLT64;
else if ( STR_IS_EQ(datatype, "float") ) grid->datatype = CDI_DATATYPE_FLT32;
else cdoAbort("Invalid datatype : %s (zaxis description file: %s)", datatype, dname);
else cdoAbort("Invalid datatype: %s (zaxis description file: %s)", datatype, dname);
}
else if ( STR_IS_EQ(key, "gridsize") ) grid->size = parameter2sizet(value);
else if ( STR_IS_EQ(key, "xsize") ) grid->xsize = parameter2sizet(value);
......@@ -216,6 +217,16 @@ void grid_read_data(size_t ikv, size_t nkv, kvmap_t *kvmap, griddes_t *grid, siz
}
if ( count == size ) { Free(grid->mask); grid->mask = NULL; }
}
else if ( STR_IS_EQ(key, "rowlon") )
{
size_t size = grid->ysize;
if ( size == 0 ) cdoAbort("ysize undefined (grid description file: %s)!", dname);
grid->rowlon = (int*) Malloc(size*sizeof(int));
for ( size_t i = 0; i < size; ++i )
{
grid->rowlon[i] = parameter2int(kv->values[i]);
}
}
else if ( STR_IS_EQ(key, "grid_mapping_name") ) { *igmap = ik; break; }
else if ( STR_IS_EQ(key, "grid_mapping") ) { *igmap = ik; break; }
else cdoAbort("Invalid key word >%s< (grid description file: %s)", key, dname);
......
......@@ -39,6 +39,7 @@ void gridInit(griddes_t *grid)
grid->yvals = NULL;
grid->xbounds = NULL;
grid->ybounds = NULL;
grid->rowlon = NULL;
grid->area = NULL;
grid->type = CDI_UNDEFID;
grid->datatype = CDI_UNDEFID;
......@@ -133,17 +134,18 @@ int gridDefine(griddes_t grid)
case GRID_GENERIC:
case GRID_LONLAT:
case GRID_GAUSSIAN:
case GRID_GAUSSIAN_REDUCED:
case GRID_PROJECTION:
{
if ( grid.size != 1 )
{
if ( grid.xsize == 0 ) Error("xsize undefined!");
if ( grid.xsize == 0 && grid.type != GRID_GAUSSIAN_REDUCED ) Error("xsize undefined!");
if ( grid.ysize == 0 ) Error("ysize undefined!");
}
if ( grid.size == 0 ) grid.size = grid.xsize*grid.ysize;
if ( grid.size != grid.xsize*grid.ysize )
if ( grid.xsize && grid.size != grid.xsize*grid.ysize )
Error("Inconsistent grid declaration: xsize*ysize!=gridsize (xsize=%zu ysize=%zu gridsize=%zu)",
grid.xsize, grid.ysize, grid.size);
......@@ -211,6 +213,7 @@ int gridDefine(griddes_t grid)
if ( grid.xbounds ) { gridDefXbounds(gridID, grid.xbounds); Free(grid.xbounds); }
if ( grid.ybounds ) { gridDefYbounds(gridID, grid.ybounds); Free(grid.ybounds); }
if ( grid.mask ) { gridDefMask(gridID, grid.mask); Free(grid.mask); }
if ( grid.rowlon ) { gridDefRowlon(gridID, grid.ysize, grid.rowlon); Free(grid.rowlon); }
break;
}
......
......@@ -2,7 +2,7 @@
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter ID
1 : ECMWF unknown v instant 1 1 35718 1 P16 : 151.128
Grid coordinates :
1 : gaussian reduced : points=35718 nlat=160 np=80
1 : gaussian_reduced : points=35718 nlat=160 np=80
lat : 89.14152 to -89.14152 degrees_north
Vertical coordinates :
1 : surface : levels=1
......
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