grib.h
来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· C头文件 代码 · 共 312 行 · 第 1/2 页
H
312 行
#ifdef MATLAB_MEX_FILE#include "mex.h"#endif#define FOPENERR 100#define FWRITERR 101#define MALLOCERR 102#define PACKGRIDERR 103#define FSCANFERR 104#define FCLOSERR 200#define BYTE_BIT_CNT 8#define WORD_BIT_CNT 32#ifndef DPRINT#define DPRINT if ( debug ) printf#endif#ifndef SEEK_SET#define SEEK_SET 0 /* Set file pointer to "offset" */#endiftypedef 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 usZero; /* Reserved */ short sDec_sc_fctr; /* Decimal scale factor */ unsigned short ausZero[12]; /* Reserved */ unsigned short usCenter_sub; /* Sub-Table Entry for originating center (Table 0) */ 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 */ unsigned long ulMess_Size; unsigned short ecClass; unsigned short ecType; unsigned short ecStream; char ecVersion[5]; unsigned short ecNumber; unsigned short ecEnsembleSize; unsigned short ecSystemNumber; unsigned short ecMethodNumber;}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 */ unsigned short usProj_flag; /* Projection center flag */ unsigned short usScan_mode; /* Scan mode */ unsigned short usZero; /* Reserved (set to 0) */} GDS_PS_INPUT;typedef struct mercator /* mercator grids */ { int cols; /* Ni - Number of points along a latitude circle */ int rows; /* Nj - Number of points along a longitude meridian */ long first_lat; /* La1 - Latitude of first grid point */ long first_lon; /* Lo1 - Longitude of first grid point */ unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/ long La2; /* latitude of last grid point, or # point / row */ long Lo2; /* longitude of last grid point, or # point / column */ long latin; /* Latin - the latitude at which the mercator projection intersects the earth */ unsigned short usZero1; /* Reserved (set to 0) */ unsigned short usScan_mode; /* Scanning mode (Table 8) */ float lon_inc; /* Di - the longitudinal direction increment (west to east) */ float lat_inc; /* Dj - the latitudinal direction increment (south to north) */ long usZero; /* Reserved (set to 0) */ }mercator;typedef struct space_view /* space view perspective or orthographic */ { int cols; /* Ni - Number of points along x-axis */ int rows; /* Nj - Number of points along y-axis */ long first_lat; /* La1 - Latitude of sub-satellite point */ long first_lon; /* Lo1 - Longitude of sub-satellite point */ unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/ long x_a_diam; /* dx - apparent diameter of earth in grid lengths, in x direction */ long y_a_diam; /* dy - apparent diameter of earth in grid lengths, in y direction */ int x_ssp; /* Xp - X-coordinate of sub satellite point */ int y_ssp; /* Yp - Y-coordinate of sub satellite point */ unsigned short usScan_mode; /* Scanning mode (Table 8) */ long orientation; /* orientation of the grid */ long altitude; /* altitude of the camera from the earth's center */ int iXo; /* X coordinate of origin of sector image */ int iYo; /* Y coordinate of origin of sector image */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?