updated top-level README and version_decl for V4.4.2 (#1795)
[WRF.git] / external / io_grib1 / grib1_util / read_grib.h
blobf2c628b64b7b0bbc53c078ba7b5828a8dc70d267
1 #define STRINGSIZE 160
3 /* The value used to fill missing data points */
4 #define FILL_VALUE -9999999.
6 typedef struct {
7 int usGrid_id;
8 int usParm_id;
9 int usLevel_id;
10 int usHeight1;
11 int usHeight2;
12 int offset;
13 int end;
14 char filename[200];
15 FILE *fp;
16 char initdate[15];
17 char valid_time[15];
18 int date;
19 int century;
20 int fcsttime1;
21 int fcsttime2;
22 int center_id;
23 int parmtbl;
24 int proc_id;
25 int subcenter_id;
26 PDS_INPUT *pds;
27 grid_desc_sec *gds;
28 BMS_INPUT *bms;
29 BDS_HEAD_INPUT *bds_head;
30 } Elements;
32 typedef struct {
33 int num_elements;
34 Elements *elements;
35 } GribInfo;
37 typedef struct {
38 char initdate[100];
39 char validdate[100];
40 int parmid;
41 int leveltype;
42 int level1;
43 int level2;
44 int fcsttime1;
45 int fcsttime2;
46 int center_id;
47 int subcenter_id;
48 int parmtbl_version;
49 } FindGrib;
51 typedef struct {
52 int center;
53 int subcenter;
54 int table;
55 int parmid;
56 char name[STRINGSIZE];
57 char comment[STRINGSIZE];
58 } GribTableEntry;
60 typedef struct {
61 int num_entries;
62 GribTableEntry *parms;
63 } GribParameters;
65 typedef struct {
66 float column;
67 float row;
68 float value;
69 char id[20];
70 } PointData;
72 typedef struct {
73 char prjnmm[24], stordsc[24];
74 int colcnt, rowcnt;
75 float origlat, origlon, origx, origy;
76 float xintdis, yintdis, parm1, parm2, parm3;
77 } GRIB_PROJECTION_INFO_DEF;
79 /* Public function definitions */
81 int rg_setup_gribmap(GribParameters *gribmap, char file[]);
82 int rg_gribmap_parameter(GribParameters *gribmap, char name[], int table,
83 GribTableEntry *gribmap_parms);
84 void rg_free_gribmap_elements(GribParameters *gribmap);
86 int rg_setup_gribinfo(GribInfo *gribinfo, char files[][STRINGSIZE],
87 int use_fcst);
88 int rg_setup_gribinfo_f(GribInfo *gribinfo, FILE *fp, int use_fcst);
89 int rg_setup_gribinfo_i(GribInfo *gribinfo, int fid, int use_fcst);
91 int rg_get_index(GribInfo *gribinfo, FindGrib *find_grib);
93 int rg_get_index_guess(GribInfo *gribinfo, FindGrib *findgrib, int guess_index);
95 int rg_get_indices(GribInfo *gribinfo, FindGrib *find_grib, int *indices);
97 int rg_init_findgrib(FindGrib *findgrib);
99 int rg_get_grib_header(GribInfo *gribinfo, int index, PDS_INPUT *pds,
100 grid_desc_sec *gds,BMS_INPUT *bms);
102 int rg_num_elements(GribInfo *gribinfo);
104 void rg_free_gribinfo_elements(GribInfo *gribinfo);
106 int rg_get_numrows(GribInfo *gribinfo,int index);
108 int rg_get_numcols(GribInfo *gribinfo,int index);
110 int rg_get_level1(GribInfo *gribinfo, int index);
112 int rg_get_level2(GribInfo *gribinfo, int index);
114 int rg_get_center_id(GribInfo *gribinfo, int index);
116 int rg_get_subcenter_id(GribInfo *gribinfo, int index);
118 int rg_get_proc_id(GribInfo *gribinfo, int index);
120 int rg_get_tblversion(GribInfo *gribinfo, int index);
122 float rg_get_point(GribInfo *gribinfo, int index, float column, float row);
124 int rg_get_points(GribInfo *gribinfo, int index, PointData *pointdata,
125 int numpoints);
127 int rg_get_offset(GribInfo *gribinfo, int index);
129 int rg_get_end(GribInfo *gribinfo, int index);
131 int rg_get_valid_time(GribInfo *gribinfo, int index, char valid_time[]);
133 int rg_get_data(GribInfo *gribinfo, int index, float **data);
135 int rg_get_data_1d(GribInfo *gribinfo, int index, float *data);
137 int rg_write_grib(PDS_INPUT *pds, grid_desc_sec *gds, char filename[],
138 float **data);
139 int rg_fwrite_grib(PDS_INPUT *pds, grid_desc_sec *gds, float **data,
140 FILE *fid);
144 /* The following are public functions also. However, the interface to many
145 * of them needs to be reworked. For example, it is not possible to specify
146 * a secondary height or forecast time with many of them.
147 * Note: As of 11/11/04, the functions listed above have already been reworked.
150 int rg_get_pressure_levels(GribInfo *gribinfo, int dates[], int centuries[],
151 int parm_id[], int finallevels[],int min_pres,
152 int numparms);
153 int rg_get_msl_indices(GribInfo *gribinfo, char dates[][STRINGSIZE],
154 int centuries[], int usParm_id[],int usLevel_id[],
155 int usHeight1[],int infactor[],int numparms,
156 int grib_index[],int outfactor[]);
157 int rg_get_grib(GribInfo *gribinfo, int index,int scale,
158 float **grib_out,int *vect_comp_flag,
159 GRIB_PROJECTION_INFO_DEF *Proj, BDS_HEAD_INPUT *bds_head);
160 int rg_get_dates(GribInfo *gribinfo,int usParm_id[],int usLevel_id[],
161 int usHeight1[],int numparms,int dates[],int century[],
162 int indices[]);
163 int rg_get_index_near_date(GribInfo *gribinfo,char targetdate[STRINGSIZE],
164 int century,int hours_before,int hours_after,
165 int usParm_id[],int usLevel_id[],int usHeight1[],
166 int numparms);
167 int rg_get_date(GribInfo *gribinfo,int index);
168 int rg_get_century(GribInfo *gribinfo,int index);
169 int rg_get_forecast_time(GribInfo *gribinfo,int index);