Commit e1380948 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Fix representation of three-state struct member.

parent 7e1944c8
......@@ -1910,7 +1910,7 @@ void gridChangeType(int gridID, int gridtype)
static
void grid_check_cyclic(grid_t *gridptr)
{
gridptr->isCyclic = FALSE;
gridptr->isCyclic = 0;
enum { numVertices = 4 };
size_t xsize = gridptr->x.size >= 0 ? (size_t)gridptr->x.size : 0,
ysize = gridptr->y.size >= 0 ? (size_t)gridptr->y.size : 0;
......@@ -1929,7 +1929,7 @@ void grid_check_cyclic(grid_t *gridptr)
double x0 = 2*xvals[xsize-1]-xvals[xsize-2]-360;
if ( IS_NOT_EQUAL(xvals[0], xvals[xsize-1]) )
if ( fabs(x0 - xvals[0]) < 0.01*xinc ) gridptr->isCyclic = TRUE;
if ( fabs(x0 - xvals[0]) < 0.01*xinc ) gridptr->isCyclic = 1;
}
}
else if ( gridptr->type == GRID_CURVILINEAR )
......@@ -1958,7 +1958,7 @@ void grid_check_cyclic(grid_t *gridptr)
nc += fabs(x0-val1) < 0.5*xinc;
}
gridptr->isCyclic = nc > ysize/2 ? TRUE : FALSE;
gridptr->isCyclic = nc > ysize/2;
}
if ( xbounds && xsize > 1 )
......@@ -4183,7 +4183,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->lcc.projflag = intBuffer[GRID_PACK_INT_IDX_LCC_PROJFLAG];
gridP->lcc.scanflag = (short)intBuffer[GRID_PACK_INT_IDX_LCC_SCANFLAG];
gridP->lcc.defined = (short)intBuffer[GRID_PACK_INT_IDX_LCC_DEFINED];
gridP->isCyclic = (short)intBuffer[GRID_PACK_INT_IDX_IS_CYCLIC];
gridP->isCyclic = (signed char)intBuffer[GRID_PACK_INT_IDX_IS_CYCLIC];
gridP->x.flag = (short)intBuffer[GRID_PACK_INT_IDX_X_FLAG];
gridP->y.flag = (short)intBuffer[GRID_PACK_INT_IDX_Y_FLAG];
gridP->gme.nd = intBuffer[GRID_PACK_INT_IDX_GME_ND];
......
......@@ -92,7 +92,6 @@ struct grid_t {
double *area;
struct grid_lcc_t lcc;
struct grid_gme_t gme;
short isCyclic; /* TRUE for global cyclic grids */
int number, position; /* parameter for GRID_REFERENCE */
int trunc; /* parameter for GRID_SPECTEAL */
int nvertex;
......@@ -102,6 +101,11 @@ struct grid_t {
int nrowlon;
int size;
int np; /* number of parallels between a pole and the equator */
signed char isCyclic; /* three possible states:
* -1 if unknown,
* 0 if found not cyclic, or
* 1 for global cyclic grids
*/
bool lcomplex;
bool hasdims;
/* Some models deliver wind U,V relative to the grid-cell */
......
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