source: trunk/WRF.COMMON/WRFV3/external/io_grib1/WGRIB/bds.h @ 2759

Last change on this file since 2759 was 2759, checked in by aslmd, 2 years ago

adding unmodified code from WRFV3.0.1.1, expurged from useless data +1M size

File size: 1.4 KB
Line 
1/*
2 * version 1.2.1 of grib headers  w. ebisuzaki
3 *         1.2.2 added access to spectral reference value l. kornblueh
4 */
5
6#ifndef INT2
7#define INT2(a,b)   ((1-(int) ((unsigned) (a & 0x80) >> 6)) * (int) (((a & 0x7f) << 8) + b))
8#endif
9
10#define BDS_LEN(bds)            ((int) ((bds[0]<<16)+(bds[1]<<8)+bds[2]))
11#define BDS_Flag(bds)           (bds[3])
12
13#define BDS_Grid(bds)           ((bds[3] & 128) == 0)
14#define BDS_Harmonic(bds)       (bds[3] & 128)
15
16#define BDS_Packing(bds)        ((bds[3] & 64) != 0)
17#define BDS_SimplePacking(bds)  ((bds[3] & 64) == 0)
18#define BDS_ComplexPacking(bds) ((bds[3] & 64) != 0)
19
20#define BDS_OriginalType(bds)   ((bds[3] & 32) != 0)
21#define BDS_OriginalFloat(bds)  ((bds[3] & 32) == 0)
22#define BDS_OriginalInt(bds)    ((bds[3] & 32) != 0)
23
24#define BDS_MoreFlags(bds)      ((bds[3] & 16) != 0)
25#define BDS_UnusedBits(bds)     ((int) (bds[3] & 15))
26
27#define BDS_BinScale(bds)       INT2(bds[4],bds[5])
28
29#define BDS_RefValue(bds)       (ibm2flt(bds+6))
30#define BDS_NumBits(bds)        ((int) bds[10])
31
32#define BDS_Harmonic_RefValue(bds) (ibm2flt(bds+11))
33
34#define BDS_DataStart(bds)      ((int) (11 + BDS_MoreFlags(bds)*3))
35
36/* breaks if BDS_NumBits(bds) == 0 */
37#define BDS_NValues(bds)        (((BDS_LEN(bds) - BDS_DataStart(bds))*8 - \
38                                BDS_UnusedBits(bds)) / BDS_NumBits(bds))
39
40/*
41#define BDS_NValues(bds)        ((BDS_NumBits(bds) == 0) ? 0 : \
42                                (((BDS_LEN(bds) - BDS_DataStart(bds))*8 - \
43                                BDS_UnusedBits(bds)) / BDS_NumBits(bds)))
44*/
45
46
47/* undefined value -- if bitmap */
48#define UNDEFINED               9.999e20
49
Note: See TracBrowser for help on using the repository browser.