Commit c0e1541c authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridToCurvilinear: Check that nvertex of regular lonlat grid is 2 [Bug #7744]

parent 374d11aa
2017-05-15 Uwe Schulzweida
2017-08-15 Uwe Schulzweida
* Using CDI library version 1.8.3
* Version 1.9.0 release
2017-05-17 Uwe Schulzweida
* gridToCurvilinear: Check that nvertex of regular lonlat grid is 2 [Bug #7744]
2017-05-16 Uwe Schulzweida
* Renamed all .c files to .cc, code needs to be compiled with a C++ compiler!!!
2017-05-16 Uwe Schulzweida
* Using CDI library version 1.8.2
* Version 1.8.2 release
......
......@@ -905,6 +905,7 @@ int gridToCurvilinear(int gridID1, int lbounds)
double *xbounds = NULL, *ybounds = NULL;
char xunits[CDI_MAX_NAME], yunits[CDI_MAX_NAME];
size_t nvertex = (size_t) gridInqNvertex(gridID1);
gridInqXunits(gridID1, xunits);
gridInqYunits(gridID1, yunits);
......@@ -984,7 +985,7 @@ int gridToCurvilinear(int gridID1, int lbounds)
if ( !lbounds ) goto NO_BOUNDS;
if ( gridInqXbounds(gridID1, NULL) )
if ( nvertex == 2 && gridInqXbounds(gridID1, NULL) )
{
xbounds = (double*) Malloc(2*nx*sizeof(double));
gridInqXbounds(gridID1, xbounds);
......@@ -1002,7 +1003,7 @@ int gridToCurvilinear(int gridID1, int lbounds)
grid_gen_bounds(nx, xvals, xbounds);
}
if ( gridInqYbounds(gridID1, NULL) )
if ( nvertex == 2 && gridInqYbounds(gridID1, NULL) )
{
ybounds = (double*) Malloc(2*ny*sizeof(double));
gridInqYbounds(gridID1, ybounds);
......@@ -1131,8 +1132,8 @@ int gridToUnstructuredSelecton(int gridID1, size_t selectionSize, int *selection
gridDefXsize(unstructuredSelectionGridID, selectionSize);
gridDefYsize(unstructuredSelectionGridID, selectionSize);
double *xvals = (double*) Malloc(selectionSize*sizeof(double));
double *yvals = (double*) Malloc(selectionSize*sizeof(double));
double *xvals = (double*) Malloc(selectionSize*sizeof(double));
double *yvals = (double*) Malloc(selectionSize*sizeof(double));
for (size_t i = 0; i < selectionSize; i++)
{
......@@ -1258,9 +1259,10 @@ int gridToUnstructured(int gridID1, int lbounds)
if ( lbounds )
{
size_t nvertex = (size_t) gridInqNvertex(gridID1);
double *xbounds = NULL, *ybounds = NULL;
if ( gridInqXbounds(gridID1, NULL) )
if ( nvertex == 2 && gridInqXbounds(gridID1, NULL) )
{
xbounds = (double*) Malloc(2*nx*sizeof(double));
gridInqXbounds(gridID1, xbounds);
......@@ -1271,7 +1273,7 @@ int gridToUnstructured(int gridID1, int lbounds)
grid_gen_bounds(nx, xvals, xbounds);
}
if ( gridInqYbounds(gridID1, NULL) )
if ( nvertex == 2 && gridInqYbounds(gridID1, NULL) )
{
ybounds = (double*) Malloc(2*ny*sizeof(double));
gridInqYbounds(gridID1, ybounds);
......
Supports Markdown
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