Commit 01bb759b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapiDefLevel: Bug fix for ZAXIS_REFERENCE (Bug #3747)

parent 1ab32a80
......@@ -3,6 +3,10 @@
* Version 1.6.2 released
* using CGRIBEX library version 1.6.2
2013-08-26 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* gribapiDefLevel: Bug fix for ZAXIS_REFERENCE (Bug #3747)
2013-08-16 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* netCDF: read reference of an unstructured grid
......
......@@ -2921,21 +2921,63 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
}
case ZAXIS_REFERENCE:
{
if ( editionNumber <= 1 )
; // not available
if ( !gcinit )
{
GRIB_CHECK(grib_set_long(gh, "genVertHeightCoords", 1), 0);
}
if ( lbounds )
{
if ( editionNumber <= 1 )
; // not available
else
{
reference = zaxisInqReference(zaxisID);
gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", GRIB2_LTYPE_REFERENCE);
GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)+1), 0);
GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
len = 16;
if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
Warning("Can't write UUID!");
GRIB_CHECK(grib_set_long(gh, "topLevel", (long) dlevel1), 0);
GRIB_CHECK(grib_set_long(gh, "bottomLevel", (long) dlevel2), 0);
}
}
else
{
reference = zaxisInqReference(zaxisID);
gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)), 0);
GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
len = 16;
if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
Warning("Can't write UUID!");
GRIB_CHECK(grib_set_double(gh, "level", level), 0);
if ( editionNumber <= 1 )
; // not available
else
{
reference = zaxisInqReference(zaxisID);
gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)), 0);
GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
len = 16;
if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
Warning("Can't write UUID!");
GRIB_CHECK(grib_set_double(gh, "level", level), 0);
}
}
// if ( editionNumber <= 1 )
// ; // not available
// else
// {
// reference = zaxisInqReference(zaxisID);
// gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
// GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
// GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)), 0);
// GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
// len = 16;
// if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
// Warning("Can't write UUID!");
// GRIB_CHECK(grib_set_double(gh, "level", level), 0);
// }
break;
}
case ZAXIS_GENERIC:
......
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