]> Pileus Git - ~andy/rsl/blob - examples/adjust_gate_size.c
Initial import
[~andy/rsl] / examples / adjust_gate_size.c
1 #include <stdio.h>
2 #include<string.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include "rsl.h"
6
7 void adjust_gate_size(Radar *radar, float gate_size_adjustment)
8 {
9
10     int    i,j,k,nvolumes;
11     Volume *volume;
12     Sweep  *sweep;
13     Ray    *ray;
14   
15         if(gate_size_adjustment != 1.0) {
16                 nvolumes = radar->h.nvolumes;
17                 for(i=0; i<nvolumes; i++) {
18                         if(radar->v[i] != NULL) {
19                                 volume=radar->v[i];
20                                 for(j=0; j<volume->h.nsweeps; j++) {
21                                         if(volume->sweep[j] != NULL) {
22                                                 sweep = volume->sweep[j];
23                                                 for(k=0; k<sweep->h.nrays; k++) {
24                                                         if(sweep->ray[k] != NULL) {
25                                                                 ray = sweep->ray[k];
26                                                                 ray->h.gate_size = ray->h.gate_size*gate_size_adjustment;
27                                                         }
28                                                 }
29                                         }
30                                 }
31                         }
32                 }
33         }
34
35 /*
36   If Gate Size Adjustment is not unity, then we must change the
37   following:
38       old_gs = radar->v[i]->sweep[sweepIndex]->ray[rayIndex=]->h.gate_size
39           radar->v[i]->sweep[sweepIndex]->ray[rayIndex=]->h.gate_size = 
40               old_gs*gate_size_adjustment
41    Here are some comments from Sandra Yuter on the necessity of this fix.
42    > I dug into the revelant code and it looks like we can do a relatively
43         > simple workaround for the SIGMET raw product file range bin size
44         > errors for the RHB data pulses widths of 0.5 usec and 2.0 usec as follows.
45         > 
46         > Since we are all converting from sigmet to UF I suggest we resize 
47         > the range bin size values in the ray headers in the qlook step
48         > where the sigmet to UF conversion occurs.
49         > 
50         > The resize requires only 1 additional line of code (I have included
51         > a few others for context) in qlook.c
52         > 
53         > rangeToFirstGate = 0.001 *
54         >                radar->v[i]->sweep[sweepIndex]->ray[rayIndex]->h.range_bin1;
55         >             gateSize = 0.001 *
56         >                radar->v[i]->sweep[sweepIndex]->ray[rayIndex]->h.gate_size;
57         >             radar->v[i]->sweep[sweepIndex]->ray[rayIndex]->h.gate_size=
58         >               gateSize*0.6*1000;
59         > 
60         > I have used 0.6 adjustment factor since that is 75/125 which corresponds
61         > to the error in my 0.5 usec data, for the SUR scans, this adjustment
62         > factor is 133.33/125 or 1.067.
63         
64         The following is from Joe Holmes from SIGMET
65         
66         > 
67         > I think you have experienced a problem with the RVP7 range resolution
68         > configuration.  Both in IRIS and in the RVP7 you manually type in
69         > the range resolution.  The RVP7 allows a separate resolution for
70         > each pulsewidth, while IRIS only allows 1 value.  There is no feedback
71         > if these values are not typed in the same.  Based on setup information
72         > we have here from the RH Brown from Oct 23, 1998, you had the following
73         > configuration:
74         > 
75         > RVP7:
76         > 0   0.50 usec   75.0m
77         > 1   0.80 usec  125.0m
78         > 2   1.39 usec  125.0m
79         > 3   2.00 usec  133.3m
80         > 
81         > IRIS: 125.0 meters
82         > 
83         > I think the error at PW#0 was corrected a while back, but
84         > the error  in PW#3 was never corrected.  Next time someone is
85         > at the ship, they should check this, fix the long pulse, and remake
86         > the bandpass filter for the long pulse.
87         > 
88         > In the short term, you can correct the error by taking all your
89         > long pulse data and changing the header to correctly document the
90         > range resolution.  We have a program to do this, it is called "change_raw".
91         > The source is on any IRIS system, which was installed with the
92         > source, headers, and objects turned on.  It is in the
93         > ${IRIS_ROOT}utils/examples directory.  We can supply you with
94         > a compiled version of this program, if you want.  Available platforms
95         > are Linux, HP-UX, and IRIX.
96
97 */
98
99         return;
100 }