.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_PO4_distribution.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_auto_examples_plot_PO4_distribution.py: ========================================= Plot 2D transect of tracers in each basin ========================================= This example plots the modelled oxygen distribution in cGENIE. The following features in the package are used: #. Access data through `cgeniepy.model` module #. A basin-mask operation #. A linear interpolation #. Get pretty color palette #. Customise the plotting details .. GENERATED FROM PYTHON SOURCE LINES 20-42 .. image-sg:: /auto_examples/images/sphx_glr_plot_PO4_distribution_001.png :alt: Atlantic, Pacific, Indian :srcset: /auto_examples/images/sphx_glr_plot_PO4_distribution_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/cgeniepy/envs/stable/lib/python3.12/site-packages/cgeniepy/model.py:58: UserWarning: No gemflag is provided, use default gemflags: [biogem] warnings.warn("No gemflag is provided, use default gemflags: [biogem]") | .. code-block:: Python import cgeniepy from cgeniepy.plot import CommunityPalette import matplotlib.pyplot as plt model = cgeniepy.sample_model() fig, axs=plt.subplots(nrows=3, ncols=1, figsize=(6,9), tight_layout=True) basins = ['Atlantic', 'Pacific', 'Indian'] cmap = CommunityPalette('tol_rainbow').colormap for i in range(3): basin_data = model.get_var('ocn_O2').isel(time=-1).mask_basin(base='worjh2',basin=basins[i], subbasin='') basin_data_interp = basin_data.mean(dim='lon').interpolate(grid_number=50).to_GriddedDataVis() basin_data_interp.aes_dict['pcolormesh_kwargs']['cmap'] = cmap basin_data_interp.plot(ax=axs[i], contour=False, outline=True) axs[i].title.set_text(basins[i]) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.608 seconds) .. _sphx_glr_download_auto_examples_plot_PO4_distribution.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_PO4_distribution.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_PO4_distribution.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_PO4_distribution.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_