.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_stokesdrift_profiles.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_stokesdrift_profiles.py: Stokes drift vertical profiles ============================== .. GENERATED FROM PYTHON SOURCE LINES 6-13 .. code-block:: Python import numpy as np from opendrift.models.physics_methods import stokes_drift_profile_monochromatic, stokes_drift_profile_exponential, \ stokes_drift_profile_phillips, stokes_drift_profile_windsea_swell, plot_stokes_profile z = np.linspace(0, -10, 1000) .. GENERATED FROM PYTHON SOURCE LINES 14-15 Surface stokes drift and wave conditions .. GENERATED FROM PYTHON SOURCE LINES 15-26 .. code-block:: Python su_surface = .3 sv_surface = .1 Tp = 8 hs = 2 swell_dir_to = 0 # northwards swell_mean_period = 10 # seconds swell_height = 1.5 wind_sea_height = np.sqrt(hs**2 - swell_height**2) wind_sea_mean_dir_to = np.degrees(np.arctan2(su_surface, sv_surface)) + 30 wind_sea_mean_period = 2 # seconds .. GENERATED FROM PYTHON SOURCE LINES 27-28 Plotting profiles of Stokes drift for significant wave heights of 2 meters .. GENERATED FROM PYTHON SOURCE LINES 28-45 .. code-block:: Python su_m, sv_m, ss_m = stokes_drift_profile_monochromatic(su_surface, sv_surface, hs, Tp, z) su_e, sv_e, ss_e = stokes_drift_profile_exponential(su_surface, sv_surface, hs, Tp, z) su_p, sv_p, ss_p = stokes_drift_profile_phillips(su_surface, sv_surface, hs, Tp, z) su_c, sv_c, ss_c = stokes_drift_profile_windsea_swell(su_surface, sv_surface, swell_mean_direction_to=swell_dir_to, swell_mean_period=swell_mean_period, swell_height=swell_height, wind_sea_mean_direction_to=wind_sea_mean_dir_to, wind_sea_mean_period=wind_sea_mean_period, wind_sea_height=wind_sea_height, z=z) profiles = [ {'u': su_m, 'v': sv_m, 'z': z, 'kwargs': {'label': 'Stokes, Monochromatic'}}, {'u': su_e, 'v': sv_e, 'z': z, 'kwargs': {'label': 'Stokes, Exponential'}}, {'u': su_p, 'v': sv_p, 'z': z, 'kwargs': {'label': 'Stokes, Phillips'}}, {'u': su_c, 'v': sv_c, 'z': z, 'kwargs': {'label': 'Stokes, Windsea + Swell'}} ] plot_stokes_profile(profiles, view=['vertical', 'birdseye', 'u', 'v']) .. image-sg:: /gallery/images/sphx_glr_example_stokesdrift_profiles_001.png :alt: example stokesdrift profiles :srcset: /gallery/images/sphx_glr_example_stokesdrift_profiles_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.478 seconds) .. _sphx_glr_download_gallery_example_stokesdrift_profiles.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_stokesdrift_profiles.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_stokesdrift_profiles.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_