{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Cross Section Plots\n\nThis example demonstrates contour plots of a cross-sectioned multi-dimensional\ncube which features a hybrid height vertical coordinate system.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nimport iris\nimport iris.plot as iplt\nimport iris.quickplot as qplt\n\n\ndef main():\n    # Load some test data.\n    fname = iris.sample_data_path(\"hybrid_height.nc\")\n    theta = iris.load_cube(fname, \"air_potential_temperature\")\n\n    # Extract a single height vs longitude cross-section. N.B. This could\n    # easily be changed to extract a specific slice, or even to loop over *all*\n    # cross section slices.\n    cross_section = next(\n        theta.slices([\"grid_longitude\", \"model_level_number\"])\n    )\n\n    qplt.contourf(\n        cross_section, coords=[\"grid_longitude\", \"altitude\"], cmap=\"RdBu_r\"\n    )\n    iplt.show()\n\n    # Now do the equivalent plot, only against model level\n    plt.figure()\n\n    qplt.contourf(\n        cross_section,\n        coords=[\"grid_longitude\", \"model_level_number\"],\n        cmap=\"RdBu_r\",\n    )\n    iplt.show()\n\n\nif __name__ == \"__main__\":\n    main()"
      ]
    }
  ],
  "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.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}