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

Added function gridInqUvRelativeToGrid() (patch from Michal Koutek, KMNI).

parent 61d567f7
......@@ -2,6 +2,10 @@
* Version 1.8.1 released
2017-02-24 Uwe Schulzweida
* Added function gridInqUvRelativeToGrid() (patch from Michal Koutek, KMNI)
2017-02-22 Uwe Schulzweida
* CDI_CHUNK_AUTO: set chunk_size_max to 65536
......
......@@ -964,6 +964,8 @@ void gridChangeType(int gridID, int gridtype);
void gridDefComplexPacking(int gridID, int lpack);
int gridInqComplexPacking(int gridID);
int gridInqUvRelativeToGrid(int gridID);
/* ZAXIS routines */
void zaxisName(int zaxistype, char *zaxisname);
......
......@@ -713,6 +713,11 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
Error("Unsupported grid type: %s", gridNamePtr(gridtype));
}
if ( gridtype == GRID_LONLAT || gridtype == GRID_CURVILINEAR || gridtype == GRID_LCC )
{
GRIB_CHECK(grib_get_long(gh, "uvRelativeToGrid", &grid->uvRelativeToGrid), 0);
}
grid->type = gridtype;
grid->projtype = projtype;
}
......
......@@ -157,6 +157,7 @@ void grid_init(grid_t *gridptr)
gridptr->vtable = &cdiGridVtable;
gridptr->atts.nalloc = MAX_ATTRIBUTES;
gridptr->atts.nelems = 0;
gridptr->uvRelativeToGrid = 0; // Some models deliver wind U,V relative to the grid-cell
}
......@@ -2217,6 +2218,11 @@ bool gridCompare(int gridID, const grid_t *grid, bool coord_compare)
}
}
if ( (grid->uvRelativeToGrid != gridInqUvRelativeToGrid(gridID)) )
{
// often grid definition may differ in UV-relativeToGrid
differ = 1;
}
return differ;
}
......@@ -2277,6 +2283,7 @@ int gridCompareP(void *gridptr1, void *gridptr2)
if ( IS_NOT_EQUAL(g1->lcc.lat2 , g2->lcc.lat2) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc.xinc , g2->lcc.xinc) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc.yinc , g2->lcc.yinc) ) return differ;
if ( IS_NOT_EQUAL(g1->uvRelativeToGrid , g2->uvRelativeToGrid) ) return differ;
const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1),
*restrict g2_xvals = g2->vtable->inqXValsPtr(g2);
......@@ -2615,6 +2622,7 @@ int gridGenerate(const grid_t *grid)
gridptr->lcc.scanflag = grid->lcc.scanflag;
gridptr->number = grid->number;
gridptr->position = grid->position;
gridptr->uvRelativeToGrid = grid->uvRelativeToGrid;
memcpy(gridptr->uuid, grid->uuid, CDI_UUID_SIZE);
if ( gridtype == GRID_UNSTRUCTURED && grid->reference )
gridDefReference(gridID, grid->reference);
......@@ -3926,6 +3934,13 @@ void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE])
}
int gridInqUvRelativeToGrid(int gridID)
{
grid_t *gridptr = grid_to_pointer(gridID);
return gridptr->uvRelativeToGrid;
}
void cdiGridGetIndexList(unsigned ngrids, int * gridIndexList)
{
reshGetResHListOfType(ngrids, gridIndexList, &gridOps);
......
......@@ -104,6 +104,7 @@ struct grid_t {
int np; /* number of parallels between a pole and the equator */
bool lcomplex;
bool hasdims;
long uvRelativeToGrid; /* Some models deliver wind U,V relative to the grid-cell */
struct gridaxis_t x;
struct gridaxis_t y;
const struct gridVirtTable *vtable;
......
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