|
|
@ -126,28 +126,33 @@ def main(): |
|
|
|
arrivals_array.fill(num.nan) |
|
|
|
print('Computing arrival times.') |
|
|
|
if cc_cnf.use_cake: |
|
|
|
st_lats = num.asarray([st.lat for st in station_list]) |
|
|
|
st_lons = num.asarray([st.lon for st in station_list]) |
|
|
|
|
|
|
|
if cc_cnf.vmodel == '': |
|
|
|
vmodel = cake.load_model( |
|
|
|
crust2_profile=crust2x2.get_profile( |
|
|
|
cat[0].lat, cat[0].lon)) |
|
|
|
vmodels = [cake.load_model(crust2_profile=crust2x2.get_profile(st.lat, st.lon)) |
|
|
|
for st in station_list] |
|
|
|
else: |
|
|
|
vmodel = cake.load_model(cc_cnf.vmodel) |
|
|
|
|
|
|
|
for i_ph, phase_name in enumerate(cc_cnf.phase): |
|
|
|
for i_ev, ev in enumerate(cat): |
|
|
|
dists = orthodrome.distance_accurate50m_numpy( |
|
|
|
ev.lat, ev.lon, st_lats, st_lons) |
|
|
|
|
|
|
|
st_lats = num.asarray([st.lat for st in station_list]) |
|
|
|
st_lons = num.asarray([st.lon for st in station_list]) |
|
|
|
for i_st, st in enumerate(station_list): |
|
|
|
dist = dists[i_st] |
|
|
|
|
|
|
|
for i_ev, ev in enumerate(cat): |
|
|
|
dists = orthodrome.distance_accurate50m_numpy( |
|
|
|
ev.lat, ev.lon, st_lats, st_lons) |
|
|
|
if cc_cnf.vmodel == '': |
|
|
|
vmodel = vmodels[i_st] |
|
|
|
else: |
|
|
|
vmodel = vmodel |
|
|
|
|
|
|
|
for i_st, st in enumerate(station_list): |
|
|
|
dist = dists[i_st] |
|
|
|
for i_ph, phase_name in enumerate(cc_cnf.phase): |
|
|
|
if phase_name == 'P' or phase_name == 'p': |
|
|
|
phase_names = ['p', 'P'] |
|
|
|
elif phase_name == 'S' or phase_name == 's': |
|
|
|
phase_names = ['s', 'S'] |
|
|
|
|
|
|
|
arrivals = vmodel.arrivals(distances=[dist*cake.m2d], |
|
|
|
phases=phase_names, |
|
|
|
zstart=ev.depth) |
|
|
@ -207,6 +212,7 @@ def main(): |
|
|
|
az_stats_weights = None |
|
|
|
# print(coef_array.shape) |
|
|
|
# print(weights_array.shape) |
|
|
|
print('Similarity matrix ready.') |
|
|
|
|
|
|
|
n_ph = len(cc_cnf.phase) |
|
|
|
if not ns_cnf.use_precalc_net_sim: |
|
|
@ -227,25 +233,30 @@ def main(): |
|
|
|
fig_name=ns_cnf.method_similarity_computation+str(i_ph)) |
|
|
|
|
|
|
|
|
|
|
|
# make optional combining of P and S results or more methods to combine them |
|
|
|
# in computation of network similarity!!! |
|
|
|
|
|
|
|
|
|
|
|
### clusterinng ### |
|
|
|
''' |
|
|
|
# adjust for one more dimension of network_similarity array |
|
|
|
if cl_cnf.method == 'dbscan': |
|
|
|
|
|
|
|
clustering = cl.cluster_dbscan(cl_cnf.dbscan_eps, |
|
|
|
cl_cnf.dbscan_min_samples, |
|
|
|
network_similarity) |
|
|
|
method_string = '%s_%s' % (ns_cnf.method_similarity_computation, |
|
|
|
cl_cnf.method) |
|
|
|
#cl.write_pretty_output(cat, clustering, method_string) |
|
|
|
cl.cluster_plots(network_similarity, clustering, cat) |
|
|
|
|
|
|
|
for i_ph in range(n_ph): |
|
|
|
|
|
|
|
if cl_cnf.method == 'dbscan': |
|
|
|
clustering = cl.cluster_dbscan(cl_cnf.dbscan_eps, |
|
|
|
cl_cnf.dbscan_min_samples, |
|
|
|
network_similarity[i_ph]) |
|
|
|
method_string = '%s_%s_%s' % (ns_cnf.method_similarity_computation, |
|
|
|
cl_cnf.method, str(i_ph)) |
|
|
|
cl.write_pretty_output(cat, clustering, method_string) |
|
|
|
cl.cluster_plots(network_similarity[i_ph], clustering, cat, method_string) |
|
|
|
|
|
|
|
#for ev, c in zip(cat, clustering): |
|
|
|
# print(util.time_to_str(ev.time)[0:11], ev.magnitude, c) |
|
|
|
''' |
|
|
|
|
|
|
|
|
|
|
|
print('Clusty run completed.') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
main() |
|
|
|
|