3 This is the TRMM Office Radar Software Library.
4 Copyright (C) 1996 John H. Merritt
5 Space Applications Corporation
6 Vienna, Virginia, a NASA/GSFC on-site contractor.
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the Free
20 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /* Are we building the library? */
30 #define RSL_VERSION_STR "v1.40"
32 /**********************************************************************/
33 /* Configure: Define USE_TWO_BYTE_PRECISION to have RSL store internal*/
34 /* values with two bytes. Otherwise, use one byte. */
35 /* It is a good idea to use two byte precision. */
36 /* See 'makefile' for an additional explaination. */
38 /**********************************************************************/
39 #define USE_TWO_BYTE_PRECISION
42 /**********************************************************************/
43 /* Configure: Define the file name of the red,green, and blue color */
44 /* color tables. This maps reflectance to color. */
45 /* This should be $(LIBDIR)/colors, from the makefile */
46 /* so you shouldn't have to modify anything here. */
47 /**********************************************************************/
49 #define COLORDIR "/usr/local/trmm/GVBOX/lib/colors"
52 /* These are the color table indexes. See RSL_set/get_color_table. */
53 #define RSL_RED_TABLE 0
54 #define RSL_GREEN_TABLE 1
55 #define RSL_BLUE_TABLE 2
57 /* The default color tables for reflectivity, velocity, spectral width,
58 * height, rainfall, and zdr.
60 #define REFL_RED_FILE COLORDIR "/red_reflectivity.clr"
61 #define REFL_GREEN_FILE COLORDIR "/grn_reflectivity.clr"
62 #define REFL_BLUE_FILE COLORDIR "/blu_reflectivity.clr"
63 #define VEL_RED_FILE COLORDIR "/red_velocity.clr"
64 #define VEL_GREEN_FILE COLORDIR "/grn_velocity.clr"
65 #define VEL_BLUE_FILE COLORDIR "/blu_velocity.clr"
66 #define SW_RED_FILE COLORDIR "/red_spectral_width.clr"
67 #define SW_GREEN_FILE COLORDIR "/grn_spectral_width.clr"
68 #define SW_BLUE_FILE COLORDIR "/blu_spectral_width.clr"
69 #define HEIGHT_RED_FILE COLORDIR "/red_height.clr"
70 #define HEIGHT_GREEN_FILE COLORDIR "/grn_height.clr"
71 #define HEIGHT_BLUE_FILE COLORDIR "/blu_height.clr"
72 #define RAINFALL_RED_FILE COLORDIR "/red_rainfall.clr"
73 #define RAINFALL_GREEN_FILE COLORDIR "/grn_rainfall.clr"
74 #define RAINFALL_BLUE_FILE COLORDIR "/blu_rainfall.clr"
76 /* Added by D. Wolff 07/31/97 */
77 #define ZDR_RED_FILE COLORDIR "/red_zdr.clr"
78 #define ZDR_GREEN_FILE COLORDIR "/grn_zdr.clr"
79 #define ZDR_BLUE_FILE COLORDIR "/blu_zdr.clr"
81 /*************************************************************************/
82 /* You should not have to change anything below this line.
83 * The rest is my fault.
85 /*************************************************************************/
89 * Magic numbers. These are used to uniquely identify the type of
90 * values present in a particular structure: Volume, Sweep, Ray.
91 * The magic numbers V_DZ, V_VR, V_SW, etc. represent Volume magic
92 * numbers for the field types DZ, VR, SW, etc. Similiar magic numbers
93 * are implimented for Sweep, and Ray. The magic number is the first word
94 * of the data structure. These magic number may determine which conversion
95 * function is used, see volume.c and the end of this file for the
96 * conversion functions. (As of v0.39 -- NOT YET IMPLEMENTED.)
99 V_DZ, V_VR, V_SW, V_CZ, V_ZT, V_DR, V_LR,
100 S_DZ, S_VR, S_SW, S_CZ, S_ZT, S_DR, S_LR,
101 R_DZ, R_VR, R_SW, R_CZ, R_ZT, R_DR, R_LR
104 /* File format types recognized by RSL. */
105 enum File_type {UNKNOWN, WSR88D_FILE, UF_FILE, LASSEN_FILE,
106 TOGA_FILE, NSIG_FILE_V1, NSIG_FILE_V2,
107 RSL_FILE, MCGILL_FILE, HDF_FILE, RAPIC_FILE,
108 RADTEC_FILE, EDGE_FILE, DORADE_FILE, RAINBOW_FILE};
110 /* Pick a BADVAL that is out of range. That is, the range
111 * of the conversion cannot include these reserved values.
112 * Typically, pick a number that cannot be stored in the Range data type.
114 #ifdef USE_TWO_BYTE_PRECISION
115 typedef unsigned short Range;
116 #define BADVAL (float)0x20000
118 typedef unsigned char Range;
119 #define BADVAL (float)0500 /* non-meaningful value (500 octal) */
122 #define RFVAL (BADVAL-1) /* Range folded value. See rfival. */
123 #define APFLAG (BADVAL-2)
124 #define NOTFOUND_H (BADVAL-3)
125 #define NOTFOUND_V (BADVAL-4)
126 #define NOECHO (BADVAL-5) /* For nsig and UF -32, for kwaj -30 */
127 #define RSL_SPEED_OF_LIGHT 299792458.0 /* m/s */
130 int month; /* Time for this ray; month (1-12). */
131 int day; /* Time for this ray; day (1-31). */
132 int year; /* Time for this ray; year (eg. 1993). */
133 int hour; /* Date for this ray; hour (0-23). */
134 int minute;/* Date for this ray; minute (0-59).*/
135 float sec; /* Date for this ray; second + fraction of second. */
136 float unam_rng; /* Unambiguous range. (KM). */
137 float azimuth; /* Azimuth angle. (degrees). Must be positive
138 * 0=North, 90=east, -90/270=west.
139 * This angle is the mean azimuth for the whole ray.
140 * Eg. for NSIG the beginning and end azimuths are
143 int ray_num; /* Ray no. within elevation scan. */
144 float elev; /* Elevation angle. (degrees). */
145 int elev_num; /* Elevation no. within volume scan. */
147 int range_bin1; /* Range to first gate.(meters) */
148 int gate_size; /* Data gate size (meters)*/
150 float vel_res; /* Doppler velocity resolution */
151 float sweep_rate; /* Sweep rate. Full sweeps/min. */
153 int prf; /* Pulse repetition frequency, in Hz. */
154 float azim_rate; /* Sweep rate in degrees/sec. */
155 float fix_angle; /* Elevation angle for the sweep. (degrees). */
156 float pitch; /* Pitch angle. */
157 float roll; /* Roll angle. */
158 float heading; /* Heading. */
159 float pitch_rate; /* (angle/sec) */
160 float roll_rate; /* (angle/sec) */
161 float heading_rate; /* (angle/sec) */
162 float lat; /* Latitude (degrees) */
163 float lon; /* Longitude (degrees) */
164 int alt; /* Altitude (m) */
165 float rvc; /* Radial velocity correction (m/sec) */
166 float vel_east; /* Platform velocity to the east (m/sec) */
167 float vel_north; /* Platform velocity to the north (m/sec) */
168 float vel_up; /* Platform velocity toward up (m/sec) */
169 int pulse_count; /* Pulses used in a single dwell time. */
170 float pulse_width; /* Pulse width (micro-sec). */
171 float beam_width; /* Beamwidth in degrees. */
172 float frequency; /* Carrier freq. GHz. */
173 float wavelength; /* Wavelength. Meters. */
174 float nyq_vel; /* Nyquist velocity. m/s */
175 float (*f)(Range x); /* Data conversion function. f(x). */
176 Range (*invf)(float x); /* Data conversion function. invf(x). */
177 int nbins; /* Number of array elements for 'Range'. */
183 Range *range; /* range[0..nbins-1]
185 * 0..460 for reflectivity, 0..920 for velocity and
191 typedef struct _azimuth_hash {
193 struct _azimuth_hash *next, *ray_high, *ray_low;
197 Azimuth_hash **indexes;
203 int sweep_num; /* Integer sweep number. This may be redundant, since
204 * this will be the same as the Volume.sweep array index.*/
205 float elev; /* Elevation angle (mean) for the sweep. */
206 float beam_width; /* This is in the ray header too. */
207 float vert_half_bw; /* Vertical beam width divided by 2 */
208 float horz_half_bw; /* Horizontal beam width divided by 2 */
211 float (*f)(Range x); /* Data conversion function. f(x). */
212 Range (*invf)(float x); /* Data conversion function. invf(x). */
217 Ray **ray; /* ray[0..nrays-1]. */
221 char *type_str; /* One of:'Reflectivity', 'Velocity' or 'Spectrum width' */
223 float calibr_const; /* Calibration constant. HDF specific. */
224 float (*f)(Range x); /* Data conversion function. f(x). */
225 Range (*invf)(float x); /* Data conversion function. invf(x). */
229 Volume_header h; /* Specific info for each elev. */
230 /* Includes resolution: km/bin. */
231 Sweep **sweep; /* sweep[0..nsweeps-1]. */
236 typedef Range Carpi_value;
237 typedef Range Cappi_value;
240 int month; /* (1-12). */
241 int day; /* (1-31). */
242 int year; /* (eg. 1993). */
243 int hour; /* (0-23). */
244 int minute; /* (0-59).*/
245 float sec; /* second + fraction of second. */
246 float dx, dy; /* Size of cell in km. */
247 int nx, ny; /* Number of cells. */
248 int radar_x, radar_y; /* Location of center of radar. */
249 float height; /* Height of this Carpi. */
250 float lat, lon; /* Lat/lon of lower left corner of Carpi. */
251 char radar_type[50]; /* Radar types. */
252 int field_type; /* Same as for Radar. */
253 int interp_method; /* ??? string describing interpolation method. */
254 float (*f)(Carpi_value x); /* Data conversion function. f(x). */
255 Carpi_value (*invf)(float x); /* Data conversion function. invf(x). */
256 Carpi_value **data; /* data[ny][nx] */
259 /** Cappi data structure info **/
260 /* Paul A. Kucera **/
262 /* Element in location array of Cappi data structure.
263 * Each element is elvation and range to data value.
267 float elev; /* elevation angle */
268 float srange; /* slant range !!! */
272 /* Cappi data structure.
275 int month; /* Begin time for this Cappi; month (1-12). */
276 int day; /* Begin time for this Cappi; day (1-31). */
277 int year; /* Begin time for this Cappi; year (eg. 1993). */
278 int hour; /* Begin date for this Cappi; hour (0-23). */
279 int minute; /* Begin date for this Cappi; minute (0-59).*/
280 float sec; /* Begin date for this Cappi; second + frac. of second.*/
281 float height; /* Height for this Cappi in m */
284 int field_type; /* Value of Constant ??_INDEX */
285 char radar_type[50]; /* Value of Constant radar->h.radar_type */
286 int interp_method; /* ??? string describing interpolation method. */
287 Er_loc *loc; /* elevation and range coordinate array */
288 Sweep *sweep; /* Pointers to rays of data */
291 /* The Cube data type. */
293 typedef Range Cube_value;
294 typedef Range Slice_value;
302 Carpi **carpi; /* Pointers to carpi[0] thru carpi[nz-1] */
310 float (*f)(Slice_value x); /* Data conversion function. f(x). */
311 Slice_value (*invf)(float x); /* Data conversion function. invf(x). */
312 Slice_value **data; /* data[ny][nx]. */
325 int month, day, year;
327 float sec; /* Second plus fractional part. */
328 char radar_type[50]; /* Type of radar. Use for QC-ing the data.
329 * Supported types are:
330 * "wsr88d", "lassen", "uf",
332 * "kwajalein", "rsl", "toga",
333 * "rapic", (rapic is Berrimah Austrailia)
334 * "radtec", (SPANDAR radar at Wallops Is, VA)
338 * Set by appropriate ingest routine.
342 int number; /* arbitrary number of this radar site */
343 char name[8]; /* Nexrad site name */
344 char radar_name[8]; /* Radar name. */
345 char project[24]; /* Project identifier. */
346 char city[15]; /* nearest city to radar site */
347 char state[3]; /* state of radar site */
349 int latd; /* degrees of latitude of site */
350 int latm; /* minutes of latitude of site */
351 int lats; /* seconds of latitude of site */
352 int lond; /* degrees of longitude of site */
353 int lonm; /* minutes of longitude of site */
354 int lons; /* seconds of longitude of site */
355 int height; /* height of site in meters above sea level*/
356 int spulse; /* length of short pulse (ns)*/
357 int lpulse; /* length of long pulse (ns) */
358 int vcp; /* Volume Coverage Pattern (for WSR-88D only) */
364 Volume **v; /* Array 0..nvolumes-1 of pointers to Volumes.
365 * 0 = DZ_INDEX = reflectivity.
366 * 1 = VR_INDEX = velocity.
367 * 2 = SW_INDEX = spectrum_width.
368 * 3 = CZ_INDEX = corrected reflectivity.
369 * 4 = ZT_INDEX = uncorrected reflectivity.
370 * 5 = DR_INDEX = differential refl.
371 * 6 = LR_INDEX = another differential refl.
372 * 7 = ZD_INDEX = another differential refl.
373 * 8 = DM_INDEX = received power.
374 * 9 = RH_INDEX = RhoHV: Horz-Vert power corr coeff
375 *10 = PH_INDEX = PhiDP: Differential phase angle
376 *11 = XZ_INDEX = X-band reflectivity.
377 *12 = CR_INDEX = Corrected DR.
378 *13 = MZ_INDEX = DZ mask for 1C-51 HDF.
379 *14 = MR_INDEX = DR mask for 1C-51 HDF.
380 *15 = ZE_INDEX = Edited reflectivity.
381 *16 = VE_INDEX = Edited velocity.
382 *17 = KD_INDEX = KDP: Specific differential phase, deg/km.
383 *18 = TI_INDEX = TIME (unknown) for MCTEX data.
389 *24 = SQ_INDEX = Signal Quality Index (Sigmet)
395 * DZ Reflectivity (dBZ), may contain some DZ_INDEX
396 * signal-processor level QC and/or
397 * filters. This field would contain
398 * Darwin's CZ, or WSR88D's standard
399 * reflectivity. In other words, unless
400 * the field is described otherwise, it
401 * should always go here. In essence, this
402 * is the "cleanest" reflectivity field
405 * VR Radial Velocity (m/s) VR_INDEX
407 * SW Spectral Width (m2/s2) SW_INDEX
409 * CZ QC Reflectivity (dBZ), contains
410 * post-processed QC'd data CZ_INDEX
412 * ZT Total Reflectivity (dBZ) ZT_INDEX
413 * Reflectivity unfiltered for clutter...
414 * This is UZ in UF files.
416 * DR Differential reflectivity DR_INDEX
417 * DR and LR are for dual-polarization
418 * radars only. Unitless or in dB.
420 * LR Another form of differential ref LR_INDEX
421 * called LDR, not sure of units
423 * ZD ZDR: Reflectivity Depolarization Ratio ZD_INDEX
424 * ZDR = 10log(ZH/ZV) (dB)
426 * DM Received power measured by the radar. DM_INDEX
429 * RH RhoHV: Horz-Vert power correlation RH_INDEX
430 * coefficient. (0 to 1) See volume.c
432 * PH PhiDP: Differential phase angle. PH_INDEX
433 * (0 to 180 deg in steps of 0.71)
436 * XZ X-band reflectivity XZ_INDEX
438 * CD Corrected ZD reflectivity (differential) CD_INDEX
439 * contains QC'ed data
441 * MZ DZ mask volume for HDF 1C-51 product. MZ_INDEX
443 * MD ZD mask volume for HDF 1C-51 product. MD_INDEX
445 * ZE Edited Reflectivity. ZE_INDEX
447 * VE Edited Velocity. VE_INDEX
449 * KD KDP (deg/km) Differencial Phase KD_INDEX
452 * TI TIME (unknown) for MCTEX data. TI_INDEX
453 * SQ SQI: Signal Quality Index. [Sigmet] SQ_INDEX
454 * Decimal fraction from 0 to 1, where 0
455 * is noise, 1 is noiseless.
459 * The number of *_INDEX must never exceed MAX_RADAR_VOLUMES.
460 * Increase MAX_RADAR_VOLUMES appropriately, for new ingest formats.
462 #define MAX_RADAR_VOLUMES 25
491 /* Prototypes for functions. */
492 /* Alphabetical and grouped by object returned. */
495 Radar *RSL_africa_to_radar(char *infile);
496 Radar *RSL_anyformat_to_radar(char *infile, ...);
497 Radar *RSL_dorade_to_radar(char *infile);
498 Radar *RSL_EDGE_to_radar(char *infile);
499 Radar *RSL_fix_radar_header(Radar *radar);
500 Radar *RSL_get_window_from_radar(Radar *r, float min_range, float max_range,float low_azim, float hi_azim);
501 Radar *RSL_hdf_to_radar(char *infile);
502 Radar *RSL_hdf_to_radar_unQC(char *infile);
503 Radar *RSL_kwaj_to_radar(char *infile);
504 Radar *RSL_lassen_to_radar(char *infile);
505 Radar *RSL_mcgill_to_radar(char *infile);
506 Radar *RSL_new_radar(int nvolumes);
507 Radar *RSL_nsig_to_radar(char *infile);
508 Radar *RSL_nsig2_to_radar(char *infile);
509 Radar *RSL_prune_radar(Radar *radar);
510 Radar *RSL_radtec_to_radar(char *infile);
511 Radar *RSL_rainbow_to_radar(char *infile);
512 Radar *RSL_rapic_to_radar(char *infile);
513 Radar *RSL_read_radar(char *infile);
514 Radar *RSL_sort_radar(Radar *r);
515 Radar *RSL_toga_to_radar(char *infile);
516 Radar *RSL_uf_to_radar(char *infile);
517 Radar *RSL_uf_to_radar_fp(FILE *fp);
518 Radar *RSL_wsr88d_to_radar(char *infile, char *call_or_first_tape_file);
520 Volume *RSL_clear_volume(Volume *v);
521 Volume *RSL_copy_volume(Volume *v);
522 Volume *RSL_fix_volume_header(Volume *v);
523 Volume *RSL_get_volume(Radar *r, int type_wanted);
524 Volume *RSL_get_window_from_volume(Volume *v, float min_range, float max_range, float low_azim, float hi_azim);
525 Volume *RSL_new_volume(int max_sweeps);
526 Volume *RSL_prune_volume(Volume *v);
527 Volume *RSL_read_volume(FILE *fp);
528 Volume *RSL_reverse_sweep_order(Volume *v);
529 Volume *RSL_sort_rays_in_volume(Volume *v);
530 Volume *RSL_sort_sweeps_in_volume(Volume *v);
531 Volume *RSL_sort_volume(Volume *v);
532 Volume *RSL_volume_z_to_r(Volume *z_volume, float k, float a);
534 Sweep *RSL_clear_sweep(Sweep *s);
535 Sweep *RSL_copy_sweep(Sweep *s);
536 Sweep *RSL_fix_sweep_header(Sweep *sweep);
537 Sweep *RSL_get_closest_sweep(Volume *v,float sweep_angle,float limit);
538 Sweep *RSL_get_eth_sweep(Volume *v,float et_point,float max_range);
539 Sweep *RSL_get_first_sweep_of_volume(Volume *v);
540 Sweep *RSL_get_sweep(Volume *v, float elev);
541 Sweep *RSL_get_window_from_sweep(Sweep *s, float min_range, float max_range, float low_azim, float hi_azim);
543 Sweep *RSL_new_sweep(int max_rays);
544 Sweep *RSL_prune_sweep(Sweep *s);
545 Sweep *RSL_read_sweep (FILE *fp);
546 Sweep *RSL_sort_rays_in_sweep(Sweep *s);
547 Sweep *RSL_sort_rays_by_time(Sweep *s);
548 Sweep *RSL_sweep_z_to_r(Sweep *z_sweep, float k, float a);
550 Ray *RSL_clear_ray(Ray *r);
551 Ray *RSL_copy_ray(Ray *r);
552 Ray *RSL_get_closest_ray_from_sweep(Sweep *s,float ray_angle,float limit);
553 Ray *RSL_get_first_ray_of_sweep(Sweep *s);
554 Ray *RSL_get_first_ray_of_volume(Volume *v);
555 Ray *RSL_get_closest_ray_from_sweep(Sweep *s,float ray_angle,float limit);
556 Ray *RSL_get_next_ccwise_ray(Sweep *s, Ray *ray);
557 Ray *RSL_get_next_cwise_ray(Sweep *s, Ray *ray);
558 Ray *RSL_get_ray(Volume *v, float elev, float azimuth);
559 Ray *RSL_get_ray_above(Volume *v, Ray *current_ray);
560 Ray *RSL_get_ray_below(Volume *v, Ray *current_ray);
561 Ray *RSL_get_ray_from_sweep(Sweep *s, float azim);
562 Ray *RSL_get_window_from_ray(Ray *r, float min_range, float max_range, float low_azim, float hi_azim);
563 Ray *RSL_new_ray(int max_bins);
564 Ray *RSL_prune_ray(Ray *ray);
565 Ray *RSL_ray_z_to_r(Ray *z_ray, float k, float a);
566 Ray *RSL_read_ray (FILE *fp);
569 float RSL_area_of_ray(Ray *r, float lo, float hi, float min_range, float max_range);
570 float RSL_fraction_of_ray(Ray *r, float lo, float hi, float range);
571 float RSL_fraction_of_sweep(Sweep *s, float lo, float hi, float range);
572 float RSL_fraction_of_volume(Volume *v, float lo, float hi, float range);
573 float RSL_fractional_area_of_sweep(Sweep *s, float lo, float hi, float min_rng, float max_rng);
574 float RSL_get_echo_top_height(Volume *v,float azim,float grange, float et_point);
575 float RSL_get_linear_value(Volume *v,float srange,float azim,float elev,float limit);
576 float RSL_get_nyquist_from_radar(Radar *radar);
577 float RSL_get_range_of_range_index(Ray *ray, int index);
578 float RSL_get_value(Volume *v, float elev, float azimuth, float range);
579 float RSL_get_value_at_h(Volume *v, float azim, float grnd_r, float h);
580 float RSL_get_value_from_cappi(Cappi *cappi, float rng, float azm);
581 float RSL_get_value_from_ray(Ray *ray, float r);
582 float RSL_get_value_from_sweep(Sweep *s, float azim, float r);
583 float RSL_z_to_r(float z, float k, float a);
585 int RSL_fill_cappi(Volume *v, Cappi *cap, int method);
586 int RSL_get_ray_index_from_sweep(Sweep *s, float azim,int *next_closest);
587 int RSL_get_sweep_index_from_volume(Volume *v, float elev,int *next_closest);
588 int RSL_radar_to_hdf(Radar *radar, char *outfile);
589 int RSL_write_histogram(Histogram *histogram, char *outfile);
590 int RSL_write_ray(Ray *r, FILE *fp);
591 int RSL_write_sweep(Sweep *s, FILE *fp);
592 int RSL_write_radar(Radar *radar, char *outfile);
593 int RSL_write_radar_gzip(Radar *radar, char *outfile);
594 int RSL_write_volume(Volume *v, FILE *fp);
596 unsigned char *RSL_rhi_sweep_to_cart(Sweep *s, int xdim, int ydim, float range,
598 unsigned char *RSL_sweep_to_cart(Sweep *s, int xdim, int ydim, float range);
600 void RSL_add_dbz_offset_to_ray(Ray *r, float dbz_offset);
601 void RSL_add_dbz_offset_to_sweep(Sweep *s, float dbz_offset);
602 void RSL_add_dbz_offset_to_volume(Volume *v, float dbz_offset);
603 void RSL_bscan_ray(Ray *r, FILE *fp);
604 void RSL_bscan_sweep(Sweep *s, char *outfile);
605 void RSL_bscan_volume(Volume *v, char *basename);
606 void RSL_find_rng_azm(float *r, float *ang, float x, float y);
607 void RSL_fix_time (Ray *ray);
608 void RSL_float_to_char(float *x, Range *c, int n);
610 void RSL_free_cappi(Cappi *c);
611 void RSL_free_carpi(Carpi *carpi);
612 void RSL_free_cube(Cube *cube);
613 void RSL_free_histogram(Histogram *histogram);
614 void RSL_free_ray(Ray *r);
615 void RSL_free_slice(Slice *slice);
616 void RSL_free_sweep(Sweep *s);
617 void RSL_free_radar(Radar *r);
618 void RSL_free_volume(Volume *v);
619 void RSL_get_color_table(int icolor, char buffer[256], int *ncolors);
620 void RSL_get_groundr_and_h(float slant_r, float elev, float *gr, float *h);
621 void RSL_get_slantr_and_elev(float gr, float h, float *slant_r, float *elev);
622 void RSL_get_slantr_and_h(float gr, float elev, float *slant_r, float *h);
623 void RSL_load_color_table(char *infile, char buffer[256], int *ncolors);
624 void RSL_load_height_color_table();
625 void RSL_load_rainfall_color_table();
626 void RSL_load_refl_color_table();
627 void RSL_load_vel_color_table();
628 void RSL_load_sw_color_table();
629 void RSL_load_zdr_color_table();
630 void RSL_load_red_table(char *infile);
631 void RSL_load_green_table(char *infile);
632 void RSL_load_blue_table(char *infile);
633 void RSL_print_histogram(Histogram *histogram, int min_range, int max_range,
635 void RSL_print_version();
636 void RSL_radar_to_uf(Radar *r, char *outfile);
637 void RSL_radar_to_uf_gzip(Radar *r, char *outfile);
638 void RSL_radar_verbose_off(void);
639 void RSL_radar_verbose_on(void);
640 void RSL_read_these_sweeps(char *csweep, ...);
641 void RSL_rebin_velocity_ray(Ray *r);
642 void RSL_rebin_velocity_sweep(Sweep *s);
643 void RSL_rebin_velocity_volume(Volume *v);
644 void RSL_rebin_zdr_ray(Ray *r);
645 void RSL_rebin_zdr_sweep(Sweep *s);
646 void RSL_rebin_zdr_volume(Volume *v);
647 void RSL_rhi_sweep_to_gif(Sweep *s, char *outfile, int xdim, int ydim, float range,
649 void RSL_select_fields(char *field_type, ...);
650 void RSL_set_color_table(int icolor, char buffer[256], int ncolors);
651 void RSL_sweep_to_gif(Sweep *s, char *outfile, int xdim, int ydim, float range);
652 void RSL_sweep_to_pgm(Sweep *s, char *outfile, int xdim, int ydim, float range);
653 void RSL_sweep_to_pict(Sweep *s, char *outfile, int xdim, int ydim, float range);
654 void RSL_sweep_to_ppm(Sweep *s, char *outfile, int xdim, int ydim, float range);
655 void RSL_volume_to_gif(Volume *v, char *basename, int xdim, int ydim, float range);
656 void RSL_volume_to_pgm(Volume *v, char *basename, int xdim, int ydim, float range);
657 void RSL_volume_to_pict(Volume *v, char *basename, int xdim, int ydim, float range);
658 void RSL_volume_to_ppm(Volume *v, char *basename, int xdim, int ydim, float range);
659 void RSL_write_gif(char *outfile, unsigned char *image,
660 int xdim, int ydim, char c_table[256][3]);
661 void RSL_write_pgm(char *outfile, unsigned char *image,
663 void RSL_write_pict(char *outfile, unsigned char *image,
664 int xdim, int ydim, char c_table[256][3]);
665 void RSL_write_ppm(char *outfile, unsigned char *image,
666 int xdim, int ydim, char c_table[256][3]);
669 Cappi *RSL_new_cappi(Sweep *sweep, float height);
670 Cappi *RSL_cappi_at_h(Volume *v, float height, float max_range);
672 Carpi *RSL_cappi_to_carpi(Cappi *cappi, float dx, float dy,
673 float lat, float lon,
674 int nx, int ny, int radar_x, int radar_y);
675 Carpi *RSL_new_carpi(int nrows, int ncols);
676 Carpi *RSL_volume_to_carpi(Volume *v, float h, float grnd_r,
677 float dx, float dy, int nx, int ny,
678 int radar_x, int radar_y, float lat, float lon);
680 Cube *RSL_new_cube(int ncarpi);
681 Cube *RSL_volume_to_cube(Volume *v, float dx, float dy, float dz,
682 int nx, int ny, int nz, float grnd_r,
683 int radar_x, int radar_y, int radar_z);
685 Slice *RSL_new_slice(int nrows, int ncols);
686 Slice *RSL_get_slice_from_cube(Cube *cube, int x, int y, int z);
689 Histogram *RSL_allocate_histogram(int low, int hi);
690 Histogram *RSL_get_histogram_from_ray(Ray *ray, Histogram *histogram,
691 int low, int hi, int min_range,
693 Histogram *RSL_get_histogram_from_sweep(Sweep *sweep, Histogram *histogram,
694 int low, int hi, int min_range,
696 Histogram *RSL_get_histogram_from_volume(Volume *volume, Histogram *histogram,
697 int low, int hi, int min_range,
699 Histogram *RSL_read_histogram(char *infile);
701 int no_command (char *cmd);
702 FILE *uncompress_pipe (FILE *fp);
703 FILE *compress_pipe (FILE *fp);
704 int rsl_pclose(FILE *fp);
706 /* Carpi image generation functions. These are modified clones of the
707 corresponding sweep image generation functions.
709 unsigned char *RSL_carpi_to_cart(Carpi *carpi, int xdim, int ydim,
711 void RSL_carpi_to_gif(Carpi *carpi, char *outfile, int xdim, int ydim,
713 void RSL_carpi_to_pict(Carpi *carpi, char *outfile, int xdim, int ydim,
715 void RSL_carpi_to_ppm(Carpi *carpi, char *outfile, int xdim, int ydim,
717 void RSL_carpi_to_pgm(Carpi *carpi, char *outfile, int xdim, int ydim,
720 /* Internal storage conversion functions. These may be any conversion and
721 * may be dynamically defined; based on the input data conversion.
749 Range DZ_INVF(float x);
750 Range VR_INVF(float x);
751 Range SW_INVF(float x);
752 Range CZ_INVF(float x);
753 Range ZT_INVF(float x);
754 Range DR_INVF(float x);
755 Range LR_INVF(float x);
756 Range ZD_INVF(float x);
757 Range DM_INVF(float x);
758 Range RH_INVF(float x);
759 Range PH_INVF(float x);
760 Range XZ_INVF(float x);
761 Range CD_INVF(float x);
762 Range MZ_INVF(float x);
763 Range MD_INVF(float x);
764 Range ZE_INVF(float x);
765 Range VE_INVF(float x);
766 Range KD_INVF(float x);
767 Range TI_INVF(float x);
768 Range DX_INVF(float x);
769 Range CH_INVF(float x);
770 Range AH_INVF(float x);
771 Range CV_INVF(float x);
772 Range AV_INVF(float x);
773 Range SQ_INVF(float x);
776 /* If you like these variables, you can use them in your application
777 * by defining USE_RSL_VARS before #include "rsl.h"
780 static char *RSL_ftype[] = {"DZ", "VR", "SW", "CZ", "ZT", "DR",
781 "LR", "ZD", "DM", "RH", "PH", "XZ",
782 "CD", "MZ", "MD", "ZE", "VE", "KD",
783 "TI", "DX", "CH", "AH", "CV", "AV",
786 static float (*RSL_f_list[])(Range x) = {DZ_F, VR_F, SW_F, CZ_F, ZT_F, DR_F,
787 LR_F, ZD_F, DM_F, RH_F, PH_F, XZ_F,
788 CD_F, MZ_F, MD_F, ZE_F, VE_F, KD_F,
789 TI_F, DX_F, CH_F, AH_F, CV_F, AV_F,
792 static Range (*RSL_invf_list[])(float x)
793 = {DZ_INVF, VR_INVF, SW_INVF, CZ_INVF, ZT_INVF, DR_INVF,
794 LR_INVF, ZD_INVF, DM_INVF, RH_INVF, PH_INVF, XZ_INVF,
795 CD_INVF, MZ_INVF, MD_INVF, ZE_INVF, VE_INVF, KD_INVF,
796 TI_INVF, DX_INVF, CH_INVF, AH_INVF, CV_INVF, AV_INVF,
799 /* Secret routines that are quite useful and useful to developers. */
800 void radar_load_date_time(Radar *radar);
801 int big_endian(void);
802 int little_endian(void);
803 void swap_4_bytes(void *word);
804 void swap_2_bytes(void *word);
805 Hash_table *hash_table_for_sweep(Sweep *s);
806 int hash_bin(Hash_table *table,float angle);
807 Azimuth_hash *the_closest_hash(Azimuth_hash *hash, float ray_angle);
808 Hash_table *construct_sweep_hash_table(Sweep *s);
809 double angle_diff(float x, float y);
810 int rsl_query_field(char *c_field);
813 /* Debugging prototypes. */
814 void poke_around_volume(Volume *v);
816 /* SYSTEM: left out prototypes? */
817 extern int pclose (FILE *f); /* From stdio.h */