Commit 6b6cbbb3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added level type ZAXIS_NOMINAL_TOP, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE

parent 6574245b
2011-10-06 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added level type ZAXIS_NOMINAL_TOP, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE [request: Drte Liermann]
2011-10-05 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* stream_cdf::cdfInqContents: check units of hybrid levels
......
CDI NEWS
--------
Version 1.5.3 (?? October 2011):
New features:
* Added support for level type ZAXIS_NOMINAL_TOP, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE
Fixed bugs:
* deflate compression with netCDF4 doesn't work
Version 1.5.2 (22 August 2011):
New features:
......
......@@ -147,6 +147,9 @@ extern "C" {
#define ZAXIS_ALTITUDE 10 /* Altitude above mean sea level in meters */
#define ZAXIS_SIGMA 11 /* Sigma level */
#define ZAXIS_MEANSEA 12 /* Mean sea level */
#define ZAXIS_NOMINAL_TOP 13 /* Norminal top of atmosphere */
#define ZAXIS_SEA_BOTTOM 14 /* Sea bottom */
#define ZAXIS_ATMOSPHERE 15 /* Entire atmosphere */
/* TAXIS types */
......
......@@ -8,6 +8,9 @@
/* GRIB1 Level Types */
#define GRIB1_LTYPE_SURFACE 1
#define GRIB1_LTYPE_NOMINAL_TOP 8
#define GRIB1_LTYPE_SEA_BOTTOM 9
#define GRIB1_LTYPE_ATMOSPHERE 10
#define GRIB1_LTYPE_99 99
#define GRIB1_LTYPE_ISOBARIC 100
#define GRIB1_LTYPE_MEANSEA 102
......@@ -240,12 +243,3 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
#endif /* _CGRIBEX_H */
/*
* Local Variables:
* c-file-style: "Java"
* c-basic-offset: 2
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
......@@ -5,6 +5,9 @@
/* GRIB2 Level Types */
#define GRIB2_LTYPE_SURFACE 1
#define GRIB2_LTYPE_NOMINAL_TOP 8
#define GRIB2_LTYPE_SEA_BOTTOM 9
#define GRIB2_LTYPE_ATMOSPHERE 10
#define GRIB2_LTYPE_ISOBARIC 100
#define GRIB2_LTYPE_MEANSEA 101
#define GRIB2_LTYPE_ALTITUDE 102
......
......@@ -1919,6 +1919,27 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
ISEC1_Level2 = 0;
break;
}
case ZAXIS_NOMINAL_TOP:
{
ISEC1_LevelType = GRIB1_LTYPE_NOMINAL_TOP;
ISEC1_Level1 = 0;
ISEC1_Level2 = 0;
break;
}
case ZAXIS_SEA_BOTTOM:
{
ISEC1_LevelType = GRIB1_LTYPE_SEA_BOTTOM;
ISEC1_Level1 = 0;
ISEC1_Level2 = 0;
break;
}
case ZAXIS_ATMOSPHERE:
{
ISEC1_LevelType = GRIB1_LTYPE_ATMOSPHERE;
ISEC1_Level1 = 0;
ISEC1_Level2 = 0;
break;
}
case ZAXIS_MEANSEA:
{
ISEC1_LevelType = GRIB1_LTYPE_MEANSEA;
......
......@@ -23,6 +23,9 @@ int grib1ltypeToZaxisType(int grib_ltype)
switch ( grib_ltype )
{
case GRIB1_LTYPE_SURFACE: { zaxistype = ZAXIS_SURFACE; break; }
case GRIB1_LTYPE_NOMINAL_TOP: { zaxistype = ZAXIS_NOMINAL_TOP; break; }
case GRIB1_LTYPE_SEA_BOTTOM: { zaxistype = ZAXIS_SEA_BOTTOM; break; }
case GRIB1_LTYPE_ATMOSPHERE: { zaxistype = ZAXIS_ATMOSPHERE; break; }
case GRIB1_LTYPE_MEANSEA: { zaxistype = ZAXIS_MEANSEA; break; }
case GRIB1_LTYPE_99:
case GRIB1_LTYPE_ISOBARIC: { zaxistype = ZAXIS_PRESSURE; break; }
......@@ -48,6 +51,9 @@ int grib2ltypeToZaxisType(int grib_ltype)
switch ( grib_ltype )
{
case GRIB2_LTYPE_SURFACE: { zaxistype = ZAXIS_SURFACE; break; }
case GRIB2_LTYPE_NOMINAL_TOP: { zaxistype = ZAXIS_NOMINAL_TOP; break; }
case GRIB2_LTYPE_SEA_BOTTOM: { zaxistype = ZAXIS_SEA_BOTTOM; break; }
case GRIB2_LTYPE_ATMOSPHERE: { zaxistype = ZAXIS_ATMOSPHERE; break; }
case GRIB2_LTYPE_MEANSEA: { zaxistype = ZAXIS_MEANSEA; break; }
case GRIB2_LTYPE_ISOBARIC: { zaxistype = ZAXIS_PRESSURE; break; }
case GRIB2_LTYPE_HEIGHT: { zaxistype = ZAXIS_HEIGHT; break; }
......
......@@ -2344,6 +2344,30 @@ void gribapiDefLevel(grib_handle *gh, int param, int zaxisID, int levelID)
GRIB_CHECK(grib_set_long(gh, "level", (long) zaxisInqLevel(zaxisID, levelID)), 0);
break;
}
case ZAXIS_NOMINAL_TOP:
{
if ( editionNumber <= 1 )
GRIB_CHECK(grib_set_long(gh, "indicatorOfTypeOfLevel", GRIB1_LTYPE_NOMINAL_TOP), 0);
else
GRIB_CHECK(grib_set_long(gh, "typeOfFirstFixedSurface", GRIB2_LTYPE_NOMINAL_TOP), 0);
break;
}
case ZAXIS_SEA_BOTTOM:
{
if ( editionNumber <= 1 )
GRIB_CHECK(grib_set_long(gh, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SEA_BOTTOM), 0);
else
GRIB_CHECK(grib_set_long(gh, "typeOfFirstFixedSurface", GRIB2_LTYPE_SEA_BOTTOM), 0);
break;
}
case ZAXIS_ATMOSPHERE:
{
if ( editionNumber <= 1 )
GRIB_CHECK(grib_set_long(gh, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ATMOSPHERE), 0);
else
GRIB_CHECK(grib_set_long(gh, "typeOfFirstFixedSurface", GRIB2_LTYPE_ATMOSPHERE), 0);
break;
}
case ZAXIS_MEANSEA:
{
level = zaxisInqLevel(zaxisID, levelID);
......
......@@ -24,19 +24,22 @@ static struct {
char *units; // 1: up; 2: down
}
ZaxistypeEntry[] = {
{0, "sfc", "surface", "", ""},
{0, "lev", "generic", "", "level"},
{2, "lev", "hybrid", "", "level"},
{2, "lev", "hybrid_half", "", "level"},
{2, "lev", "pressure", "air_pressure", "Pa"},
{1, "height", "height", "height", "m"},
{2, "depth", "depth_below_sea", "depth", "m"},
{2, "depth", "depth_below_land", "", "cm"},
{0, "lev", "isentropic", "", "K"},
{0, "lev", "trajectory", "", ""},
{1, "alt", "altitude", "", "m"},
{0, "lev", "sigma", "", "level"},
{0, "lev", "meansea", "", "level"},
{ /* 0 */ 0, "sfc", "surface", "", ""},
{ /* 1 */ 0, "lev", "generic", "", "level"},
{ /* 2 */ 2, "lev", "hybrid", "", "level"},
{ /* 3 */ 2, "lev", "hybrid_half", "", "level"},
{ /* 4 */ 2, "lev", "pressure", "air_pressure", "Pa"},
{ /* 5 */ 1, "height", "height", "height", "m"},
{ /* 6 */ 2, "depth", "depth_below_sea", "depth", "m"},
{ /* 7 */ 2, "depth", "depth_below_land", "", "cm"},
{ /* 8 */ 0, "lev", "isentropic", "", "K"},
{ /* 9 */ 0, "lev", "trajectory", "", ""},
{ /* 10 */ 1, "alt", "altitude", "", "m"},
{ /* 11 */ 0, "lev", "sigma", "", "level"},
{ /* 12 */ 0, "lev", "meansea", "", "level"},
{ /* 13 */ 0, "toa", "nominal_top", "", ""},
{ /* 14 */ 0, "seabottom", "sea_bottom", "", ""},
{ /* 15 */ 0, "atmosphere", "atmosphere", "", ""},
};
static int CDI_MaxZaxistype = sizeof(ZaxistypeEntry) / sizeof(ZaxistypeEntry[0]);
......@@ -121,7 +124,7 @@ static
void zaxis_init_pointer(void)
{
int i;
for ( i = 0; i < _zaxis_max; i++ )
{
_zaxisList[i].next = _zaxisList + i + 1;
......@@ -173,7 +176,7 @@ int zaxis_from_pointer(zaxis_t *ptr)
newptr->next = 0;
idx = newptr->idx;
newptr->ptr = ptr;
if ( ZAXIS_Debug )
Message("Pointer %p has idx %d from zaxis list", ptr, idx);
}
......@@ -292,7 +295,7 @@ int zaxisSize(void)
{
int zaxissize = 0;
int i;
ZAXIS_INIT();
ZAXIS_LOCK();
......@@ -510,7 +513,7 @@ void zaxisDefUnits(int zaxisID, const char *units)
@Prototype void zaxisInqName(int zaxisID, char *name)
@Parameter
@Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}.
@Item name Name of the Z-axis. The caller must allocate space for the
@Item name Name of the Z-axis. The caller must allocate space for the
returned string. The maximum possible length, in characters, of
the string is given by the predefined constant CDI_MAX_NAME.
......@@ -540,7 +543,7 @@ void zaxisInqName(int zaxisID, char *name)
@Prototype void zaxisInqLongname(int zaxisID, char *longname)
@Parameter
@Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}.
@Item longname Longname of the Z-axis. The caller must allocate space for the
@Item longname Longname of the Z-axis. The caller must allocate space for the
returned string. The maximum possible length, in characters, of
the string is given by the predefined constant CDI_MAX_NAME.
......@@ -570,7 +573,7 @@ void zaxisInqLongname(int zaxisID, char *longname)
@Prototype void zaxisInqUnits(int zaxisID, char *units)
@Parameter
@Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}
@Item units Units of the Z-axis. The caller must allocate space for the
@Item units Units of the Z-axis. The caller must allocate space for the
returned string. The maximum possible length, in characters, of
the string is given by the predefined constant CDI_MAX_NAME.
......@@ -811,7 +814,7 @@ const double *zaxisInqLevelsPtr(int zaxisID)
@Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}.
@Item levels Pointer to the location into which the levels are read.
The caller must allocate space for the returned values.
@Description
The function @func{zaxisInqLevels} returns all levels of a Z-axis.
......
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