📄 grib.h
字号:
/*** FILE: grib.h ***/
/* Revisions:
10/16/97/atn: +usData_type to mercator, space view structs
11/04/97/atn: reduced DEF+MSG_LEN from 250k;
02/18/98/atn: + Projection codes; -ENC_DELIMITOR; -struct space_view;
04/22/98/atn: + extension flag;
*/
#define EXTENSION_FLAG 99 /* Implies extensions if equals PDS Oct41 */
#define DEF_MSG_LEN 50000 /* size of GRIB HDR 's entire_msg */
#define MAX_PROJ_SIZE 46 /* MaxSize of GDS minus 6 bytes*/
/* Currently set to LATLON; */
#define MAX_INP_PROJ_SIZE 72 /* Size of Max Input GDS block, */
/* currently set to GDS_LATLON_INPUT */
/* WMO projection codes
*** MUST keep parallel to 'prjn_name' array ***
*** IF altered, must also update the 'PRJ_COUNT' ***
*/
#define LATLON_PRJ 0
#define MERC_PRJ 1
#define LAMB_PRJ 3
#define GAUSS_PRJ 4
#define POLAR_PRJ 5
#define ALBERS_PRJ 8
#define ROT_LATLON_PRJ 10
#define OBLIQ_LAMB_PRJ 13
#define ROT_GAUSS_PRJ 14
#define STR_LATLON_PRJ 20
#define STR_GAUSS_PRJ 24
#define STR_ROT_LATLON_PRJ 30
#define STR_ROT_GAUSS_PRJ 34
#define PRJ_COUNT 35 /* num of elements in prjn_name[] */
/* WMO projection names (use WMO codes above to index) */
static char* prjn_name[] = {
"(0) Latitude/Longitude Grid",
"(1) Mercator Grid",
"(2) Unsupported Grid",
"(3) Lambert Grid",
"(4) Gaussian Grid",
"(5) Polar Grid",
"(6) Unsupported Grid",
"(7) Unsupported Grid",
"(8) Albers equal-area Grid",
"(9) Unsupported Grid",
"(10) Rotated Latitude/Longitude Grid",
"(11) Unsupported Grid",
"(12) Unsupported Grid",
"(13) Oblique Lambert Grid",
"(14) Rotated Gaussian Grid",
"(15) Unsupported Grid",
"(16) Unsupported Grid",
"(17) Unsupported Grid",
"(18) Unsupported Grid",
"(19) Unsupported Grid",
"(20) Stretched Latlon Grid",
"(21) Unsupported Grid",
"(22) Unsupported Grid",
"(23) Unsupported Grid",
"(24) Stretched Gaussian Grid",
"(25) Unsupported Grid",
"(26) Unsupported Grid",
"(27) Unsupported Grid",
"(28) Unsupported Grid",
"(29) Unsupported Grid",
"(30) Stretched Rotated Latlon Grid",
"(31) Unsupported Grid",
"(32) Unsupported Grid",
"(33) Unsupported Grid",
"(34) Stretched Rotated Gaussian Grid"
};
/*.................................................................*/
typedef struct GRIB_HDR { /* holds one Grib Msg & its info */
char shuffled; /* set if sections are out of order */
long msg_length; /* length in bytes of entire msg */
long ids_len; /* length in bytes of Ident Sect */
long pds_len; /* length in bytes of Prod Defn Sect */
long gds_len; /* length in bytes of Grid Defn Sect */
long bms_len; /* length in bytes of Bitmap Sect */
long bds_len; /* length in bytes of Bin Data Sect */
long eds_len; /* length in bytes of Ending Sect */
long abs_size; /* num bytes malloced to entire_msg*/
unsigned char *entire_msg; /* arr holding entire Grib msg */
unsigned char *ids_ptr; /* pts to 'GRIB' w/in entire msg */
unsigned char *pds_ptr; /* pts to PDS w/in entire msg */
unsigned char *gds_ptr; /* pts to GDS w/in entire msg */
unsigned char *bms_ptr; /* pts to BMS w/in entire msg */
unsigned char *bds_ptr; /* pts to BDS w/in entire msg */
unsigned char *eds_ptr; /* pts to '7777' w/in entire msg */
} GRIB_HDR;
typedef struct PDS_INPUT{ /* User input structure - PDS */
unsigned short uslength; /* PDS Length - depends on extensions */
unsigned short usEd_num; /* GRIB Edition number - #1 (IndS) */
unsigned short usParm_tbl; /* Parameter table number (1) */
unsigned short usCenter_id; /* Id of originating center (Table 0)*/
unsigned short usProc_id; /* Generating process Id number (Table A) */
unsigned short usGrid_id; /* Grid Identification (Table B) */
unsigned short usGds_bms_id; /* GDS and BMS flag (Table 1) */
unsigned short usParm_id; /* Parameter and unit id (Table 2) */
unsigned short usLevel_id; /* Type of level or layer id (Table 3/3a) */
unsigned short usLevel_octets; /* number of octets used in Table 3 (0, 1, 2 values) */
unsigned short usHeight1; /* Height1, pressure1,etc of level (Table 3)*/
unsigned short usHeight2; /* Height2, pressure2,etc of level (Table 3)*/
unsigned short usYear; /* Year of century -Initial or ref. */
unsigned short usMonth; /* Month of year -time of forecast */
unsigned short usDay; /* Day of month */
unsigned short usHour; /* Hour of day */
unsigned short usMinute; /* Minute of hour */
unsigned short usFcst_unit_id; /* Forecast time unit (Table 4) */
unsigned short usP1; /* Period of time (Number of time units) */
unsigned short usP2; /* Time interval between forecasts */
unsigned short usTime_range; /* Time range indicator (Table 5) */
unsigned short usTime_range_avg; /* Number included in average if flag set */
unsigned short usTime_range_mis; /* Number missing from average */
unsigned short usCentury; /* Centry of Initial time (19) */
unsigned short usCenter_sub; /* Oct 26: Sub Center id */
short sDec_sc_fctr; /* Decimal scale factor */
unsigned short ausZero[12]; /* Reserved */
unsigned short usExt_flag; /* Oct 41: Grib extensions usage flag*/
unsigned short usSecond; /* Second of Minute */
unsigned short usTrack_num; /* Tracking ID for data set */
unsigned short usParm_sub; /* Sub-Table Entry for parameter and unit (Table 2) */
unsigned short usSub_tbl; /* Sub-Table version number */
}PDS_INPUT;
typedef struct GDS_LAM_INPUT { /* Input: Lambert Conformal Grid */
unsigned short usData_type; /* Data representation type ( Table 6) */
int iNx; /* Nx - # of points along x-axis */
int iNy; /* Ny - # of points along y-axis */
long lLat1; /* Latitude of first grid point */
long lLon1; /* Longitude of first grid point */
unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/
long lLon_orient; /* Orientaion of grid - longitude */
unsigned long ulDx; /* X-direction grid length */
unsigned long ulDy; /* Y-direction grid length */
unsigned short usProj_flag; /* Projection center flag */
unsigned short usScan_mode; /* Scan mode */
long lLat_cut1; /* First latitude which secant cone cuts */
long lLat_cut2; /* Second latitude from pole */
long lLat_southpole; /* Latitude of southern pole (millidegree)*/
long lLon_southpole; /* Longitude of southern pole */
int usZero; /* Reserved (set to 0) */
}GDS_LAM_INPUT;
typedef struct GDS_LATLON_INPUT{ /* Input: Latitude/Longitude Grid */
unsigned short usData_type; /* Data representation type ( Table 6) */
int usNi; /* Number of points along a parallel */
int usNj; /* Number of points along a meridian */
long lLat1; /* Latitude of first grid point */
long lLon1; /* Longitude of first grid point */
unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/
long lLat2; /* Latitude of last grid point */
long lLon2; /* Longitude of last grid point */
int iDi; /* I-direction increment */
int iDj; /* J-direction increment */
unsigned short usScan_mode; /* Scanning mode (Table 8) */
long usZero; /* Reserved (set to 0) */
long lLat_southpole; /* Latitude of southern pole (millidegree)*/
long lLon_southpole; /* Longitude of southern pole */
long lRotate; /* Angle of rotation */
long lPole_lat; /* Latitude of pole of stretching (millidegree) */
long lPole_lon; /* Longitude of pole of stretching */
long lStretch; /* Stretching factor */
}GDS_LATLON_INPUT;
typedef struct GDS_PS_INPUT { /* Input: Polar Stereographic Grid */
unsigned short usData_type; /* Data representation type ( Table 6) */
unsigned short usNx; /* Nx - # of points along x-axis */
unsigned short usNy; /* Ny - # of points along y-axis */
long lLat1; /* Latitude of first grid point */
long lLon1; /* Longitude of first grid point */
unsigned short usRes_flag; /* Resolution and component flag (Table 7) */
long lLon_orient; /* Orientaion of grid - longitude */
unsigned long ulDx; /* X-direction grid length */
unsigned long ulDy; /* Y-direction grid length */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -