Skip to main content
Weekly and monthly views of the magnetic field data recorded at each of our stations can be viewed on the respective site pages, listed below. Data recorded by our 3-component fluxgate magnetometers are archived with the IRIS Data Management Center (now under EarthScope Consortium) and can be requested via the FDSN web services API. Note: in order to reconstitute the recorded data from digitised counts to physically meaningful units, you will also need to request the response files (also available via the IRIS DMC) and remove the response from the data. ObsPy provides a suite of tools for data downloading, response removal, and general manipulation of the resulting magnetic field data.
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")