Double gyre

Drift in an idealised (analytical) double gyre eddy current field from https://shaddenlab.berkeley.edu/uploads/LCS-tutorial/examples.html

from datetime import datetime, timedelta

from opendrift.readers import reader_double_gyre
from opendrift.models.oceandrift import OceanDrift

o = OceanDrift(loglevel=20)  # Set loglevel to 0 for debug information
o.set_config('environment:fallback:land_binary_mask', 0)
o.set_config('drift:advection_scheme', 'runge-kutta4')

double_gyre = reader_double_gyre.Reader(epsilon=.25, omega=0.628, A=0.1)
print (double_gyre)

o.add_reader(double_gyre)

x = [.9]
y = [.5]
lon, lat = double_gyre.xy2lonlat(x, y)

o.seed_elements(lon, lat, radius=.1, number=5000,
                time=double_gyre.initial_time)

o.run(duration=timedelta(seconds=10), time_step=0.1)
o.animation(buffer=0, hide_landmask=True)

Out:

13:44:51 INFO    opendrift.models.basemodel: OpenDriftSimulation initialised (version 1.7.1 / v1.7.1-87-g074c1d2)
===========================
Reader: double_gyre
Projection:
  +proj=stere +lat_0=0 +lon_0=0 +lat_ts=0 +units=m +a=6.371e+06 +e=0 +no_defs
Coverage: [degrees]
  xmin: 0.000000   xmax: 2.000000
  ymin: 0.000000   ymax: 1.000000
  Corners (lon, lat):
    (  0.00,   0.00)  (  0.00,   0.00)
    (  0.00,   0.00)  (  0.00,   0.00)
Vertical levels [m]:
  Not specified
Available time range:
  start: None   end: None   step: None
Variables:
  x_sea_water_velocity
  y_sea_water_velocity
===========================

13:44:52 INFO    opendrift.models.basemodel: Fallback values will be used for the following variables which have no readers:
13:44:52 INFO    opendrift.models.basemodel:    x_wind: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    y_wind: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    upward_sea_water_velocity: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    ocean_vertical_diffusivity: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    sea_surface_wave_significant_height: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    surface_downward_x_stress: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    surface_downward_y_stress: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    turbulent_kinetic_energy: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    turbulent_generic_length_scale: 0.000000
13:44:52 INFO    opendrift.models.basemodel:    sea_floor_depth_below_sea_level: 10000.000000
13:44:52 INFO    opendrift.models.basemodel: No land reader added, making a temporary landmask reader
13:44:54 INFO    opendrift.models.basemodel: OpenDriftSimulation initialised (version 1.7.1 / v1.7.1-87-g074c1d2)
13:44:54 INFO    opendrift.models.basemodel: All points are in ocean
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00 - step 1 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.100000 - step 2 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.200000 - step 3 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.300000 - step 4 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.400000 - step 5 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.500000 - step 6 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.600000 - step 7 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.700000 - step 8 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.800000 - step 9 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:00.900000 - step 10 of 100 - 5000 active elements (0 deactivated)
13:44:55 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01 - step 11 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.100000 - step 12 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.200000 - step 13 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.300000 - step 14 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.400000 - step 15 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.500000 - step 16 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.600000 - step 17 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.700000 - step 18 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.800000 - step 19 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:01.900000 - step 20 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02 - step 21 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.100000 - step 22 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.200000 - step 23 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.300000 - step 24 of 100 - 5000 active elements (0 deactivated)
13:44:56 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.400000 - step 25 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.500000 - step 26 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.600000 - step 27 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.700000 - step 28 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.800000 - step 29 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:02.900000 - step 30 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03 - step 31 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.100000 - step 32 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.200000 - step 33 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.300000 - step 34 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.400000 - step 35 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.500000 - step 36 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.600000 - step 37 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.700000 - step 38 of 100 - 5000 active elements (0 deactivated)
13:44:57 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.800000 - step 39 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.900000 - step 40 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04 - step 41 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.100000 - step 42 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.200000 - step 43 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.300000 - step 44 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.400000 - step 45 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.500000 - step 46 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.600000 - step 47 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.700000 - step 48 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.800000 - step 49 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.900000 - step 50 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05 - step 51 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.100000 - step 52 of 100 - 5000 active elements (0 deactivated)
13:44:58 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.200000 - step 53 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.300000 - step 54 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.400000 - step 55 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.500000 - step 56 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.600000 - step 57 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.700000 - step 58 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.800000 - step 59 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.900000 - step 60 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06 - step 61 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.100000 - step 62 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.200000 - step 63 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.300000 - step 64 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.400000 - step 65 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.500000 - step 66 of 100 - 5000 active elements (0 deactivated)
13:44:59 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.600000 - step 67 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.700000 - step 68 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.800000 - step 69 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.900000 - step 70 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07 - step 71 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.100000 - step 72 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.200000 - step 73 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.300000 - step 74 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.400000 - step 75 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.500000 - step 76 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.600000 - step 77 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.700000 - step 78 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.800000 - step 79 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.900000 - step 80 of 100 - 5000 active elements (0 deactivated)
13:45:00 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08 - step 81 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.100000 - step 82 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.200000 - step 83 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.300000 - step 84 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.400000 - step 85 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.500000 - step 86 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.600000 - step 87 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.700000 - step 88 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.800000 - step 89 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.900000 - step 90 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09 - step 91 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.100000 - step 92 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.200000 - step 93 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.300000 - step 94 of 100 - 5000 active elements (0 deactivated)
13:45:01 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.400000 - step 95 of 100 - 5000 active elements (0 deactivated)
13:45:02 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.500000 - step 96 of 100 - 5000 active elements (0 deactivated)
13:45:02 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.600000 - step 97 of 100 - 5000 active elements (0 deactivated)
13:45:02 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.700000 - step 98 of 100 - 5000 active elements (0 deactivated)
13:45:02 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.800000 - step 99 of 100 - 5000 active elements (0 deactivated)
13:45:02 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.900000 - step 100 of 100 - 5000 active elements (0 deactivated)
13:45:02 INFO    opendrift.models.basemodel: Saving animation to /root/project/docs/source/gallery/animations/example_double_gyre_0.gif...
13:45:02 INFO    opendrift.models.basemodel: Making animated gif...
MovieWriter imagemagick unavailable; using Pillow instead.
../_images/example_double_gyre_0.gif
o.plot(buffer=0, hide_landmask=True)
OpenDrift - OceanDrift 2000-01-01 00:00 to 2000-01-01 00:00 UTC (101 steps)

Out:

(<GeoAxesSubplot:title={'center':'OpenDrift - OceanDrift\n2000-01-01 00:00 to 2000-01-01 00:00 UTC (101 steps)'}>, <module 'matplotlib.pyplot' from '/opt/conda/envs/opendrift/lib/python3.9/site-packages/matplotlib/pyplot.py'>)

Total running time of the script: ( 0 minutes 38.246 seconds)

Gallery generated by Sphinx-Gallery