Commit 2eedcc93 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapiDefGrid: called only in init mode.

parent 45fb2df8
......@@ -96,7 +96,7 @@ static inline void *gribHandleNew(int editionNumber)
void *gh = (void *)grib_handle_new_from_samples(NULL, (editionNumber == 1) ? "GRIB1" : "GRIB2");
if ( gh == NULL ) Error("grib_handle_new_from_samples failed!");
GRIB_CHECK(my_grib_set_long(gh, "numberOfValues", 0L), 0);
if ( editionNumber > 1 ) GRIB_CHECK(my_grib_set_long(gh, "numberOfValues", 0L), 0);
return gh;
}
......
......@@ -1892,9 +1892,8 @@ getGribApiCompTypeMsg(int comptype, size_t gridsize)
}
static
void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype, bool lieee, int datatype, size_t nmiss, int gcinit, int shapeOfTheEarth)
void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype, bool lieee, int datatype, int shapeOfTheEarth)
{
UNUSED(nmiss);
bool lrotated = false;
bool lcurvi = false;
......@@ -1973,8 +1972,6 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
}
}
if ( gcinit ) return;
if ( editionNumber == 2 )
{
GRIB_CHECK(my_grib_set_long(gh, "numberOfValues", (long)gridsize), 0);
......@@ -3100,7 +3097,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
int shapeOfTheEarth = 0;
cdiInqKeyInt(vlistID, varID, CDI_KEY_SHAPEOFTHEEARTH, &shapeOfTheEarth);
gribapiDefGrid((int)editionNumber, gh, gridID, comptype, lieee, datatype, nmiss, gc->init, shapeOfTheEarth);
if ( ! gc->init ) gribapiDefGrid((int)editionNumber, gh, gridID, comptype, lieee, datatype, shapeOfTheEarth);
gribapiDefLevel((int)editionNumber, gh, zaxisID, levelID, gc->init, productDefinitionTemplate);
......
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