3 This is the TRMM Office Radar Software Library.
4 Copyright (C) 1996, 1997
6 Space Applications Corporation
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
19 You should have received a copy of the GNU Library General Public
20 License along with this library; if not, write to the Free
21 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * get_site - fills structure containing radar site info
26 * char *in_sitenm - ptr to radar site name
27 * returns: struct radar_site *currsite->- ptr to current site structure
28 * Returns NULL on failure of 'in_sitenm' lookup.
29 * calls from: Proc_file
34 int strcasecmp(const char *s1, const char *s2);
38 Wsr88d_site_info *wsr88d_get_site(char *in_sitenm)
40 /* variable declarations */
43 int in_number,in_latd,in_latm,in_lats,in_lond,in_lonm,in_lons;
45 char in_site[5],in_city[16],in_state[4]; /* One extra for \0 */
46 struct radar_site *currsite=NULL;
49 if((in_file=fopen(WSR88D_SITE_INFO_FILE, "r")) !=NULL)
52 while (fgets(line,sizeof(line),in_file) != NULL)
54 scan_count=sscanf(line,"%d %s %s %s %d %d %d %d %d %d %d",&in_number,in_site,in_city,in_state,&in_latd,&in_latm,&in_lats,&in_lond,&in_lonm,&in_lons,&in_height);
55 if(scan_count != 11 && scan_count != 0)
56 fprintf(stderr,"get_site: sitedb read");
59 /* get the radar site info */
61 /* check for the matching site name*/
62 if(strcasecmp(in_sitenm,in_site)== 0)
64 if((currsite=(struct radar_site *)malloc(sizeof(struct radar_site)))==NULL) {
65 perror("wsr88d_get_site");
68 currsite->number = in_number;
70 currsite->name[i] = in_site[i];
72 currsite->city[i] = in_city[i];
74 currsite->state[i] = in_state[i];
75 currsite->latd = in_latd;
76 currsite->latm = in_latm;
77 currsite->lats = in_lats;
78 currsite->lond = in_lond;
79 currsite->lonm = in_lonm;
80 currsite->lons = in_lons;
81 currsite->height = in_height;
82 currsite->bwidth = -999;
83 currsite->spulse = 1530;
84 currsite->lpulse = 4630;
90 (void)fclose(in_file);
93 perror(WSR88D_SITE_INFO_FILE);