forked from wmvanstone/RPiShakeCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite_xml.py
19 lines (19 loc) · 1.15 KB
/
write_xml.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Open the read_inventory and UTCDateTime modules from the obspy libraries
from obspy import read_inventory, UTCDateTime
# Set up the list of raspberry shake seismometers
seismometers=['RB5E8','RD93E','R82BD','R7FA5','R0353','R9FEE', 'RAD67','R480A','S4BA9','REE67','R614C','RD232','R6C10','RD884','R0B2D','SDF0E','R92B8']
# add the time of the earthquake
eqtime = '2021-08-14 15:00:06'
# Loop through the seismometers in the list
for seismometer in seismometers:
try:
# Read the inventory information from fdsnws
inventory = read_inventory('https://fdsnws.raspberryshakedata.com/fdsnws/station/1/query?network=AM&station=%s&level=resp&format=xml&nodata=404&starttime=%s'
% (seismometer, str(UTCDateTime(eqtime))))
# set up the name and path of the seismometer .xml file
invfile = "../Data/" + seismometer + ".xml"
# Write the file to disk, in the same folder as the downloaded .mseed data file
inventory.write(invfile,format="STATIONXML")
print("Wrote station.xml file for " + seismometer)
except:
print("Unable to load inventory for " + seismometer)