.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/oceanography/plot_09_ekman_spiral.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 or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_oceanography_plot_09_ekman_spiral.py: Ekman's spiral (1905) ===================== Nansen saw that drifting Arctic ice moved 20-40 degrees to the right of the wind. Ekman explained it: friction carries the wind's stress down through a rotating ocean, and each layer drags the one below, turned further to the right and slower. The surface current is 45 degrees to the right of the wind, and the net transport is at right angles to it. .. GENERATED FROM PYTHON SOURCE LINES 11-34 .. image-sg:: /api/gallery/oceanography/images/sphx_glr_plot_09_ekman_spiral_001.png :alt: Ekman spiral, 60 N :srcset: /api/gallery/oceanography/images/sphx_glr_plot_09_ekman_spiral_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.atmosphere import coriolis_parameter from earthsciencekit.oceanography import ekman_spiral_velocity, ekman_transport stress, density, viscosity = 0.1, 1025, 0.02 f = coriolis_parameter(np.radians(60)) depth = np.linspace(0, 400, 4001) velocity = ekman_spiral_velocity(depth, stress, density, viscosity, f) assert np.isclose(np.degrees(np.arctan2(velocity[0, 1], velocity[0, 0])), 45) assert np.isclose(np.trapezoid(velocity[:, 1], depth), ekman_transport(stress, density, f), rtol=1e-4) fig, ax = plt.subplots() ax.plot(velocity[:, 1], velocity[:, 0]) for z in [0, 10, 20, 40, 80]: i = np.searchsorted(depth, z) ax.annotate(f"{z} m", velocity[i, ::-1], textcoords="offset points", xytext=(4, 4), fontsize=8) ax.plot([0, velocity[i, 1]], [0, velocity[i, 0]], color="0.6", lw=0.6) ax.set(xlabel="current to the right of the wind [m/s]", ylabel="downwind current [m/s]", aspect="equal", title="Ekman spiral, 60 N") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.077 seconds) .. _sphx_glr_download_api_gallery_oceanography_plot_09_ekman_spiral.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/oceanography/plot_09_ekman_spiral.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_09_ekman_spiral.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_09_ekman_spiral.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_09_ekman_spiral.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_