fatiando/rockhound

View on GitHub
doc/gallery/slab2.ipynb

Summary

Maintainability
Test Coverage
{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\nSlab2 - A Comprehensive Subduction Zone Geometry Model\n======================================================\n\nSlab2 is a three-dimensional compilation of global subduction geometries,\nseparated into regional models for each major subduction zone.\nMore information at the\n`USGS <https://www.sciencebase.gov/catalog/item/5aa1b00ee4b0b1c392e86467>`__\nwebsite.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import rockhound as rh\nimport matplotlib.pyplot as plt\nimport cmocean\nimport cartopy.crs as ccrs\n\nfrom rockhound.slab2 import ZONES\n\n# Fetch all Slab2 subduction zones and add them inside a list\nsubduction_zones = []\nfor zone in ZONES:\n    subduction_zones.append(rh.fetch_slab2(zone))\n\n# Get min and max values of the subducting plates' depths\nvmax = max([grid.depth.actual_range[1] for grid in subduction_zones])\nvmin = min([grid.depth.actual_range[0] for grid in subduction_zones])\n\n# Plot the depth of each subducting plate inside Slab2 with the same colorscale\nplt.figure(figsize=(10, 5))\nax = plt.axes(projection=ccrs.Robinson())\nfor grid in subduction_zones:\n    pc = grid.depth.plot.pcolormesh(\n        cmap=cmocean.cm.thermal_r,\n        ax=ax,\n        transform=ccrs.PlateCarree(),\n        add_colorbar=False,\n        vmin=vmin,\n        vmax=vmax,\n    )\nax.set_title(\"Slab2: Geometry model for subduction zones\")\nplt.colorbar(\n    pc,\n    ax=ax,\n    label=\"Depth (meters)\",\n    pad=0.05,\n    aspect=40,\n    shrink=0.7,\n    orientation=\"horizontal\",\n)\nax.set_global()\nax.coastlines()\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
}