5 /* Modify the following to point to the file that contains the
6 * nexrad (wsr88d) location information for each radar site.
7 * The directory should be the same as the LIBDIR in the makefile.
9 #ifndef WSR88D_SITE_INFO_FILE
10 #define WSR88D_SITE_INFO_FILE DATADIR "/wsr88d_locations.dat"
12 /*===============================================================*/
14 char archive2[8]; /* Always ARCHIVE2 */
15 char site_id[4]; /* 4-leter site ID. e.g. KLMB */
16 char tape_num[6]; /* NCDC tape number. e.g. N00001 */
18 char date[9]; /* Date tape written. dd-MMM-yy e.g. 19-FEB-93 */
20 char time[8]; /* Time tape written. hh:mm:ss. e.g. 10:22:59 */
22 char data_center[5]; /* Data Center writing tape: RDASC or NCDC. */
23 char wban_num[5]; /* WBAN number of this NEXRAD site. This is a
24 unique 5-digit number assigned at
25 NCDC. Numbers are contained in the NCDC
26 NEXRAD Station History file. The file
27 also contains the four letter site ID,
28 Latitude, Longitude, Elevation, and
29 common location name. */
30 char tape_mode[5]; /* Tape output mode. Current values are 8200, 8500,
32 char volume_num[5]; /* A volume number to be used for copies and
33 extractions of data from tapes. The form
34 would be VOL01, VOL02, VOL03 ... VOLnn. */
35 char b4[6]; /* Blank. Available for future use. */
36 char b5[31552]; /* May be used for internal controls or
37 other information at each archive center.
38 Information of value to users will be
39 documented at the time of tape shipment. */
43 /* Title record structure for nexrad archive2 data file.
44 The first record of each nexrad data file is a title record */
49 int file_date; /* modified Julian date */
50 int file_time; /* milliseconds of day since midnight */
55 /* message packet structure for nexrad radar data */
58 short ctm[6]; /* not used */
60 /* halfword 7 : message header information */
61 short msg_size; /* # halfwords from here to end of record? */
62 short msg_type; /* Digital Radar Data. This message may contain
63 * a combination of either reflectivity,
64 * aliased velocity, or spectrum width.
66 short id_seq; /* I.d. Seq = 0 to 7FFF, then roll over to 0 */
67 short msg_date; /* modified Julian date from 1/1/70 */
68 int msg_time; /* packet generation time in ms past midnite */
72 /* halfword 15 : data header information */
73 int ray_time; /* collection time for this ray in ms */
74 short ray_date; /* modified Julian date for this ray */
75 short unam_rng; /* unambiguous range */
76 short azm; /* coded azimuth angle */
77 short ray_num; /* ray no. within elevation scan */
78 short ray_status;/* ray status flag */
79 short elev; /* coded elevation angle */
80 short elev_num; /* elevation no. within volume scan */
82 /* halfword 24 : gate/bin information*/
83 short refl_rng; /* range to first gate of refl data */
84 short dop_rng; /* range to first gate of doppler data */
85 short refl_size; /* refl data gate size */
86 short dop_size; /* doppler data gate size */
87 short num_refl; /* no. of reflectivity gates */
88 short num_dop; /* no. of doppler gates */
91 short sec_num; /* sector no. within cut */
92 float sys_cal; /* gain calibration constant */
94 /* halfword 33 : data parameters */
95 short refl_ptr; /* reflectivity data ptr */
96 short vel_ptr; /* velocity data ptr */
97 short spc_ptr; /* spectrum width ptr */
98 short vel_res; /* Doppler velocity resolution */
99 short vol_cpat; /* volume coverage pattern */
102 /* halfword 42 : data pointers for Archive II playback */
108 short nyq_vel; /* Nyquist velocity */
109 short atm_att; /* atmospheric attenuation factor */
112 /* halfwords 48 to 64 */
115 /* halfwords 65 to 1214 */
116 unsigned char data[2300];
118 /* last 4 bytes : frame check sequence */
119 unsigned char fts[4];
123 /* structure for the radar site parameters */
124 typedef struct radar_site {
125 int number; /* arbitrary number of this radar site */
126 char name[4]; /* Nexrad site name */
127 char city[15]; /* nearest city to radaar site */
128 char state[2]; /* state of radar site */
129 int latd; /* degrees of latitude of site */
130 int latm; /* minutes of latitude of site */
131 int lats; /* seconds of latitude of site */
132 int lond; /* degrees of longitude of site */
133 int lonm; /* minutes of longitude of site */
134 int lons; /* seconds of longitude of site */
135 int height; /* height of site in meters above sea level*/
136 int bwidth; /* bandwidth of site (mhz) */
137 int spulse; /* length of short pulse (ns)*/
138 int lpulse; /* length of long pulse (ns) */
145 #define PACKET_SIZE 2432
146 typedef Wsr88d_packet Wsr88d_ray; /* Same thing, different name. */
149 #define MAX_RAYS_IN_SWEEP 400
151 Wsr88d_ray *ray[MAX_RAYS_IN_SWEEP]; /* Expected maximum is around 366. */
155 nr_archive2_title title;
157 } Wsr88d_file_header;
160 int dummy; /* Structure not used yet. */
164 int dummy; /* Structure not used yet. */
167 /* Selected so we can boolean or use them for a data mask. */
168 #define WSR88D_DZ 0x1
169 #define WSR88D_VR 0x2
170 #define WSR88D_SW 0x4
171 #define WSR88D_BADVAL 0500 /* non-meaningful value (500 octal) */
172 #define WSR88D_RFVAL (WSR88D_BADVAL-1) /* ival = 0 means below SNR,
173 = 1 means range folded. */
176 /***********************************************************************/
178 /* Function specification. */
180 /***********************************************************************/
181 Wsr88d_file *wsr88d_open(char *filename);
182 int wsr88d_perror(char *message);
183 int wsr88d_close(Wsr88d_file *wf);
184 int wsr88d_read_file_header(Wsr88d_file *wf,
185 Wsr88d_file_header *wsr88d_file_header);
186 int wsr88d_read_tape_header(char *first_file,
187 Wsr88d_tape_header *wsr88d_tape_header);
188 int wsr88d_read_sweep(Wsr88d_file *wf, Wsr88d_sweep *wsr88d_sweep);
189 int wsr88d_read_ray(Wsr88d_file *wf, Wsr88d_ray *wsr88d_ray);
190 int wsr88d_read_ray_header(Wsr88d_file *wf,
191 Wsr88d_ray_header *wsr88d_ray_header);
192 int wsr88d_ray_to_float(Wsr88d_ray *ray,
193 int THE_DATA_WANTED, float v[], int *n);
194 float wsr88d_get_nyquist(Wsr88d_ray *ray);
195 float wsr88d_get_atmos_atten_factor(Wsr88d_ray *ray);
196 float wsr88d_get_velocity_resolution(Wsr88d_ray *ray);
197 int wsr88d_get_volume_coverage(Wsr88d_ray *ray);
198 float wsr88d_get_elevation_angle(Wsr88d_ray *ray);
199 float wsr88d_get_azimuth(Wsr88d_ray *ray);
200 float wsr88d_get_range(Wsr88d_ray *ray);
201 void wsr88d_get_date(Wsr88d_ray *ray, int *mm, int *dd, int *yy);
202 void wsr88d_get_time(Wsr88d_ray *ray, int *hh, int *mm, int *ss, float *fsec);
203 Wsr88d_site_info *wsr88d_get_site(char *in_sitenm); /* Courtesy of Dan Austin. */
204 int *wsr88d_get_vcp_info(int vcp_num,int el_num); /* Courtesy of Dan Austin. */
205 float wsr88d_get_fix_angle(Wsr88d_ray *ray);
206 int wsr88d_get_pulse_count(Wsr88d_ray *ray);
207 float wsr88d_get_azimuth_rate(Wsr88d_ray *ray);
208 float wsr88d_get_pulse_width(Wsr88d_ray *ray);
209 float wsr88d_get_prf(Wsr88d_ray *ray);
210 float wsr88d_get_prt(Wsr88d_ray *ray);
211 float wsr88d_get_wavelength(Wsr88d_ray *ray);
212 float wsr88d_get_frequency(Wsr88d_ray *ray);
214 int no_command (char *cmd);
215 FILE *uncompress_pipe (FILE *fp);
216 FILE *compress_pipe (FILE *fp);
217 int rsl_pclose(FILE *fp);