Changeset 57
- Timestamp:
- 10/30/2008 11:04:21 PM (15 years ago)
- Location:
- SH_SHM/trunk/source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
SH_SHM/trunk/source/globalparams.c
r44 r57 3 3 * ============== 4 4 * 5 * $Revision: 29 $, $Date: 2008-02-23 23:02:22 +0100 (Sa, 23 Feb2008) $5 * $Revision: 42 $, $Date: 2008-10-13 22:51:21 +0200 (Mo, 13 Okt 2008) $ 6 6 * 7 7 * Management of global parameters … … 395 395 "reads_swap", 396 396 "reads_invhdr", 397 "autosort_by_distance", 397 398 "b_last_parameter" 398 399 }; … … 403 404 (1 << cGpB_overwrite_string_lists) | 404 405 (1 << cGpB_own_accelerators) | 406 (1 << cGpB_autosort_by_distance) | 405 407 (1 << cGpB_reads_swap) 406 408 ; -
SH_SHM/trunk/source/globalparams.h
r44 r57 3 3 * ============== 4 4 * 5 * $Revision: 29 $, $Date: 2008-02-23 23:02:22 +0100 (Sa, 23 Feb2008) $5 * $Revision: 42 $, $Date: 2008-10-13 22:51:21 +0200 (Mo, 13 Okt 2008) $ 6 6 * 7 7 * Management of global parameters … … 235 235 cGpB_reads_swap, 236 236 cGpB_reads_invhdr, 237 cGpB_autosort_by_distance, 237 238 cGpB_last 238 239 } TGpBooleanIndex; -
SH_SHM/trunk/source/motif/mfexec.c
r16 r57 109 109 float *azim, TSyStatus *status ); 110 110 static void mxh_read_stations_from_evt( char autoevt[], char addlist[] ); 111 static void mxh_read_location_from_evt( char autoevt[], float *lat, float *lon, 112 TSyBoolean *found ); 111 113 112 114 … … 143 145 TSyStatus locstat; /* local status */ 144 146 char gsename[cBcFileLth+1]; /* name of GSE file */ 147 float epilat, epilon; /* epicentre location rea from evt */ 148 float vlat1, vlat2, vlon1, vlon2;/* lat and lon area */ 149 TSyBoolean epifound; /* epicentre found in evt */ 150 int locvarcnt; /* location variable counter */ 145 151 146 152 /* executable code */ … … 221 227 } /*endif*/ 222 228 printf( "statlist: %s\n", statlist ); 229 } /*endif*/ 230 } else if (strcmp(par->sl.code[i],":LOC") == 0) { 231 if (autoevt == NULL) { 232 printf( "*SHM: cannot translate :LOC, autoevt is NULL\n" ); 233 } else if (*autoevt == '\0') { 234 printf( "*SHM: cannot translate :LOC, autoevt is empty\n" ); 235 } else { 236 mxh_read_location_from_evt( autoevt, &epilat, &epilon, 237 &epifound ); 238 if (!epifound) { 239 printf( "*SHM: cannot translate :LOC, no epicentre found\n" ); 240 return; 241 } /*endif*/ 242 if (GpGetInt(cGpI_debug_level) > 2) 243 printf( "SHM-dbg3: :LOC found epi %f,%f\n", epilat, epilon ); 244 } /*endif*/ 245 epifound = FALSE; 246 locvarcnt = 1; 247 FOREVER { 248 /* read through all v$loc* variables */ 249 sprintf( varname, "v$loc%d", locvarcnt ); 250 GpReadParameter( varname, cBcLongStrLth, addlist, &ok ); 251 if (!ok) break; 252 if (GpGetInt(cGpI_debug_level) > 4) 253 printf( "SHM-dbg4: %s translated to %s\n", varname, addlist ); 254 if (sscanf(addlist,"%f,%f,%f,%f %s", 255 &vlat1,&vlon1,&vlat2,&vlon2,statlist) != 5) 256 continue; 257 if (vlat1 <= epilat && epilat <= vlat2 && vlon1 <= epilon 258 && epilon <= vlon2) { 259 epifound = TRUE; 260 break; 261 } /*endif*/ 262 locvarcnt++; 263 } /*endfor*/ 264 if (!epifound) { 265 GpReadParameter("v$loc", cBcLongStrLth, statlist, &ok ); 266 if (!ok) { 267 printf( "*SHM: no v$loc definition\n" ); 268 return; 269 } /*endif*/ 223 270 } /*endif*/ 224 271 } else { … … 2141 2188 2142 2189 /*----------------------------------------------------------------------------*/ 2190 2191 2192 2193 static void mxh_read_location_from_evt( char autoevt[], float *lat, float *lon, 2194 TSyBoolean *found ) 2195 2196 /* Reads latitude and longitude from evt file 2197 * 2198 * parameters of routine 2199 * char autoevt[]; input; name of evt file 2200 * float *lat, *lon; output; location read from above file 2201 * TSyBoolean *found; output; TRUE if location is found 2202 */ 2203 { 2204 /* local variables */ 2205 FILE *fp; /* pointer to file */ 2206 char line[cBcLineLth+1]; /* current line of file */ 2207 TSyBoolean latfound, lonfound; /* latitude and longitude found */ 2208 int i; /* counter */ 2209 2210 /* executable code */ 2211 2212 /* open evt file */ 2213 *found = TRUE; 2214 fp = fopen( autoevt, "r" ); 2215 if (fp == NULL) { 2216 *found = FALSE; 2217 return; 2218 } /*endif*/ 2219 2220 /* read through file */ 2221 latfound = lonfound = FALSE; 2222 while (fgets(line,cBcLineLth,fp) != NULL) { 2223 if (strncmp(line,"Latitude ",9) == 0) { 2224 i = 9; /* length of Latitude string */ 2225 while (line[i] == ' ' || line[i] == ':') 2226 i++; 2227 if (sscanf(line+i,"%f",lat) == 1) 2228 latfound = TRUE; 2229 } /*endif*/ 2230 if (strncmp(line,"Longitude ",10) == 0) { 2231 i = 10; /* length of Latitude string */ 2232 while (line[i] == ' ' || line[i] == ':') 2233 i++; 2234 if (sscanf(line+i,"%f",lon) == 1) 2235 lonfound = TRUE; 2236 } /*endif*/ 2237 if (latfound && lonfound) 2238 break; 2239 } /*endwhile*/ 2240 2241 if (!latfound || !lonfound) { 2242 *found = FALSE; 2243 return; 2244 } /*endif*/ 2245 2246 fclose( fp ); 2247 2248 } /* end of mxh_read_location_from_evt */ 2249 2250 2251 2252 /*----------------------------------------------------------------------------*/ -
SH_SHM/trunk/source/motif/shm.c
r48 r57 3 3 * ===== 4 4 * 5 * $Revision: 33 $, $Date: 2008-05-19 20:03:26 +0200 (Mo, 19 Mai2008) $5 * $Revision: 42 $, $Date: 2008-10-13 22:51:21 +0200 (Mo, 13 Okt 2008) $ 6 6 * 7 7 * main module of shm … … 1551 1551 /*mg_tracedisplay( xmv_w[k_widget_draw], &xmv_dspctrl, &status );*/ 1552 1552 } /*endif*/ 1553 /* sort by distance automatically if requested */ 1554 if (GpGetBoolean(cGpB_autosort_by_distance)) { 1555 if (GpGetInt(cGpI_debug_level) > 3) 1556 printf( "SHM-dbg4: auto sort by distance\n" ); 1557 strcpy( xmv_sortstr, "DISTANCE" ); 1558 strcpy( xmv_sortinfo, "sort:d" ); 1559 /*cu_get_param_values( xmv_w, xmv_cpar );*/ 1560 cl4_sort_traces( xmv_w[k_widget_draw], &xmv_dspctrl, xmv_sortstr, 1561 xmv_cpar, &status ); 1562 if (Severe(&status)) { 1563 cu_alert( status ); 1564 status = cBcNoError; 1565 } /*endif*/ 1566 mg_print_sortinfo( xmv_w[k_widget_draw], xmv_sortinfo ); 1567 } /*endif*/ 1553 1568 } /*endif*/ 1554 1569 cl2_display_busy( xmv_w, FALSE );
Note: See TracChangeset
for help on using the changeset viewer.