]> Pileus Git - ~andy/rsl/blob - examples/qlook_usage.c
80ca2e593ad4f989d594aecd4eb47323d37e8493
[~andy/rsl] / examples / qlook_usage.c
1 #define TRUE 1
2 #define FALSE 0
3
4 #include <stdio.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8
9 void process_args(int argc, char **argv, char *in_file, int *verbose,
10                                   char *site_id, char *tape_id,
11                                   int *qc_reflectivity, int *total_reflectivity,
12                                   int *differential_reflectivity, 
13                                   int *velocity, int *spectral_width,
14                                   int *make_gif, int *make_pgm, int *make_bscan, int *make_uf,
15                                   int *num_sweeps, float *dbz_offset,
16                                   int *xdim, int *ydim, float *range,
17                                   float *gate_size_adjustment, int *print_azim)
18 {
19         extern char   *optarg;
20     extern int    optind, optopt;
21         char c;
22
23         while ((c = getopt(argc, argv, "vgpus:t:n:x:y:r:o:a:ADCQTWV")) != -1) {
24
25           switch(c) {
26 /*
27   RSL Verbose flag
28 */
29           case 'v': *verbose = TRUE; break;
30
31 /* 
32   s: First file or call sign 
33 */
34           case 's': strcpy(site_id, optarg); break;
35           case 't': strcpy(tape_id, optarg); break;
36
37 /*
38    x: x dimension
39    y: y dimension
40    r: max range
41    z: zoom factor (km/pixel)
42 */
43           case 'x': *xdim  = atoi(optarg); break;
44           case 'y': *ydim  = atoi(optarg); break;
45           case 'r': *range = atof(optarg); break;
46           case 'a': *gate_size_adjustment = atof(optarg); break;
47           
48 /*  dBZ Offset
49 */
50           case 'o': *dbz_offset = atof(optarg); break;
51 /* 
52    T: Total reflectivity
53    Q: Do qc'd reflectivity
54    V: Do radial velocity
55    W: Do spectral width
56 */
57           case 'Q': *qc_reflectivity = TRUE; break;
58           case 'T': *total_reflectivity = TRUE; break;
59           case 'V': *velocity        = TRUE; break;
60           case 'W': *spectral_width  = TRUE; break;
61           case 'A': *print_azim = TRUE; break;
62           case 'D': *differential_reflectivity  = TRUE; break;
63
64 /*
65    g: Make gif images
66    p: Make pgm images
67    u: Make uf files
68 */
69           case 'g': *make_gif = TRUE; break;
70           case 'p': *make_pgm = TRUE; break;
71           case 'u': *make_uf  = TRUE; break;
72
73 /* 
74    num_sweeps: Number of sweeps to make images of 
75 */
76           case 'n': *num_sweeps = atoi(optarg); break;
77
78 /*
79   Deal with bad input
80 */
81           case '?': fprintf(stderr, "ERROR: option -%c is undefined\n", optopt);
82                 goto Usage;
83           case ':': fprintf(stderr, "ERROR: option -%c requires an argument\n",optopt);
84                 goto Usage;
85           default: break;
86           }
87         }
88
89 /*
90    Must have at the least a file listed on the command lines, everything
91    can be defaulted.
92  */
93
94         if (argc - optind != 1) {
95 Usage:
96                 fprintf(stderr,"ERROR:::\n");
97                 fprintf(stderr,"%s [options] input_file:",argv[0]);
98                 fprintf(stderr,"\n[options]: ");
99                 fprintf(stderr,"\n\t[-v verbose_flag?] ");
100                 fprintf(stderr,"\n\t[-s First file or call sign?] ");
101                 fprintf(stderr,"\n\t[-t Tape ID] ");
102                 fprintf(stderr,"\n\t[-u Make UF file]");
103                 fprintf(stderr,"\n\t[-g Make GIF images?]");
104                 fprintf(stderr,"\n\t[-p Make PGM images?]");
105                 fprintf(stderr,"\n\t[-x X dimension]");
106                 fprintf(stderr,"\n\t[-y Y dimension]");
107                 fprintf(stderr,"\n\t[-r max range]");
108                 fprintf(stderr,"\n\t[-n Number of sweeps to make images]");
109                 fprintf(stderr,"\n\t[-Q Do qc reflectivity]");
110                 fprintf(stderr,"\n\t[-T Do total reflectivity]");
111                 fprintf(stderr,"\n\t[-V Do velocity]");
112                 fprintf(stderr,"\n\t[-W Do spectral_width]");
113                 fprintf(stderr,"\n\t[-D Do differential reflectivity");
114                 fprintf(stderr,"\n\t[-o Apply dBZ offset");
115                 fprintf(stderr,":::\n");
116                 exit(-1);
117         }
118         
119         strcpy(in_file, argv[optind]);
120
121 }
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141