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

GRIB1 decode: Correct ZeroShiftError of simple packed spherical harmonics

parent 5ff83b63
2010-07-05 Edi Kirk <E.Kirk@gmx.de>
* GRIB1 decode: Correct ZeroShiftError of simple packed spherical harmonics
2010-07-01 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdfInqContents: use complex packing for spectral data [report: Edi Kirk]
......
......@@ -166,6 +166,7 @@
void gribFixZSE(int flag);
void gribSetDebug(int debug);
void gribSetRound(int round);
void gribSetRefDP(double refval);
......
/* Automatically generated by m214003 at 2010-06-30, do not edit */
/* Automatically generated by m214003 at 2010-07-05, do not edit */
/* CGRIBEXLIB_VERSION="1.4.5.1" */
......@@ -1266,6 +1266,7 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
}
int GRB_Debug = 0; /* If set to 1, debugging */
int GRB_Fix_ZSE = 0; /* Fix ZeroShiftError of simple packed spherical harmonics */
void gribSetDebug(int debug)
{
......@@ -1277,6 +1278,16 @@ void gribSetDebug(int debug)
Message(func, "debug level %d", debug);
}
void gribFixZSE(int flag)
{
static char func[] = "gribFixZSE";
GRB_Fix_ZSE = flag;
if ( GRB_Debug )
Message(func, "Fix ZeroShiftError set to %d", flag);
}
void gribSetRound(int round)
{
}
......@@ -4526,6 +4537,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
double fmin = 0., zscale = 0.;
double *fpdata = fsec4;
int bdsLen;
extern int GRB_Fix_ZSE;
*iret = 0;
igrib = bds;
......@@ -4748,6 +4760,16 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
scaleComplex(fsec4, pcStart, pcScale, ISEC2_PentaJ, 1);
}
if ( GRB_Fix_ZSE ) /* Fix ZeroShiftError of simple packed spherical harmonics */
if ( lspherc && !lcomplex )
{
/* 20100705: Fix ZeroShiftError - Edi Kirk */
if ( fsec4[1] != 0.0 )
{
double zserr = fsec4[1];
for ( i = 1; i < ISEC4_NumValues; i++ ) fsec4[i] -= zserr;
}
}
if ( decscale )
{
......@@ -8854,7 +8876,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen);
}
static const char grb_libvers[] = "1.4.5.1" " of ""Jun 30 2010"" ""10:28:56";
static const char grb_libvers[] = "1.4.5.1" " of ""Jul 5 2010"" ""09:21:38";
const char *
cgribexLibraryVersion(void)
{
......
......@@ -14,6 +14,9 @@
#include "cdi.h"
#include "stream_int.h"
#if defined (HAVE_LIBCGRIBEX)
#include "cgribex.h"
#endif
int cdiDefaultCalendar = CALENDAR_PROLEPTIC;
......@@ -110,6 +113,10 @@ void cdiInitialize(void)
{
Init_CDI = TRUE;
#if defined (HAVE_LIBCGRIBEX)
gribFixZSE(1); /* Fix ZeroShiftError of simple packed spherical harmonics */
#endif
value = cdiGetenvInt("CD_REGULARGRID");
if ( value >= 0 ) cdiDataUnreduced = (int) value;
......
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