-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdorade.h
324 lines (299 loc) · 15.5 KB
/
dorade.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
/*
NASA/TRMM, Code 910.1.
This is the TRMM Office Radar Software Library.
Copyright (C) 1996-1999
John H. Merritt
Space Applications Corporation
Vienna, Virginia
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _dorade_
#define _dorade_
#include <stdio.h>
typedef struct {
char code[4];
int len;
char *comment; /* 0..len-1 of comments (N bytes ASCII, N%4==0 */
} Comment_block;
typedef struct {
char code[4]; /* Code identifier for the volume descriptor. (4 ASCII "VOLD") */
int len; /* Length of the volume descriptor. (4 byte int) */
short version; /* Version number of the format. (2 byte int) */
short volume_number; /* Volume number from the begining of the data set. (2 byte int) */
int max_bytes; /* Maximum number of bytes in a data record. (4 byte int) */
char project_name[20]; /* Project name. (20 ASCII) */
short year; /* Year YYYY e.g. 1999 (2 byte int) */
short month; /* Month 1-12 (2 byte int) */
short day; /* Day 1-31 (2 byte int) */
short hour; /* Hour 1-23 (2 byte int) */
short minute; /* Minute 0-59 (2 byte int) */
short second; /* Second 0-59 (2 byte int) */
char flight_num[8]; /* Flight number (8 ASCII) for airborne raar or IOP number
for ground based radars. */
char facility_name[8]; /* Generation facility. (8 ASCII) */
short gen_year; /* Generation year YYYY. (2 byte int) */
short gen_month; /* Generation month 1-12. (2 byte int) */
short gen_day; /* Generation day 1-31. (2 byte int) */
short nsensors; /* Number of sennsor descriptors to follow. (2 byte int) */
} Volume_desc;
typedef struct {
char code[4]; /* Code identifier for the radar descriptor. (4 ASCII "RADD") */
int len; /* Length of the radar descriptor. (4 byte int) */
char radar_name[8]; /* Radar name. (8 ASCII) */
float radar_constant;/* Radar constant. */
float peak_power; /* Nominal Peak power. [kw] */
float noise_power; /* Nominal Noise power. [dBm] */
float rcvr_gain; /* Receiver gain. [dB] */
float ant_gain; /* Antenna gain. [dB] */
float radar_system_gain; /* [dB] */
float horizontal_beam_width; /* [deg] */
float vertical_beam_width; /* [deg] */
short radar_type; /* 0--Ground
1--Airborne fore
2--Airborne aft
3--Airborne tail
4--Airborne lower fuselage
5--Shipborne
*/
short scan_mode; /* 0--Calibration
1--PPI (Constant elevation)
2--Coplane
3--RHI (Constant azimuth)
4--Vertical pointing
5--Target (Stationary, not vertical pointing)
6--Manual
7--Idle (out of control)
8--Surveillance
9--Vertical sweep (rotation axis parallels the fuselage)
*/
float scan_rate; /* Nominal scan rate. [deg/sec] */
float start_angle; /* Nominal start angle. [deg] */
float stop_angle; /* Nominal stop angle. [deg] */
short nparam_desc; /* Total number of parameter descriptors for this radar. (2 byte int) */
short ndesc; /* Total number of descriptors for this radar. (2 byte int) */
short compress_code; /* Data compression format code. (2 byte int):
0--no compression
1--data compression (compression algorithm described
in the ASCII file athe the begining of the file.
*/
short compress_algo; /* Data reduction algorithm:
0--No data reduction.
1--Data recorded between two rotation angles.
2--Data recorded between two concentic angles.
3--Data recorded between two altitudes.
4-N--Other types of data reduction.
*/
float data_reduction_param1; /* Data reduction specific parameter #1
1--Smallest positive angle [deg].
2--Inner circle diameter [km].
3--Minimum altitude [km].
4-N--Will be defined if other types created.
*/
float data_reduction_param2; /* Data reduction specific parameter #2
1--Largest positive angle [deg].
2--Outer circle diameter [km].
3--Maximum altitude [km].
4-N--Will be defined if other types created.
*/
float longitude; /* Radar longitude [deg]. If airborne, airport longitude. */
float latitude; /* Radar latitude [deg]. If airborne, airport latitude. */
float altitude; /* Radar altitude of mean sea level (msl) [km].
If airborne, airport altitude. */
float unambiguous_velocity; /* Effective unambiguous velocity [m/s]. */
float unambiguous_range; /* Effective unambiguous range [km]. */
short nfreq; /* Number of freqencies transmitted (2 byte int). */
short npulse_periods; /* Number of different inter-pulse periods (IPP's) transmitted.
(2 byte int). */
float freq[5]; /* Frequency 1..5 [GHz] (float) */
float period[5]; /* Interpulse Period (IPP) 1..5 [ms] (float) */
} Radar_desc;
typedef struct {
char code[4]; /* Code identifier. (4 ASCII "PARM") */
int len; /* Length of this descriptor. */
char name[8]; /* Name of the parameter. */
char description[40]; /* Description of the parameter. */
char units[8]; /* Units (8 ASCII) */
short ipp; /* Inter-pulse periods.
Bit 0 set to 1 indicates IPP#1 is used in this parameter.
Similiarly for bits 1,2,3 and 4 and IPP's 2,3,4 and 5.
*/
short xmit_freq; /* Transmittd frequencies.
Bit 0 set to 1 indicates Frequency#1 is used in this parameter.
Similiarly for bits 1,2,3 and 4 and Frequencies 2,3,4 and 5.
*/
float rcvr_bandwidth;/* [MHz] */
short pulse_width; /* [m] */
short polarization; /* 0--Horizontal
1--Vertical
2--Circular, Right handed
3--Elliptical
4--Circular, Left handed
5--Dual polarization
*/
short nsamp_in_dwell_time; /* Number of samples in dwell time. */
short parameter_type; /* 1--8 bit integer
2--16 bit integer
3--32 bit integer
4--floating point (32 bit IEEE)
*/
char threshold_field[8];
float threshold_value; /* Units depend on the threshold field. */
float scale_factor; /* Scale factor. */
float offset_factor; /* meteorological val = (recorded val - offset factor) / scale factor */
int missing_data_flag; /* Deleted or missing data flag. 256for bytes, -999 for all others. */
} Parameter_desc;
typedef struct {
char code[4]; /* Code identifier. (4 ASCII "CELV") */
int len; /* Length of this descriptor. */
int ncells; /* Number of cells definced in this vector. */
float *range_cell; /* Range to cell n [m] (0..ncells-1) */
} Cell_range_vector;
typedef struct {
char code[4]; /* Code identifier. (4 ASCII "CFAC") */
int len; /* Length of this descriptor. */
float azimuth; /* Correction for azimuth [deg]. */
float elevation; /* Correction for elevation [deg]. */
float range; /* Correction for range delay [m]. */
float longitude; /* Correction for radar longitude [deg]. */
float latitude; /* Correction for radar latitude [deg]. */
float altitude; /* Correction for radar pressure altitude (msl) [km]. */
float height; /* Correction for radar altitude above ground (agl) [km]. */
float speed_east_west; /* Correction for radar platform ground speed E->W [m/s]. */
float speed_north_south; /* Correction for radar platform ground spedd N->S [m/s]. */
float vertical_velocity; /* Correction for radar platform vertical velocity [m/s]. */
float heading; /* Correction for radar platform heading [deg]. */
float roll; /* Correction for radar platform roll [deg]. */
float pitch; /* Correction for radar platform pitch [deg]. */
float drift; /* Correction for radar platform drift [deg]. */
float rotation_angle; /* Correction for radar rotation angle [deg]. */
float tilt_angle; /* Correction for radar tilt angle [deg]. */
} Correction_factor_desc;
typedef struct {
char code[4]; /* Code identifier. (4 ASCII "SWIB") */
int len; /* Length of this descriptor. */
char radar_name[8]; /* Radar name. */
int sweep_num; /* Sweep number from beginning of volume. */
int nrays; /* Number of rays recorded in this sweep. */
float start_angle; /* True start angle [deg]. */
float stop_angle; /* True stop angle [deg]. */
float fixed_angle; /* Fixed angle [deg]. */
int filter_flag; /* Filter flag:
0--No filtering in use.
1--ON (Algorithm described in ASCII file at beginning of the file.)
*/
} Sweep_info;
typedef struct {
char code[4]; /* Code identifier. (4 ASCII "RYIB") */
int len; /* Length of this descriptor. */
int sweep_num;
int jday; /* Julian day. (from beginning of year :-) */
short hour; /* Hour 0-23. */
short minute; /* Minute 0-59. */
short second; /* Second 0-59. */
short msec; /* Millisecond. */
float azimuth; /* [deg] */
float elevation; /* [deg] */
float peak_power;/* Peak transmitted power [kw] */
float scan_rate; /* [deg/sec]. */
int status; /* Ray status:
0--Normal
1--Transition (antenna repositioning)
2--Bad
3--Questionable
*/
} Ray_info;
typedef struct { /* Especially for moving radars. */
char code[4]; /* Code identifier. (4 ASCII "ASIB") */
int len; /* Length of this descriptor. */
float longitude; /* Radar longitude [deg]. */
float latitude; /* Radar latitude [deg]. */
float altitude; /* Radar pressure altitude (msl) [km]. */
float height; /* Radar above ground altitude (agl) [km]. */
float ew_speed; /* Platform ground speed (E (positive) or W) [m/s]. */
float ns_speed; /* Platform ground speed (N (positive) or S) [m/s]. */
float v_speed; /* Platform vertical velocity [m/s]. */
float heading; /* Platform heading [deg]. */
float roll; /* Platform roll [deg]. */
float pitch; /* Platform pitch [deg]. */
float drift; /* Platform drift [deg]. */
float rotation; /* Platform rotation angle [deg]. */
float tilt; /* Platform tilt [deg]. */
float ew_wind_speed; /* Horizontal wind speed at radar (toward East positive) [m/s]. */
float ns_wind_speed; /* Horizontal wind speed at radar (toward North positive) [m/s]. */
float v_wind_speed; /* Vertical wind speed at radar (up is positive) [m/s]. */
float heading_rate; /* Heading change rate [deg/sec]. */
float pitch_rate; /* Pitch change rate [deg/sec]. */
} Platform_info;
typedef struct {
char code[4]; /* Code identifier. (4 ASCII "RDAT") */
int len; /* Length of this descriptor. */
char name[8]; /* Name of parameter. (See name in 'parameter descriptor'). */
char *data; /* Length as described in Parameter_desc. */
} Parameter_data;
/* Higher level objects */
typedef struct {
Radar_desc *radar_desc;
int nparam;
Parameter_desc **p_desc; /* 0..nparam-1 */
Cell_range_vector *cell_range_vector;
Correction_factor_desc *correction_factor_desc;
} Sensor_desc;
typedef struct {
Ray_info *ray_info;
Platform_info *platform_info;
int nparam;
int *data_len; /* 0..nparam-1
* Length of *parameter_data[i] in bytes.
* This is length of data portion.
*/
int *word_size; /* 0..nparam-1
* Size of each word in *parameter_data[i].
*/
Parameter_data **parameter_data; /* 0..nparam-1 */
} Data_ray;
typedef struct {
Sweep_info *s_info;
int nrays;
Data_ray **data_ray; /* 0..nrays-1 */
} Sweep_record;
/* PROTOTYPES */
Comment_block *dorade_read_comment_block(FILE *in);
Volume_desc *dorade_read_volume_desc (FILE *in);
/* Sensor descriptor routines. */
Radar_desc *dorade_read_radar_desc (FILE *in);
Parameter_desc *dorade_read_parameter_desc (FILE *in);
Cell_range_vector *dorade_read_cell_range_vector (FILE *in);
Correction_factor_desc *dorade_read_correction_factor_desc(FILE *in);
Sensor_desc *dorade_read_sensor (FILE *in);
Sweep_info *dorade_read_sweep_info(FILE *in);
Sweep_record *dorade_read_sweep(FILE *fp, Sensor_desc **sd);
/* Data Ray routines. */
Ray_info *dorade_read_ray_info (FILE *in);
Platform_info *dorade_read_platform_info (FILE *in);
Parameter_data *dorade_read_parameter_data(FILE *in);
Data_ray *dorade_read_ray (FILE *in);
/* Memory management routines. */
void dorade_free_sweep(Sweep_record *s);
void dorade_free_data_ray(Data_ray *r);
/* Print routines. */
void dorade_print_sweep_info(Sweep_info *d);
void dorade_print_ray_info(Ray_info *d);
void dorade_print_platform_info(Platform_info *d);
void dorade_print_correction_factor_desc(Correction_factor_desc *d);
void dorade_print_cell_range_vector(Cell_range_vector *d);
void dorade_print_parameter_desc(Parameter_desc *d);
void dorade_print_radar_desc(Radar_desc *d);
void dorade_print_volume_desc(Volume_desc *d);
void dorade_print_comment_block(Comment_block *cb);
void dorade_print_sensor(Sensor_desc *s);
#endif