# from __future__ import print_function
%matplotlib inline
import matplotlib.pyplot as plt
#plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = 11, 6
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from IPython.display import Image, display_png
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
cc_data =pd.read_csv("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/BK_201812050418_all.out.qc.csv", sep=",",
names=["eh1_az", "eh2_az","sd","xc","ref_sta", "evid","eq_dist_diff", "eq_az_diff", "target_sta"],header=None)
cc_data_9500 =pd.read_csv("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/BK_201812050418_all.out.qc.9500.csv", sep=",",
names=["eh1_az", "eh2_az","sd","xc","ref_sta", "evid","eq_dist_diff", "eq_az_diff", "target_sta"],header=None)
#print(cc_data)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(cc_data.xc,cc_data.eh1_az, s=(cc_data.xc)*40, alpha=0.5)
plt.xlabel("Cross correlation value", fontsize=16)
plt.ylabel("HHN sensor orientation (degrees)", fontsize=16)
plt.title("Fig.1: HHN sensor orientation as a function of cross-correlation value", fontsize=16)
plt.xlim(1.0,0.0)
plt.ylim(-190,190)
plt.tick_params(labelsize=14)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(cc_data.xc,cc_data.eh1_az, s=(cc_data.xc)*40, alpha=0.5)
plt.xlabel("Cross correlation value", fontsize=16)
plt.ylabel("HHN sensor orientation (degrees)", fontsize=16)
plt.title("Fig. 2: HHN sensor orientation as a function of cross-correlation value", fontsize=16)
plt.xlim(1.0,0.7)
plt.ylim(-30,30)
plt.tick_params(labelsize=14)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(np.abs(cc_data.eq_dist_diff),cc_data.xc, s=(cc_data.xc)*40, alpha=0.5)
plt.xlabel("Diff. station-event distance (km)", fontsize=16)
plt.ylabel("Cross correlation value", fontsize=16)
plt.title("Fig. 3: Cross-correlation value as a function of abs(Diff. station-event distance) ", fontsize=16)
#plt.xlim(1.0,0.7)
#plt.ylim(-30,30)
plt.tick_params(labelsize=14)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(np.abs(cc_data.eq_dist_diff),cc_data.xc, s=(cc_data.xc)*40, alpha=0.5)
plt.xlabel("Diff. station-event distance (km)", fontsize=16)
plt.ylabel("Cross correlation value", fontsize=16)
plt.title("Fig. 4: Cross-correlation value as a function of abs(Diff. station-event distance) ", fontsize=16)
xc9500 = pd.DataFrame({'x': [-999, 999],
'y': [0.95, 0.95]})
plt.plot(xc9500.x, xc9500.y, label = 'High noise model', color='red', linestyle='dashed')
plt.tick_params(labelsize=14)
plt.yticks(np.arange(0, 1.1, step=0.05))
plt.xlim(0,70)
plt.ylim(0.5,1.02)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(np.abs(cc_data.eq_az_diff),cc_data.xc, s=(cc_data.xc)*40, alpha=0.5)
plt.xlabel("Diff. station-event azimuth (deg.)", fontsize=16)
plt.ylabel("Cross correlation value", fontsize=16)
plt.title("Fig. 5: Cross-correlation value as a function of abs(Diff. station-event azimuth) ", fontsize=16)
plt.tick_params(labelsize=14)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(np.abs(cc_data.eq_az_diff),cc_data.xc, s=(cc_data.xc)*40, alpha=0.5)
plt.xlabel("Diff. station-event azimuth (deg.)", fontsize=16)
plt.ylabel("Cross correlation value", fontsize=16)
plt.title("Fig. 6: Cross-correlation value as a function of abs(Diff. station-event azimuth) ", fontsize=16)
xc9500 = pd.DataFrame({'x': [-999, 999],
'y': [0.95, 0.95]})
plt.plot(xc9500.x, xc9500.y, label = 'High noise model', color='red', linestyle='dashed')
plt.xlim(0,1.5)
plt.ylim(0.5,1.02)
plt.yticks(np.arange(0.5, 1.02, step=0.05))
plt.tick_params(labelsize=14)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.scatter(np.abs(cc_data.eq_az_diff),np.abs(cc_data.eq_dist_diff), s=(cc_data.xc)*40, alpha=0.5, label="cc > 0")
ax.scatter(np.abs(cc_data_9500.eq_az_diff),np.abs(cc_data_9500.eq_dist_diff), s=(cc_data.xc)*40, alpha=0.5, label="cc>0.95")
plt.xlabel("Diff. station-event azimuth (deg.)", fontsize=16)
plt.ylabel("Diff. station-event distance (km)", fontsize=16)
plt.title("Fig. 7: CC as function of Diff. station-event distance (km) and abs(Diff. station-event azimuth) ", fontsize=16)
plt.tick_params(labelsize=14)
plt.legend(fontsize=14)
#ax.colorbar() #カラーバーの表示
# png_file: str
print("BK.PINL: Reference sites: BK.CVS,BK.BKS,BK.BDM")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/pinl_40km.png", width=500,))
# png_file: str
print("BK.QRDG: Ref. site BK.CVS and possibly BK.MNRC")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/qrdg_40km.png", width=500,))
# png_file: str
print("BK.SIGP: Ref site. USGS NC.KBO, NC.KSXB broadband sites")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/sigp_40km.png", width=500,))
# png_file: str
print("BK.WEAV: BK.TRIN, BK.WDC (currently no data)")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/weav_40km.png", width=500,))
# png_file: str
print("BK.WSRE: Ref site None")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/wsre_40km.png", width=500,))
# png_file: str
print("BK.KARE: ref site: BK.HELL (currently no data)")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/kare_40km.png", width=500,))
# png_file: str
print("BK.LIND: ref site BK.HELL (currently no data)")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/lind_40km.png", width=500,))
# png_file: str
print("BK.LEGD: no ref site")
display_png(Image("http://ncedc.org/ftp/outgoing/taira/WQC/Two_stationCC/legd_40km.png", width=500,))