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

Removed iScansNegatively and jScansPositively from grid structure.

parent 69112120
......@@ -809,6 +809,7 @@ size_t gridInqYCvals(int gridID, char *ycvals[]);
#define CDI_KEY_TYPEOFTIMEINCREMENT 823 // GRIB2 typeOfTimeIncrement
#define CDI_KEY_TYPEOFFIRSTFIXEDSURFACE 824 // GRIB2 typeOfFirstFixedSurface
#define CDI_KEY_TYPEOFSECONDFIXEDSURFACE 825 // GRIB2 typeOfSecondFixedSurface
#define CDI_KEY_SCANNINGMODE 826 // GRIB scanningMode
#define CDI_KEY_VDIMNAME 920 // Vertex dimension name
#define CDI_KEY_GRIDMAP_VARTYPE 921 // Grid mapping var datatype
......@@ -956,12 +957,12 @@ void gridDefParamGME(int gridID, int nd, int ni, int ni2, int ni3);
void gridInqParamGME(int gridID, int *nd, int *ni, int *ni2, int *ni3);
// Lambert Conformal Conic grid
void gridDefParamLCC(int gridID, double missval, double lon_0, double lat_0, double lat_1, double lat_2, double a, double rf, double xval_0, double yval_0, double x_0, double y_0);
int gridInqParamLCC(int gridID, double missval, double *lon_0, double *lat_0, double *lat_1, double *lat_2, double *a, double *rf, double *xval_0, double *yval_0, double *x_0, double *y_0);
void gridDefParamLCC(int gridID, double missval, double lon_0, double lat_0, double lat_1, double lat_2, double a, double rf, double xval_0, double yval_0, double x_0, double y_0);
int gridInqParamLCC(int gridID, double missval, double *lon_0, double *lat_0, double *lat_1, double *lat_2, double *a, double *rf, double *xval_0, double *yval_0, double *x_0, double *y_0);
// Polar stereographic grid
void gridDefParamSTERE(int gridID, double missval, double lon_0, double lat_ts, double lat_0, double a, double xval_0, double yval_0, double x_0, double y_0);
int gridInqParamSTERE(int gridID, double missval, double *lon_0, double *lat_ts, double *lat_0, double *a, double *xval_0, double *yval_0, double *x_0, double *y_0);
void gridDefParamSTERE(int gridID, double missval, double lon_0, double lat_ts, double lat_0, double a, double xval_0, double yval_0, double x_0, double y_0);
int gridInqParamSTERE(int gridID, double missval, double *lon_0, double *lat_ts, double *lat_0, double *a, double *xval_0, double *yval_0, double *x_0, double *y_0);
void gridDefArea(int gridID, const double area[]);
void gridInqArea(int gridID, double area[]);
......
......@@ -849,14 +849,11 @@ bool gribapiGetGrid(grib_handle *gh, grid_t *grid)
if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_LONLAT || gridtype == GRID_PROJECTION )
{
long temp;
GRIB_CHECK(grib_get_long(gh, "iScansNegatively", &temp), 0);
grid->iScansNegatively = (bool)temp;
GRIB_CHECK(grib_get_long(gh, "jScansPositively", &temp), 0);
grid->jScansPositively = (bool)temp;
GRIB_CHECK(grib_get_long(gh, "jPointsAreConsecutive", &temp), 0);
grid->jPointsAreConsecutive = (bool)temp;
grid->scanningMode = 128*grid->iScansNegatively + 64*grid->jScansPositively + 32*grid->jPointsAreConsecutive;
long iScansNegatively, jScansPositively, jPointsAreConsecutive;
GRIB_CHECK(grib_get_long(gh, "iScansNegatively", &iScansNegatively), 0);
GRIB_CHECK(grib_get_long(gh, "jScansPositively", &jScansPositively), 0);
GRIB_CHECK(grib_get_long(gh, "jPointsAreConsecutive", &jPointsAreConsecutive), 0);
grid->scanningMode = 128*iScansNegatively + 64*jScansPositively + 32*jPointsAreConsecutive;
/* scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive;
64 = 128 * 0 + 64 * 1 + 32 * 0
00 = 128 * 0 + 64 * 0 + 32 * 0
......@@ -873,8 +870,8 @@ bool gribapiGetGrid(grib_handle *gh, grid_t *grid)
GRIB_CHECK(grib_get_long(gh, "level", &levelId), 0);
Message("(param,ltype,level) = (%3d,%3d,%4d); Scanning mode = %02d -> bits:(%1d.%1d.%1d)*32; uvRelativeToGrid = %02d",\
(int)paramId, (int)levelTypeId, (int)levelId,
grid->scanningMode,grid->jPointsAreConsecutive,
grid->jScansPositively, grid->iScansNegatively,
grid->scanningMode, jPointsAreConsecutive,
jScansPositively, iScansNegatively,
uvRelativeToGrid);
}
#endif //HIRLAM_EXTENSIONS
......
......@@ -168,16 +168,7 @@ void grid_init(grid_t *gridptr)
cdiInitKeys(&gridptr->keys);
gridptr->atts.nalloc = MAX_ATTRIBUTES;
gridptr->atts.nelems = 0;
gridptr->iScansNegatively = 0;
gridptr->jScansPositively = 1;
gridptr->jPointsAreConsecutive = 0;
gridptr->scanningMode = 128*gridptr->iScansNegatively + 64*gridptr->jScansPositively + 32*gridptr->jPointsAreConsecutive;
/* scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive;
64 = 128 * 0 + 64 * 1 + 32 * 0
00 = 128 * 0 + 64 * 0 + 32 * 0
96 = 128 * 0 + 64 * 1 + 32 * 1
Default / implicit scanning mode is 64:
i and j scan positively, i points are consecutive (row-major) */
gridptr->scanningMode = 64;
}
......@@ -2403,7 +2394,7 @@ int gridCompareP(void *gridptr1, void *gridptr2)
if ( IS_NOT_EQUAL(g1->y.last , g2->y.last) ) return differ;
if ( IS_NOT_EQUAL(g1->x.inc , g2->x.inc) ) return differ;
if ( IS_NOT_EQUAL(g1->y.inc , g2->y.inc) ) return differ;
if ( IS_NOT_EQUAL(g1->scanningMode , g2->scanningMode) ) return differ;
if ( IS_NOT_EQUAL(g1->scanningMode , g2->scanningMode) ) return differ;
const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1),
*restrict g2_xvals = g2->vtable->inqXValsPtr(g2);
......@@ -2721,10 +2712,6 @@ int gridGenerate(const grid_t *grid)
gridptr->number = grid->number;
gridptr->position = grid->position;
gridptr->scanningMode = grid->scanningMode;
gridptr->iScansNegatively = grid->iScansNegatively;
gridptr->jScansPositively = grid->jScansPositively;
gridptr->jPointsAreConsecutive = grid->jPointsAreConsecutive;
if ( gridtype == GRID_UNSTRUCTURED && grid->reference )
gridDefReference(gridID, grid->reference);
if ( gridtype == GRID_PROJECTION )
......@@ -4122,12 +4109,6 @@ void gridDefScanningMode(int gridID, int mode)
int gridInqScanningMode(int gridID)
{
grid_t *gridptr = grid_to_pointer(gridID);
int scanningModeTMP = 128 * gridptr->iScansNegatively + 64 * gridptr->jScansPositively + 32 * gridptr->jPointsAreConsecutive;
if ( scanningModeTMP != gridptr->scanningMode )
Message("WARNING: scanningMode (%d) ! = (%d) 128 * iScansNegatively(%d) + 64 * jScansPositively(%d) + 32 * jPointsAreConsecutive(%d) ",
gridptr->scanningMode, scanningModeTMP, gridptr->iScansNegatively,gridptr->jScansPositively,gridptr->jPointsAreConsecutive );
return gridptr->scanningMode;
}
......@@ -4166,9 +4147,11 @@ enum {
GRID_PACK_INT_IDX_MEMBERMASK,
GRID_PACK_INT_IDX_XTSTDNNAME,
GRID_PACK_INT_IDX_YTSTDNNAME,
/*
GRID_PACK_INT_IDX_ISCANSNEGATIVELY,
GRID_PACK_INT_IDX_JSCANSPOSITIVELY,
GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE,
*/
GRID_PACK_INT_IDX_SCANNINGMODE,
gridNint
};
......@@ -4363,10 +4346,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
memberMask = intBuffer[GRID_PACK_INT_IDX_MEMBERMASK];
gridP->x.stdname = xystdname_tab[intBuffer[GRID_PACK_INT_IDX_XTSTDNNAME]][0];
gridP->y.stdname = xystdname_tab[intBuffer[GRID_PACK_INT_IDX_YTSTDNNAME]][1];
gridP->iScansNegatively = (bool)intBuffer[GRID_PACK_INT_IDX_ISCANSNEGATIVELY];
gridP->jScansPositively = (bool)intBuffer[GRID_PACK_INT_IDX_JSCANSPOSITIVELY];
gridP->jPointsAreConsecutive = (bool)intBuffer[GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE];
gridP->scanningMode = intBuffer[GRID_PACK_INT_IDX_SCANNINGMODE];
gridP->scanningMode = intBuffer[GRID_PACK_INT_IDX_SCANNINGMODE];
}
if (memberMask & gridHasReducedPointsFlag)
......@@ -4543,9 +4523,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
(int)((const char (*)[2][24])gridP->y.stdname
- (const char (*)[2][24])xystdname_tab[0][1]);
intBuffer[GRID_PACK_INT_IDX_ISCANSNEGATIVELY] = gridP->iScansNegatively;
intBuffer[GRID_PACK_INT_IDX_JSCANSPOSITIVELY] = gridP->jScansPositively;
intBuffer[GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE] = gridP->jPointsAreConsecutive;
intBuffer[GRID_PACK_INT_IDX_SCANNINGMODE] = gridP->scanningMode;
serializePack(intBuffer, gridNint, CDI_DATATYPE_INT,
......
......@@ -112,13 +112,6 @@ struct grid_t {
cdi_keys_t keys;
cdi_atts_t atts;
int scanningMode;
bool iScansNegatively, jScansPositively, jPointsAreConsecutive;
/* scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive;
64 = 128 * 0 + 64 * 1 + 32 * 0
00 = 128 * 0 + 64 * 0 + 32 * 0
96 = 128 * 0 + 64 * 1 + 32 * 1
Default / implicit scanning mode is 64:
i and j scan positively, i points are consecutive (row-major) */
};
......
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