diff --git a/ChangeLog b/ChangeLog index 2f158a702b483975546d3edeb021f2eb83ea97d7..9818f78735fdc989255af9e3af15c5262b5b23b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/cdi.h b/src/cdi.h index 1f0188891890b5ac82ff5df2384afd349df21b46..68bfbb8ff54a9aeaaff370d7474ac0e0896ec6f8 100644 --- a/src/cdi.h +++ b/src/cdi.h @@ -104,6 +104,7 @@ extern "C" { #define ZAXIS_ISENTROPIC 8 #define ZAXIS_TRAJECTORY 9 #define ZAXIS_ALTITUDE 10 +#define ZAXIS_SIGMA 11 /* TAXIS types */ diff --git a/src/griblib.c b/src/griblib.c index 6236deaea3bcdaa1577f1b2c127d44166ff71960..7f431876d1b076565cb2e2c4929b9fbf5c1b1bd3 100644 --- a/src/griblib.c +++ b/src/griblib.c @@ -1,5 +1,5 @@ -/* 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"; diff --git a/src/stream_grb.c b/src/stream_grb.c index c0660d8851eb4c87075d8c4e9cb762d0b8375b7b..458a1e65ad11d029304ed8440862969b1870aed0 100644 --- a/src/stream_grb.c +++ b/src/stream_grb.c @@ -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: diff --git a/src/zaxis.c b/src/zaxis.c index 019e9e2293441485dd77488617ee0cc19772ca9e..f552e93c2b15a1abaaa977311c53f062be1ad342 100644 --- a/src/zaxis.c +++ b/src/zaxis.c @@ -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]);