{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Plot a Reference CCF\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# The following two lines are only needed for building this documentation\n# Delete them and run the code in your project folder.\n\nimport os\nif \"SPHINX_DOC_BUILD\" in os.environ or 1:\n os.chdir(r\"C:\\tmp\\MSNOISE_DOC\")\n\n\nimport matplotlib\nmatplotlib.use(\"agg\")\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nfrom pandas.plotting import register_matplotlib_converters\nregister_matplotlib_converters()\n\n\nplt.style.use(\"ggplot\")\n\nfrom msnoise.api import connect, get_results, build_movstack_datelist, get_params, get_t_axis, xr_get_ref\n\n# connect to the database\ndb = connect()\n\n# Obtain a list of dates between ``start_date`` and ``enddate``\nstart, end, datelist = build_movstack_datelist(db)\n\n# Get the list of parameters from the DB:\nparams = get_params(db)\n\n# Get the time axis for plotting the CCF:\ntaxis = get_t_axis(db)\n\n# Get the results for two station, filter id=1, ZZ component, mov_stack=(\"1d\",\"1d\") and stack the results:\nccf = xr_get_ref(\"PF.FJS.00\", \"PF.FOR.00\", \"ZZ\", 1, taxis)\n\n\nccf.plot(figsize=(8,8))\n\n\n#EOF" ] } ], "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.10" } }, "nbformat": 4, "nbformat_minor": 0 }