-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1_mass_download.py
executable file
·126 lines (106 loc) · 4.11 KB
/
1_mass_download.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
###############################################################################
# Description:
# This is for mass downloading the seismic event waveform data
# Central Anatolia from 2013 to 2015
# FDSN web service: AUSPASS, BGR, EMSC, ETH, GEOFON, GEONET, GFZ, ICGC, IESDMC,
# INGV, IPGP, ISC, KNMI, KOERI, LMU, NCEDC, NIEP, NOA, RESIF, RESIFPH5, SCEDC,
# TEXNET, UIB-NORSAR, USGS, USP, ORFEUS, IRIS
###############################################################################
import obspy, os
from obspy.clients.fdsn.mass_downloader import (
RectangularDomain,
Restrictions,
MassDownloader,
)
###############################################################################
# MINLAT = 40.00
# MAXLAT = 41.20
# MINLON = 29.50
# MAXLON = 31.00
MINLAT = 40.00
MAXLAT = 41.20
MINLON = 29.60
MAXLON = 31.00
pre_event_min = 0.5
aft_event_min = 2.5
if os.path.exists("data"):
pass
else:
os.mkdir("data")
if os.path.exists("response"):
pass
else:
os.mkdir("response")
###############################################################################
elf = open("catlog/Poyraz_2015_catlog.par", "r")
el = elf.read().splitlines()
elf.close()
i = 571
while i < len(el):
event = el[i].split()
event_dir = event[0]
ymd = event[1]
hour = event[2]
mini = event[3]
msec = event[4]
lat = event[5]
lon = event[6]
depth = event[7]
origin_time = obspy.UTCDateTime(ymd + " " + hour + ":" + mini + ":" + msec)
# event_dir = ymd + '.' + hour.zfill(2) + '.' + mini.zfill(2)
print("\033[1;34m Start downloading data for a new event \033[0m")
print("event number: " + str(i) + "; " + event_dir)
# Circular domain around the epicenter. This will download all data between
# 70 and 90 degrees distance from the epicenter. This module also offers
# rectangular and global domains. More complex domains can be defined by
# inheriting from the Domain class.
# domain = CircularDomain(latitude=37.52, longitude=143.04,
# minradius=70.0, maxradius=90.0)
# Rectangular domain
domain = RectangularDomain(
minlatitude=MINLAT,
maxlatitude=MAXLAT,
minlongitude=MINLON,
maxlongitude=MAXLON,
)
restrictions = Restrictions(
# Get data from 5 minutes before the event to one hour after the
# event. This defines the temporal bounds of the waveform data.
starttime=origin_time - pre_event_min * 60,
endtime=origin_time + aft_event_min * 60,
# You might not want to deal with gaps in the data. If this setting is
# True, any trace with a gap/overlap will be discarded.
reject_channels_with_gaps=True,
# And you might only want waveforms that have data for at least 95 % of
# the requested time span. Any trace that is shorter than 95 % of the
# desired total duration will be discarded.
minimum_length=0.90,
# No two stations should be closer than 10 km to each other. This is
# useful to for example filter out stations that are part of different
# networks but at the same physical station. Settings this option to
# zero or None will disable that filtering.
minimum_interstation_distance_in_m=1e2,
# Only HH or BH channels. If a station has HH channels, those will be
# downloaded, otherwise the BH. Nothing will be downloaded if it has
# neither. You can add more/less patterns if you like.
channel_priorities=["BH[ENZ]"],
# Location codes are arbitrary and there is no rule as to which
# location is best. Same logic as for the previous setting.
location_priorities=["", "00", "10"],
)
# No specified providers will result in all known ones being queried.
mdl = MassDownloader(
providers=[
"KOERI",
"IRIS",
]
)
# The data will be downloaded to the ``./waveforms/`` and ``./stations/``
# folders with automatically chosen file names.
mdl.download(
domain,
restrictions,
mseed_storage="data/" + event_dir,
stationxml_storage="response/" + event_dir,
)
i = i + 1