.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/gallery/oceanography/plot_orca_projection.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_gallery_oceanography_plot_orca_projection.py: Tri-Polar Grid Projected Plotting ================================= This example demonstrates cell plots of data on the semi-structured ORCA2 model grid. First, the data is projected into the PlateCarree coordinate reference system. Second four pcolormesh plots are created from this projected dataset, using different projections for the output image. .. GENERATED FROM PYTHON SOURCE LINES 14-60 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_001.png :alt: ORCA2 Data Projected to Mollweide, Sea water potential temperature :srcset: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_001.png :class: sphx-glr-multi-img * .. image-sg:: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_002.png :alt: ORCA2 Data Projected to NorthPolarStereo, Sea water potential temperature :srcset: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_002.png :class: sphx-glr-multi-img * .. image-sg:: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_003.png :alt: ORCA2 Data Projected to Orthographic, Sea water potential temperature :srcset: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_003.png :class: sphx-glr-multi-img * .. image-sg:: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_004.png :alt: ORCA2 Data Projected to PlateCarree, Sea water potential temperature :srcset: /generated/gallery/oceanography/images/sphx_glr_plot_orca_projection_004.png :class: sphx-glr-multi-img .. code-block:: Python import cartopy.crs as ccrs import matplotlib.pyplot as plt import iris import iris.analysis.cartography import iris.plot as iplt import iris.quickplot as qplt def main(): # Load data filepath = iris.sample_data_path("orca2_votemper.nc") cube = iris.load_cube(filepath) # Choose plot projections projections = {} projections["Mollweide"] = ccrs.Mollweide() projections["PlateCarree"] = ccrs.PlateCarree() projections["NorthPolarStereo"] = ccrs.NorthPolarStereo() projections["Orthographic"] = ccrs.Orthographic( central_longitude=-90, central_latitude=45 ) pcarree = projections["PlateCarree"] # Transform cube to target projection new_cube, extent = iris.analysis.cartography.project(cube, pcarree, nx=400, ny=200) # Plot data in each projection for name in sorted(projections): fig = plt.figure() fig.suptitle("ORCA2 Data Projected to {}".format(name)) # Set up axes and title ax = plt.subplot(projection=projections[name]) # Set limits ax.set_global() # plot with Iris quickplot pcolormesh qplt.pcolormesh(new_cube) # Draw coastlines ax.coastlines() iplt.show() if __name__ == "__main__": main() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.189 seconds) .. _sphx_glr_download_generated_gallery_oceanography_plot_orca_projection.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_orca_projection.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_orca_projection.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_