from obspy import Inventory, UTCDateTime
from obspy.clients.fdsn import Client
client = Client("IRIS")
# Get the instrument response inventory for a single station
inventory = Inventory()
inventory += client.get_stations(
network="AV", # CHANGE THIS TO THE NETWORK YOU WANT TO DOWNLOAD FROM
station="CLNE", # CHANGE THIS TO THE STATION YOU WANT TO DOWNLOAD FROM
starttime=UTCDateTime("2022-09-21"), # CHANGE THIS TO THE START TIME YOU WANT TO DOWNLOAD FROM
endtime=UTCDateTime.utcnow(),
level="response",
)
inventory.write("CLNE_mag_response.xml", format="STATIONXML")
# Get a day of waveform data from the data center
stream = client.get_waveforms(
network="AV", # CHANGE THIS TO THE NETWORK YOU WANT TO DOWNLOAD FROM
station="CLNE", # CHANGE THIS TO THE STATION YOU WANT TO DOWNLOAD FROM
location="*",
channel="LF*", # The 'F' here denotes a magnetometer
starttime=UTCDateTime("2022-09-21"),
endtime=UTCDateTime("2022-09-22"),
)
stream.merge(method=-1)
# Write each component to a separate miniSEED file
for component in "ENZ":
component_stream = stream.select(component=component)
component_stream.write(f"AV.CLNE_{component}.m", format="MSEED")