1 line
15 KiB
Plaintext
1 line
15 KiB
Plaintext
|
{"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)\">Handling Waveform Data</div>\n", " </div>\n", " </div>\n", "</div>"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Seismo-Live: http://seismo-live.org\n", "\n", "##### Authors:\n", "* Tobias Megies ([@megies](https://github.com/megies))\n", "* Lion Krischer ([@krischer](https://github.com/krischer))\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": ["<img src=\"images/Stream_Trace.svg\" width=90%>\n", "\n", "* read waveform data is returned as a **`Stream`** object."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from obspy import read\n", "st = read(\"./data/waveform_PFO.mseed\", format=\"mseed\")\n", "print(st)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["- UNIX wildcards can be used to read multiple files simultaneously\n", "- automatic file format detection, no need to worry about file formats\n", "\n", " - currently supported: **mseed, sac, segy, seg2, gse1/2, seisan, sh, datamark, css, wav, y, Q (keeps growing...)**\n", " - more file formats are included whenever a basic reading routine is provided (or e.g. sufficient documentation on data compression etc.)\n", " - custom user-specific file formats can be added (through plugin) to filetype autodiscovery in local ObsPy installation by user"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from obspy import read\n", "st = read(\"./data/waveform_*\")\n", "print(st)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["- for MiniSEED files, only reading short portions of files without all of the file getting read into memory is supported (saves time and memory when working on large collections of big files)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from obspy import UTCDateTime\n", "\n", "t = UTCDateTime(\"2011-03-11T05:46:23.015400Z\")\n", "st = read(\"./data/waveform_*\", starttime=t + 10 * 60, endtime=t + 12 * 60)\n", "print(st)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["#### The Stream Object\n", "\n", " - A Stream object is a collection of Trace objects"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from obspy import read\n", "st = read(\"./data/waveform_PFO.mseed\")\n", "print(type(st))"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["print(st)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["print(st.traces)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["print(st[0])"]}, {"cell_type": "markdown", "metadata": {}, "source": ["- More traces can be assembled using **`+`** operator (or using the `.append()` and `.extend()` methods)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["st1 = read(\"./data/waveform_PFO.mseed\")\n", "st2 = read(\"./data/waveform_PFO_synthetics.mseed\")\n", "\n", "st = st1 + st2\n", "print(st)\n", "\n", "st3 = read(\"./data
|