예제 #1
0
events = read_event_list('HL201718')
HL_eq = []
for event in events:
    HL_eq.append([event.origins[0].longitude, event.origins[0].latitude])
HL_eq = np.array(HL_eq).T
ax.scatter(HL_eq[0],
           HL_eq[1],
           label='Earthquake',
           transform=ccrs.Geodetic(),
           color='#555555',
           edgecolors='k',
           linewidth=0.3,
           marker='o',
           s=10)

geom = read_geom('HL2017.HYP')
HL_station = []
for k, station in geom.items():
    HL_station.append([
        station['longitude'],
        station['latitude'],
    ])
HL_station = np.array(HL_station).T
ax.scatter(HL_station[0],
           HL_station[1],
           label='HL 2017 station',
           transform=ccrs.Geodetic(),
           color='#b71c1c',
           edgecolors='k',
           marker='v',
           linewidth=0.5,
예제 #2
0
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import argparse
from tqdm import tqdm
from multiprocessing import cpu_count
import tensorflow as tf

from seisnn.io import read_event_list, write_training_dataset, read_geom
from seisnn.pick import get_pick_dict
from seisnn.utils import get_config

print(f'cpu counts: {cpu_count()} threads')

ap = argparse.ArgumentParser()
ap.add_argument('-c', '--catalog', required=True, help='catalog s-file dir', type=str)
ap.add_argument('-g', '--geometry', required=True, help='geometry STATION0.HYP', type=str)
ap.add_argument('-d', '--dataset', required=True, help='output dataset name', type=str)
ap.add_argument('-p', '--pickset', required=True, help='output pickset name', type=str)

args = ap.parse_args()
config = get_config()

geom = read_geom(args.geometry)
events = read_event_list(args.catalog)
pick_dict = get_pick_dict(events)
pick_dict_keys = pick_dict.keys()
for i, key in enumerate(pick_dict_keys):
    tqdm.write(f'station {key}, total: {i + 1}/{len(pick_dict_keys)}, pick counts: {len(pick_dict[key])}')
    with tf.device('/cpu:0'):
        write_training_dataset(pick_dict[key], geom, dataset=args.dataset, pickset=args.pickset)
예제 #3
0
W, E, S, N = 120.1, 120.85, 22.75, 23.25
stamen_terrain = cimgt.Stamen('terrain-background')
fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(1, 1, 1, projection=stamen_terrain.crs)
ax.set_extent([W, E, S, N], crs=ccrs.Geodetic())
ax.add_image(stamen_terrain, 11)

events = read_event_list('MN2016')
MN_eq = []
for event in events:
    MN_eq.append([event.origins[0].longitude, event.origins[0].latitude])
MN_eq = np.array(MN_eq).T
ax.scatter(MN_eq[0], MN_eq[1], label='Earthquake',
           transform=ccrs.Geodetic(), color='#555555', edgecolors='k', linewidth=0.3, marker='o', s=10)

geom = read_geom('MN2016.HYP')
MN_station = []
for k, station in geom.items():
    MN_station.append([station['longitude'], station['latitude'], ])
MN_station = np.array(MN_station).T
ax.scatter(MN_station[0], MN_station[1], label='MN station',
           transform=ccrs.Geodetic(), color='#b71c1c', edgecolors='k', marker='v', linewidth=0.5, s=60)

ax.set_xticks(np.arange(120.25, 120.8, 0.25), crs=ccrs.PlateCarree())
ax.set_yticks(np.arange(22.75, 23.3, 0.25), crs=ccrs.PlateCarree())
lon_formatter = LongitudeFormatter(zero_direction_label=True)
lat_formatter = LatitudeFormatter()
ax.xaxis.set_major_formatter(lon_formatter)
ax.yaxis.set_major_formatter(lat_formatter)
ax.tick_params(labelbottom=True, labeltop=True, labelleft=True, labelright=True,
               bottom=True, top=True, left=True, right=True)