{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Stations to DataFrame\n", "\n", "Station data can be converted to a dataframe using the predefined [DataFrameExtractor](../utils/dataframeextractor.ipynb). This creates an entry for each channel, an inventory with channel information is needed. In the future we hope to make this a bit more general to handle inventories with only station level information." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-02-28T22:20:11.458658Z", "iopub.status.busy": "2024-02-28T22:20:11.458230Z", "iopub.status.idle": "2024-02-28T22:20:13.669197Z", "shell.execute_reply": "2024-02-28T22:20:13.668565Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
networkstationlocationchannelseed_idlatitudelongitudeelevationdepthazimuthdipsample_ratestart_dateend_date
0GRFURHHZGR.FUR..HHZ48.16289911.2752565.00.00.0-90.0100.02006-12-16NaT
1GRFURHHNGR.FUR..HHN48.16289911.2752565.00.00.00.0100.02006-12-16NaT
2GRFURHHEGR.FUR..HHE48.16289911.2752565.00.090.00.0100.02006-12-16NaT
3GRFURBHZGR.FUR..BHZ48.16289911.2752565.00.00.0-90.020.02006-12-16NaT
4GRFURBHNGR.FUR..BHN48.16289911.2752565.00.00.00.020.02006-12-16NaT
\n", "
" ], "text/plain": [ " network station location channel seed_id latitude longitude \\\n", "0 GR FUR HHZ GR.FUR..HHZ 48.162899 11.2752 \n", "1 GR FUR HHN GR.FUR..HHN 48.162899 11.2752 \n", "2 GR FUR HHE GR.FUR..HHE 48.162899 11.2752 \n", "3 GR FUR BHZ GR.FUR..BHZ 48.162899 11.2752 \n", "4 GR FUR BHN GR.FUR..BHN 48.162899 11.2752 \n", "\n", " elevation depth azimuth dip sample_rate start_date end_date \n", "0 565.0 0.0 0.0 -90.0 100.0 2006-12-16 NaT \n", "1 565.0 0.0 0.0 0.0 100.0 2006-12-16 NaT \n", "2 565.0 0.0 90.0 0.0 100.0 2006-12-16 NaT \n", "3 565.0 0.0 0.0 -90.0 20.0 2006-12-16 NaT \n", "4 565.0 0.0 0.0 0.0 20.0 2006-12-16 NaT " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import obspy\n", "\n", "import obsplus\n", "\n", "inv = obspy.read_inventory()\n", "inv_df = obsplus.stations_to_df(inv)\n", "inv_df.head()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.13" } }, "nbformat": 4, "nbformat_minor": 2 }