1 | |
---|
2 | /* file earthloc.h |
---|
3 | * ========== |
---|
4 | * |
---|
5 | * version 5, 22-May-2006 |
---|
6 | * |
---|
7 | * header file of module earthloc.c |
---|
8 | * K. Stammler, 23-May-92 |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | /* |
---|
13 | * |
---|
14 | * SeismicHandler, seismic analysis software |
---|
15 | * Copyright (C) 1996, Klaus Stammler, Federal Institute for Geosciences |
---|
16 | * and Natural Resources (BGR), Germany |
---|
17 | * |
---|
18 | * This program is free software; you can redistribute it and/or modify |
---|
19 | * it under the terms of the GNU General Public License as published by |
---|
20 | * the Free Software Foundation; either version 2 of the License, or |
---|
21 | * (at your option) any later version. |
---|
22 | * |
---|
23 | * This program is distributed in the hope that it will be useful, |
---|
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
26 | * GNU General Public License for more details. |
---|
27 | * |
---|
28 | * You should have received a copy of the GNU General Public License |
---|
29 | * along with this program; if not, write to the Free Software |
---|
30 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | /* error numbers */ |
---|
37 | |
---|
38 | #define MBE_OFFSET 3300 |
---|
39 | #define MBE_ILLLAT (MBE_OFFSET+1) /* illegal latitude */ |
---|
40 | #define MBE_ILLLON (MBE_OFFSET+2) /* illegal longitude */ |
---|
41 | #define MBE_OPNIDX (MBE_OFFSET+3) /* error opening index file */ |
---|
42 | #define MBE_EOF (MBE_OFFSET+4) /* enf of file found */ |
---|
43 | #define MBE_OPNNAM (MBE_OFFSET+5) /* error opening name file */ |
---|
44 | #define MBE_SHORTSTR (MBE_OFFSET+6) /* output string too short */ |
---|
45 | #define MBE_OPNCORR (MBE_OFFSET+7) /* error opening correction file */ |
---|
46 | #define MBE_RDCORR (MBE_OFFSET+8) /* error reading correction file */ |
---|
47 | #define MBE_EMPTYLIST (MBE_OFFSET+9) /* correction list is empty */ |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | /* prototypes */ |
---|
53 | /*---------------------------------------------------------------------*/ |
---|
54 | |
---|
55 | |
---|
56 | void mb_locdiff( double slat, double slon, double elat, double elon, |
---|
57 | double *distance, double *azim, double *bazim ); |
---|
58 | |
---|
59 | /* returns distance and azimuth in degrees of two locations on |
---|
60 | * earth |
---|
61 | * |
---|
62 | * parameters of routine |
---|
63 | * double slat, slon; input; latitude and longitude of station |
---|
64 | * double elat, elon; input; latitude and longitude of epicentre |
---|
65 | * double *distance; output; distance in degrees |
---|
66 | * double *azim; output; azimuth in degrees |
---|
67 | * double *bazim; output; back-azimuth in degrees |
---|
68 | */ |
---|
69 | |
---|
70 | |
---|
71 | /*---------------------------------------------------------------------*/ |
---|
72 | |
---|
73 | |
---|
74 | void mb_ferindex( float lat, float lon, int *feridx, STATUS *status ); |
---|
75 | |
---|
76 | /* returns FER index from given location (lat,lon) in degrees |
---|
77 | * |
---|
78 | * parameters of routine |
---|
79 | * float lat, lon; input; location in degrees |
---|
80 | */ |
---|
81 | |
---|
82 | |
---|
83 | /*---------------------------------------------------------------------*/ |
---|
84 | |
---|
85 | |
---|
86 | void mb_fername( int ferindex, int maxlth, char fername[], STATUS *status ); |
---|
87 | |
---|
88 | /* returns name of FER |
---|
89 | * |
---|
90 | * parameters of routine |
---|
91 | * int ferindex; input; FER index |
---|
92 | * char fername[]; output; FER name |
---|
93 | * STATUS *status; output; return status |
---|
94 | */ |
---|
95 | |
---|
96 | |
---|
97 | /*---------------------------------------------------------------------*/ |
---|
98 | |
---|
99 | |
---|
100 | void mb_getlocname( float lat, float lon, int maxlth, |
---|
101 | char name[], STATUS *status ); |
---|
102 | |
---|
103 | /* returns FER name of location (lat,lon) |
---|
104 | * |
---|
105 | * parameters of routine |
---|
106 | * float lat, lon; input; location in degrees |
---|
107 | * int maxlth; input; maximum length of output string |
---|
108 | * char name[]; output; FER name |
---|
109 | * STATUS *status; output; return status |
---|
110 | */ |
---|
111 | |
---|
112 | |
---|
113 | /*---------------------------------------------------------------------*/ |
---|
114 | |
---|
115 | |
---|
116 | void mb_setindexfile( char name[], STATUS *status ); |
---|
117 | |
---|
118 | /* tells where to find the FER index file |
---|
119 | * |
---|
120 | * parameters of routine |
---|
121 | * char name[]; input; name (and path) of FER index file |
---|
122 | * STATUS *status; output; return status |
---|
123 | */ |
---|
124 | |
---|
125 | |
---|
126 | /*---------------------------------------------------------------------*/ |
---|
127 | |
---|
128 | |
---|
129 | void mb_setfernamefile( char name[], STATUS *status ); |
---|
130 | |
---|
131 | /* tells where to find the FER name file |
---|
132 | * |
---|
133 | * parameters of routine |
---|
134 | * char name[]; input; name (and path) of FER name file |
---|
135 | * STATUS *status; output; return status |
---|
136 | */ |
---|
137 | |
---|
138 | |
---|
139 | /*---------------------------------------------------------------------*/ |
---|
140 | |
---|
141 | |
---|
142 | void mb_spherediff( float slat, float slon, float elat, float elon, |
---|
143 | float *dist, float *bazim ); |
---|
144 | |
---|
145 | /* computes difference and azimuth of two locations (slat,slon) |
---|
146 | * and (elat,elon) |
---|
147 | * |
---|
148 | * parameters of routine |
---|
149 | * float slat, slon; input; (station) location in degrees |
---|
150 | * float elat, elon; input; (epicentre) location in degrees |
---|
151 | * float *dist; output; distance in degrees |
---|
152 | * float *bazim; output; (back-)azimuth in degrees |
---|
153 | */ |
---|
154 | |
---|
155 | |
---|
156 | /*---------------------------------------------------------------------*/ |
---|
157 | |
---|
158 | |
---|
159 | void mb_sphereadd( float slat, float slon, float dist, float bazim, |
---|
160 | float *elat, float *elon ); |
---|
161 | |
---|
162 | /* computes new location from input location (slat,slon) and distance |
---|
163 | * "dist" and azimuth "azim" |
---|
164 | * |
---|
165 | * parameters of routine |
---|
166 | * float slat, slon; input; (station) input location in degrees |
---|
167 | * float dist; input; distance in degrees |
---|
168 | * float bazim; input; (back-)azimuth in degrees |
---|
169 | * float *elat, *elon; output; (epicentre) location in degrees |
---|
170 | */ |
---|
171 | |
---|
172 | |
---|
173 | /*---------------------------------------------------------------------*/ |
---|
174 | |
---|
175 | |
---|
176 | void mb_statcorr( float slo_in, float az_in, float *slo_out, |
---|
177 | float *az_out, float *slo_dist, float *az_dist, STATUS *status ); |
---|
178 | |
---|
179 | /* applies station correction for slowness and azimuth. The |
---|
180 | * corrections are listed in a correction file mbv_corrfile. |
---|
181 | * The difference vector of the next correction point is |
---|
182 | * added to the input data |
---|
183 | * |
---|
184 | * parameters of routine |
---|
185 | * float slo_in; input; input slowness in sec/deg |
---|
186 | * float az_in; input; input azimuth in deg |
---|
187 | * float *slo_out; output; corrected slowness in sec/deg |
---|
188 | * float *az_out; output; corrected azimuth in deg |
---|
189 | * float *slo_dist; output; slowness distance to the next correction |
---|
190 | * float *az_dist; output; azimuth distance to the next correction |
---|
191 | * STATUS *status; output; return status |
---|
192 | */ |
---|
193 | |
---|
194 | |
---|
195 | /*---------------------------------------------------------------------*/ |
---|
196 | |
---|
197 | |
---|
198 | void mb_setcorrfilename( char name[], STATUS *status ); |
---|
199 | |
---|
200 | /* tells where to find the slowness and azimuth correction file |
---|
201 | * |
---|
202 | * parameters of routine |
---|
203 | * char name[]; input; name (and path) of correction file |
---|
204 | * STATUS *status; output; return status |
---|
205 | */ |
---|
206 | |
---|
207 | |
---|
208 | /*---------------------------------------------------------------------*/ |
---|
209 | |
---|
210 | |
---|
211 | void mb_deg_to_km( int listlth, double lat[], double lon[], |
---|
212 | float x[], float y[] ); |
---|
213 | |
---|
214 | /* computes x-y coordinates of points on surface of earth given in lat&lon. |
---|
215 | * The reference point is assumed to be given as last element of the list. |
---|
216 | * |
---|
217 | * parameters of routine |
---|
218 | * int listlth; length of following arrays |
---|
219 | * double lat[], lon[]; input; given locations in deg |
---|
220 | * float x[], y[]; output; returned locations in km |
---|
221 | */ |
---|
222 | |
---|
223 | |
---|
224 | /*---------------------------------------------------------------------*/ |
---|