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

add SIGMA level support

parent 265296e1
......@@ -2,6 +2,7 @@
* using GRIB library version 1.0.3
* using EXSE library version 1.0.1
* add SIGMA level support
* gridPrint: extented
* Version 1.0.3 released
......
......@@ -104,6 +104,7 @@ extern "C" {
#define ZAXIS_ISENTROPIC 8
#define ZAXIS_TRAJECTORY 9
#define ZAXIS_ALTITUDE 10
#define ZAXIS_SIGMA 11
/* TAXIS types */
......
/* Generated automatically from m214003 on Wed Oct 11 10:35:23 CEST 2006 */
/* Generated automatically from m214003 on Mon Oct 23 12:36:43 CEST 2006 */
#if defined (HAVE_CONFIG_H)
# include "config.h"
......@@ -3100,6 +3100,12 @@ int encodeBDS(GRIBPACK *lGrib, int *gribLen, int decscale, int *isec2, int *isec
Message(func, "complex packing of spectral data unsupported, using simple packing!");
}
if ( decscale )
{
double scale = pow(10.0, (double) decscale);
for ( i = 0; i < datasize; ++i ) data[i] *= scale;
}
if ( ISEC2_GridType == GTYPE_SPECTRAL )
{
*datstart = 15;
......@@ -3124,12 +3130,6 @@ int encodeBDS(GRIBPACK *lGrib, int *gribLen, int decscale, int *isec2, int *isec
Flag += unused_bits;
if ( decscale )
{
double scale = pow(10.0, (double) decscale);
for ( i = PackStart; i < datasize; ++i ) data[i] *= scale;
}
fmin = fmax = data[PackStart];
#if defined (CRAY)
......@@ -3360,6 +3360,9 @@ int encodeBDS(GRIBPACK *lGrib, int *gribLen, int decscale, int *isec2, int *isec
}
if (cbits != 8) lGrib[z++] = c << cbits;
}
else if ( ISEC4_NumBits == 0 )
{
}
else
{
Error(func, "Unimplemented packing factor %d", ISEC4_NumBits);
......@@ -4162,14 +4165,6 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
zscale = 1.0/intpow2(-jscale);
else
zscale = intpow2(jscale);
if ( decscale )
{
double scale;
scale = pow(10.0, (double)-decscale);
fmin *= scale;
zscale *= scale;
}
}
/* get number of bits in each data value. */
......@@ -4424,6 +4419,13 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
scaleComplex(fsec4, pcStart, pcScale, ISEC2_PentaJ);
}
if ( decscale )
{
double scale = pow(10.0, (double)-decscale);
for ( i = 0; i < ISEC4_NumValues; i++ ) fsec4[i] *= scale;
}
return (bdsLen);
}
......@@ -8041,7 +8043,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen);
}
static const char grb_libvers[] = "1.0.3" " of ""Oct 11 2006"" ""10:35:23";
static const char grb_libvers[] = "1.0.3" " of ""Oct 23 2006"" ""12:36:44";
......
......@@ -341,6 +341,11 @@ int gribGetZaxisType(int grbleveltype)
leveltype = ZAXIS_ALTITUDE;
break;
}
case LTYPE_SIGMA:
{
leveltype = ZAXIS_SIGMA;
break;
}
case LTYPE_HYBRID:
case LTYPE_HYBRID_LAYER:
{
......@@ -1876,6 +1881,17 @@ void grbDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int levelID
ISEC1_Level1 = ilevel;
ISEC1_Level2 = 0;
break;
}
case ZAXIS_SIGMA:
{
level = zaxisInqLevel(zaxisID, levelID);
ilevel = (int) level;
ISEC1_LevelType = LTYPE_SIGMA;
ISEC1_Level1 = ilevel;
ISEC1_Level2 = 0;
break;
}
case ZAXIS_DEPTH_BELOW_LAND:
......
......@@ -29,6 +29,7 @@ LevelTypeEntry[] = {
{"lev", "isentropic", "K"},
{"lev", "trajectory", ""},
{"alt", "altitude", "m"},
{"lev", "sigma", "level"},
};
static int CDI_MaxLeveltype = sizeof(LevelTypeEntry) / sizeof(LevelTypeEntry[0]);
......
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