{"cells":[{"cell_type":"markdown","metadata":{},"source":["<div style='background-image: url(\"../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/Processing Exercise</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":"markdown","metadata":{},"source":["For the this exercise we will download some data from the Tohoku-Oki earthquake, cut out a certain time window around the first arrival and remove the instrument response from the data."]},{"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":["The first step is to download all the necessary information using the ObsPy FDSN client. **Learn to read the documentation!**\n","\n","We need the following things:\n","\n","1. Event information about the Tohoku-Oki earthquake. Use the `get_events()` method of the client. A good provider of event data is the USGS.\n","2. Waveform information for a certain station. Choose your favorite one! If you have no preference, use `II.BFO` which is available for example from IRIS. Use the `get_waveforms()` method.\n","3. Download the associated station/instrument information with the `get_stations()` method."]},{"cell_type":"code","execution_count":null,"metadata":{"lines_to_next_cell":2,"tags":["exercise"]},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"tags":["solution"]},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{},"source":["Have a look at the just downloaded data."]},{"cell_type":"code","execution_count":null,"metadata":{"lines_to_next_cell":2,"tags":["exercise"]},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"tags":["solution"]},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{},"source":["## Exercise\n","\n","The goal of this exercise is to cut the data from 1 minute before the first arrival to 5 minutes after it, and then remove the instrument response.\n","\n","\n","#### Step 1: Determine Coordinates of Station"]},{"cell_type":"code","execution_count":null,"metadata":{"lines_to_next_cell":2,"tags":["exercise"]},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"tags":["solution"]},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{},"source":["#### Step 2: Determine Coordinates of Event"]},{"cell_type":"code","execution_count":null,"metadata":{"lines_to_next_cell":2,"tags":["exercise"]},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"tags":["solution"]},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{},"source":["#### Step 3: Calculate distance of event and station.\n","\n","Use `obspy.geodetics.locations2degree`."]},{"cell_type":"code","execution_count":null,"metadata":{"lines_to_next_cell":2,"tags":["exercise"]},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"tags":["solution"]},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{},"source":["#### Step 4: Calculate Theoretical Arrivals\n","\n","```python\n","from obspy.taup import Tau