Commit 405e8e93 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

grbGetGridtype: return changed gridID (bug fix).

parent 45f62b8d
......@@ -3,6 +3,10 @@
* using CGRIBEX library version 1.9.4
* Version 1.9.8 released
2019-08-01 Uwe Schulzweida
* grbGetGridtype: return changed gridID (bug fix) [report: Florian Prill]
2019-07-22 Uwe Schulzweida
* Moved grib2LocalSectionPresent=0 to gribContainersNew() [report: Florian Prill]
......
......@@ -1772,7 +1772,7 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
int gridsize = (int) gridInqSize(gridID);
bool gridIsRotated = false;
bool gridIsCurvilinear = false;
int gridtype = grbGetGridtype(gridID, gridsize, &gridIsRotated, &gridIsCurvilinear);
int gridtype = grbGetGridtype(&gridID, gridsize, &gridIsRotated, &gridIsCurvilinear);
switch (gridtype)
{
......
......@@ -405,14 +405,14 @@ void streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum)
}
int grbGetGridtype(int gridID, size_t gridsize, bool *gridIsRotated, bool *gridIsCurvilinear)
int grbGetGridtype(int *gridID, size_t gridsize, bool *gridIsRotated, bool *gridIsCurvilinear)
{
int gridtype = gridInqType(gridID);
int gridtype = gridInqType(*gridID);
if ( gridtype == GRID_GENERIC )
{
int xsize = (int) gridInqXsize(gridID);
int ysize = (int) gridInqYsize(gridID);
int xsize = (int) gridInqXsize(*gridID);
int ysize = (int) gridInqYsize(*gridID);
if ( (ysize == 32 || ysize == 48 || ysize == 64 ||
ysize == 96 || ysize == 160 || ysize == 192 ||
......@@ -426,17 +426,17 @@ int grbGetGridtype(int gridID, size_t gridsize, bool *gridIsRotated, bool *gridI
{
gridtype = GRID_LONLAT;
}
else if ( gridInqXvals(gridID, NULL) && gridInqYvals(gridID, NULL) )
else if ( gridInqXvals(*gridID, NULL) && gridInqYvals(*gridID, NULL) )
{
gridtype = GRID_LONLAT;
}
}
else if ( gridtype == GRID_CURVILINEAR )
{
int projID = gridInqProj(gridID);
int projID = gridInqProj(*gridID);
if ( projID != CDI_UNDEFID && gridInqType(projID) == GRID_PROJECTION )
{
gridID = projID;
*gridID = projID;
gridtype = GRID_PROJECTION;
}
else
......@@ -454,7 +454,7 @@ int grbGetGridtype(int gridID, size_t gridsize, bool *gridIsRotated, bool *gridI
if ( gridtype == GRID_PROJECTION )
{
int projtype = gridInqProjType(gridID);
int projtype = gridInqProjType(*gridID);
if ( projtype == CDI_PROJ_RLL )
{
gridtype = GRID_LONLAT;
......
......@@ -31,7 +31,7 @@ int grib2ltypeToZaxisType(int grib_ltype);
int zaxisTypeToGrib1ltype(int zaxistype);
int zaxisTypeToGrib2ltype(int zaxistype);
int grbGetGridtype(int gridID, size_t gridsize, bool *gridIsRotated, bool *gridIsCurvilinear);
int grbGetGridtype(int *gridID, size_t gridsize, bool *gridIsRotated, bool *gridIsCurvilinear);
struct cdiGribParamChange
{
......
......@@ -2198,7 +2198,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
const size_t gridsize = gridInqSize(gridID);
bool gridIsRotated = false;
bool gridIsCurvilinear = false;
const int gridtype = grbGetGridtype(gridID, gridsize, &gridIsRotated, &gridIsCurvilinear);
const int gridtype = grbGetGridtype(&gridID, gridsize, &gridIsRotated, &gridIsCurvilinear);
bool lieee = (editionNumber == 2 && (datatype == CDI_DATATYPE_FLT32 || datatype == CDI_DATATYPE_FLT64));
bool lspectral = (gridtype == GRID_SPECTRAL);
......
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