#!/usr/bin/env python
import matplotlib.pyplot as plt
from array_plotting import plotting

fig = plt.figure()
ax = fig.add_subplot(111)
p = plotting(ax)

help(p)
Exemple #2
0
    window=[t_min, t_max],
    Boots=Boots,
    epsilon=epsilon,
    slow_vec_error=slow_vec_error,
    Filter=False,
)

# df = pd.DataFrame({"Slow_x":All_Thresh_Peaks_arr[:,0], "Slow_y":All_Thresh_Peaks_arr[:,1], "Labels":new_labels})

# plot!
with PdfPages(Res_dir +
              f"Clustering_Summary_Plot_{fmin:.2f}_{fmax:.2f}.pdf") as pdf:
    # clusters
    fig = plt.figure(figsize=(10, 8))
    ax1 = fig.add_subplot(111)
    p = plotting(ax=ax1)

    p.plot_clusters_XY(
        labels=new_labels,
        tp=Lin_Mean,
        peaks=All_Thresh_Peaks_arr,
        sxmin=x_min,
        sxmax=x_max,
        symin=y_min,
        symax=y_max,
        sstep=s_space,
        title="Clusters",
        predictions=predictions,
        ellipse=True,
        std_devs=[1, 2, 3],
    )
Exemple #3
0
    action="store",
)
args = parser.parse_args()
filepath = args.file_path

# read in the SAC files
st = obspy.read(filepath)

fig = plt.figure(figsize=(6, 6))

# need to give a projection for the cartopy package
# to work. See a list here:
# https://scitools.org.uk/cartopy/docs/latest/crs/projections.html
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())

p = plotting(ax=ax)
p.plot_stations(st)
ax.gridlines(
    crs=ccrs.PlateCarree(),
    draw_labels=True,
    linewidth=0,
    color="gray",
    alpha=0.5,
    linestyle="--",
)

fig = plt.figure(figsize=(6, 6))
ax = fig.add_subplot(111, projection=ccrs.Robinson())

p = plotting(ax=ax)
p.plot_paths(st)
Exemple #4
0
    filepath=filepath,
    st=st,
    peaks=slow_vec_obs,
    prediction=pred_file,
    phase=phase,
    time_window=window,
)

print(st)

# plot!

with PdfPages(Res_dir + f"TP_Summary_Plot_{fmin:.2f}_{fmax:.2f}.pdf") as pdf:
    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_subplot(111)
    p = plotting(ax=ax)

    p.plot_TP_XY(
        tp=Plot_arr,
        peaks=peaks,
        sxmin=sx_min_plot,
        sxmax=sx_max_plot,
        symin=sy_min_plot,
        symax=sy_max_plot,
        sstep=s_space,
        contour_levels=20,
        title="%s Plot" % Stack_type,
        predictions=predictions,
        log=False,
    )
    pdf.savefig()
header = "event centroid_lo centroid_la, n_stations, stations\n"

with open(Res_file, 'w') as w_file:
    w_file.write(header)

try:
    st = obspy.read(filepath)

    final_centroids, lats_lons_use, lats_lons_core, stations_use = c.break_sub_arrays(
        st=st, min_stat=min_stat, min_dist=min_dist, spacing=spacing)

    fig = plt.figure(figsize=(10, 8), tight_layout=True)

    ax1 = fig.add_subplot(111, projection=ccrs.Robinson())

    p = plotting(ax1)
    p.plot_stations(st)

    print(lats_lons_use)

    use_tree = BallTree(lats_lons_use,
                        leaf_size=lats_lons_use.shape[0] / 2,
                        metric='haversine')
    with open(Res_file, 'a') as a_file:

        for i, centroid in enumerate(final_centroids):

            lat_centre = np.around(centroid[0], 2)
            lon_centre = np.around(centroid[1], 2)
            sub_array = use_tree.query_radius(X=[centroid], r=min_dist)[0]
            print(lon_centre, lat_centre)
Exemple #6
0
                                                     mode='constant')

# Ok! Now find the top 2 peaks using the findpeaks function.
peaks_auto = c.findpeaks_XY(Array=smoothed_arr,
                            xmin=slow_x_min,
                            xmax=slow_x_max,
                            ymin=slow_y_min,
                            ymax=slow_y_max,
                            xstep=s_space,
                            ystep=s_space,
                            N=2)
print('peaks:\n', peaks_auto)

fig = plt.figure(figsize=(10, 5))
ax = fig.add_subplot(121)
p = plotting(ax)

# plot to see if they're any good.
p.plot_TP_XY(tp=PWS_arr,
             peaks=peaks_auto,
             sxmin=slow_x_min,
             sxmax=slow_x_max,
             symin=slow_y_min,
             symax=slow_y_max,
             sstep=s_space,
             contour_levels=50,
             title="PWS Plot",
             predictions=predictions,
             log=False)

slow_min = float(S) - 2