.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_diffusivities.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_gallery_example_diffusivities.py: Vertical diffusivity ==================== .. GENERATED FROM PYTHON SOURCE LINES 8-9 Plot the depth dependence of vertical diffusivity from the various analytical methods .. GENERATED FROM PYTHON SOURCE LINES 9-37 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from opendrift.models.physics_methods import verticaldiffusivity_Sundby1983, verticaldiffusivity_Large1994, verticaldiffusivity_stepfunction depth = np.linspace(0, 60, 100) windspeed = np.arange(0, 20, 5) colors = ['r', 'g', 'b', 'k'] for w, c in zip(windspeed, colors): plt.plot(np.ones(depth.shape)*verticaldiffusivity_Sundby1983(w, depth, 50), depth, c + '-', label='Sundby, wind = %sm MLD=50' % w) plt.plot(verticaldiffusivity_Large1994(w, depth, 50), depth, c + '--', label='Large, wind = %s, MLD=50' % w) plt.plot(verticaldiffusivity_Large1994(w, depth, 20), depth, c + '-.', label='Large, wind = %s, MLD=20' % w) plt.plot(verticaldiffusivity_stepfunction(depth), depth, '-m', label='Stepfunction') plt.xlabel('Vertical diffusivity [m2/s]') plt.ylabel('Depth [m]') plt.gca().set_ylim([0, depth.max()]) plt.gca().set_xlim([0, None]) plt.gca().invert_yaxis() plt.legend() plt.show() .. image-sg:: /gallery/images/sphx_glr_example_diffusivities_001.png :alt: example diffusivities :srcset: /gallery/images/sphx_glr_example_diffusivities_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.190 seconds) .. _sphx_glr_download_gallery_example_diffusivities.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_diffusivities.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_diffusivities.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_