DataAnalysis2022/ObsPy/06_FDSN.ipynb

1 line
9.3 KiB
Plaintext
Raw Normal View History

{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["<div style='background-image: url(\"../share/images/header.svg\") ; padding: 0px ; background-size: cover ; border-radius: 5px ; height: 250px'>\n", " <div style=\"float: right ; margin: 50px ; padding: 20px ; background: rgba(255 , 255 , 255 , 0.7) ; width: 50% ; height: 150px\">\n", " <div style=\"position: relative ; top: 50% ; transform: translatey(-50%)\">\n", " <div style=\"font-size: xx-large ; font-weight: 900 ; color: rgba(0 , 0 , 0 , 0.8) ; line-height: 100%\">ObsPy Tutorial</div>\n", " <div style=\"font-size: large ; padding-top: 20px ; color: rgba(0 , 0 , 0 , 0.5)\">Downloading Data</div>\n", " </div>\n", " </div>\n", "</div>"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Seismo-Live: http://seismo-live.org\n", "\n", "##### Authors:\n", "* Lion Krischer ([@krischer](https://github.com/krischer))\n", "* Tobias Megies ([@megies](https://github.com/megies))\n", "---"]}, {"cell_type": "markdown", "metadata": {}, "source": ["![](images/obspy_logo_full_524x179px.png)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "plt.style.use('ggplot')\n", "plt.rcParams['figure.figsize'] = 12, 8"]}, {"cell_type": "markdown", "metadata": {}, "source": ["ObsPy has clients to directly fetch data via...\n", "\n", "- FDSN webservices (IRIS, Geofon/GFZ, USGS, NCEDC, SeisComp3 instances, ...)\n", "- ArcLink (EIDA, ...)\n", "- Earthworm\n", "- SeedLink (near-realtime servers)\n", "- NERIES/NERA/seismicportal.eu\n", "- NEIC\n", "- SeisHub (local seismological database)\n", "\n", "This introduction shows how to use the FDSN webservice client. The FDSN webservice definition is by now the default web service implemented by many data centers world wide. Clients for other protocols work similar to the FDSN client.\n", "\n", "#### Waveform Data"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from obspy import UTCDateTime\n", "from obspy.clients.fdsn import Client\n", "\n", "client = Client(\"IRIS\")\n", "t = UTCDateTime(\"2011-03-11T05:46:23\") # Tohoku\n", "st = client.get_waveforms(\"II\", \"PFO\", \"*\", \"LHZ\",\n", " t + 10 * 60, t + 30 * 60)\n", "print(st)\n", "st.plot()"]}, {"cell_type": "markdown", "metadata": {}, "source": ["- again, waveform data is returned as a Stream object\n", "- for all custom processing workflows it does not matter if the data originates from a local file or from a web service\n", "\n", "#### Event Metadata\n", "\n", "The FDSN client can also be used to request event metadata:"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["t = UTCDateTime(\"2011-03-11T05:46:23\") # Tohoku\n", "catalog = client.get_events(starttime=t - 100, endtime=t + 24 * 3600,\n", " minmagnitude=7)\n", "print(catalog)\n", "catalog.plot();"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Requests can have a wide range of constraints (see [ObsPy Documentation](http://docs.obspy.org/packages/autogen/obspy.fdsn.client.Client.get_events.html)):\n", "\n", "- time range\n", "- geographical (lonlat-box, circular by distance)\n", "- depth range\n", "- magnitude range, type\n", "- contributing agency"]}, {"cell_type": "markdown", "metadata": {}, "source": ["#### Station Metadata\n", "\n", "Finally, the FDSN client can be used to request station metadata. Stations can be looked up using a wide range of constraints (see [ObsPy documentation](http://docs.obspy.org/packages/autogen/obspy.fdsn.client.Client.get_stations.html)):\n", "\n", " * network/station code\n", " * time range of operation\n", " * geographical (lonlat-box, circular by distance)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["event = catalog[0]\n", "origin = event.origins[0]\n", "\n", "# M\u00fcnster\n", "lon = 7.63\n", "lat = 51.96\n", "\n", "inventory = client.get_st