]> Pileus Git - ~andy/rsl/blob - radtec.h
RSL v1.44
[~andy/rsl] / radtec.h
1 /*
2  * RADTEC Version 3.20 data structures.
3  *
4  * By John H. Merritt
5  *
6  * May 21, 1998
7  */
8 /*
9  
10     NASA/TRMM, Code 910.1.
11     This is the TRMM Office Radar Software Library.
12     Copyright (C) 1998
13             John H. Merritt
14             Space Applications Corporation
15             Vienna, Virginia
16
17     This library is free software; you can redistribute it and/or
18     modify it under the terms of the GNU Library General Public
19     License as published by the Free Software Foundation; either
20     version 2 of the License, or (at your option) any later version.
21
22     This library is distributed in the hope that it will be useful,
23     but WITHOUT ANY WARRANTY; without even the implied warranty of
24     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25     Library General Public License for more details.
26
27     You should have received a copy of the GNU Library General Public
28     License along with this library; if not, write to the Free
29     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32
33 /*
34  * An integer word in RADTEC is 16 bits, however, floats and doubles
35  * are 32 and 64 bits respectively.
36  */
37
38 typedef struct {
39   double rcvr_slope;
40   short  isolation;
41   short  noise_level;
42   short  counts_hi;
43   short  counts_lo;
44   short  power_hi;
45   short  power_lo;
46 } Video_calibration; /* 16 bytes */
47
48 typedef struct {
49   short  average_power;
50   short  reference_range;
51   double zconstant;
52   double zcorrection;
53 } Radar_calibration; /* 20 bytes */
54
55 typedef struct {
56   Video_calibration video_cal;
57   Radar_calibration radar_cal;
58 } Log_video_transmitter; /* 36 bytes */
59
60 typedef Log_video_transmitter Doppler_transmitter;
61
62 typedef struct {
63   short  doppler_velocity_range;      /* 0=0-16, 1=0-32 */
64   short  ground_clutter_filter_status;
65   short  adtnl_log_gc_filter_status;
66   short  adtnl_lin_gc_filter_status;
67 } Model_info;
68
69 typedef struct {
70   short  version;       /* Version number multiplied by 100.  320 means 3.20 */
71   short  scan_type;     /* 1=PPI, 2=RHI */
72   short  scan_mode;     /* Recording mode.  0=Log Video, 1=Doppler */
73   short  seqno;         /* Sequence number of this data file. */
74   short  month;         /* 1-12 */
75   short  day;           /* 1-31 */
76   short  year;          /* YYYY */
77   short  hour;          /* 0-23 */
78   short  min;           /* 0-59 */
79   short  sec;           /* 0-59 */
80   float  az_el;         /* RHI azimuth or PPI elevation in degrees. */
81   double azim_resolution;
82   double azim_offset;
83   double elev_resolution;
84   double elev_offset;
85   double site_elevation;
86   double site_latitude;
87   double site_longitude;
88   float  skip;             /* In microseconds, 1-1024. */
89   float  range_bin_size;   /* In microseconds, 1-1024. */
90   short  num_range_bins;   /* 16-240. */
91   short  num_integrations; /* # of integrations comprising each ray. 1-1024. */
92   short  num_rays;         /* Number of rays. */
93   Log_video_transmitter log_video;
94   Doppler_transmitter doppler;
95   short  model;            /* Processor model. 0=none, 1=750, 2=940, 3=950. */
96   Model_info model_info;
97   char   spare[12];        /* Fill to 200 bytes. */
98 } Radtec_header;
99
100 typedef struct {
101   short   ray_num;       /* Ray number.  0-n */
102   float  azim_angle;    /* Azimuth angle in degrees. */
103   float  elev_angle;    /* Elevation angle in degrees. */
104   short  hour;          /* 0-23 */
105   short  min;           /* 0-59 */
106   short  sec;           /* 0-59 */
107 } Radtec_ray_header;
108
109 typedef float Radtec_dbz[240];
110 typedef struct {
111   Radtec_ray_header *h;   /* May be set during reading of data.  Can
112                                                    * be safely ignored.  However, you'd have
113                                                    * to maintain two arrays -- headers and rays. 
114                                                    */
115   Radtec_dbz dbz;
116 } Radtec_ray;
117
118
119 typedef struct {
120   Radtec_header h;
121   Radtec_ray *ray;
122 } Radtec_file;
123
124 void radtec_free_file(Radtec_file *rfile);
125 Radtec_file *radtec_read_file(char *infile);
126 void radtec_print_header(Radtec_header *h);
127 void radtec_print_ray_header(Radtec_ray_header *h);
128
129    unsigned int _explode(
130       unsigned int (*read_buf)(char *buf, unsigned int *size, void *param),
131       void         (*write_buf)(char *buf, unsigned int *size, void *param),
132       char         *work_buf,
133       void         *param);
134    
135    unsigned long _crc32(
136       char          *buffer, 
137       unsigned int  *size, 
138       unsigned long *old_crc);