doc/gallery/prem.ipynb
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\nPREM: Preliminary Reference Earth Model\n=======================================\n\nThe Preliminary reference Earth model (PREM) [Dziewonsky1981]_ is\na one-dimensional model representing the average Earth properties as a function\nof planetary radius. The model includes the depth, density, seismic\nvelocities, attenuation (Q) and anisotropic parameter ($\\eta$) on the\nboundaries of several Earth layers. The data is loaded into\n:class:`pandas.DataFrame` objects, which can be used to plot and make\ncomputations.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import rockhound as rh\nimport matplotlib.pyplot as plt\n\n# Load PREM into a DataFrame\nprem = rh.fetch_prem()\nprint(prem)\n\n# Plot density and velocities\nfig, axes = plt.subplots(1, 2, figsize=(9, 5), sharey=True)\nfig.suptitle(\"PREM: Preliminary Reference Earth Model\")\nax = axes[0]\nprem.plot(\"density\", \"depth\", legend=False, ax=ax)\nax.invert_yaxis()\nax.set_xlabel(\"Density [g/cm\u00b3]\")\nax.set_ylabel(\"Depth [km]\")\nax.grid()\nax = axes[1]\nfor velocity in [\"Vpv\", \"Vph\", \"Vsv\", \"Vsh\"]:\n prem.plot(velocity, \"depth\", legend=False, ax=ax, label=velocity)\nax.grid()\nax.legend()\nax.set_xlabel(\"Velocity [km/s]\")\nplt.show()"
]
}
],
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}