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)
12:51:42 INFO    opendrift.models.basemodel:515: OpenDriftSimulation initialised (version 1.11.13 / v1.11.13-99-gd2132d3)
===========================
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
  sea_water_speed - derived from ['x_sea_water_velocity', 'y_sea_water_velocity']
===========================

12:51:42 INFO    opendrift.models.basemodel.environment:218: Adding a dynamical landmask with max. priority based on assumed maximum speed of 2.0 m/s. Adding a customised landmask may be faster...
12:51:47 INFO    opendrift.models.basemodel.environment:245: Fallback values will be used for the following variables which have no readers:
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_height: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    x_wind: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    y_wind: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    upward_sea_water_velocity: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    ocean_vertical_diffusivity: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_significant_height: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_to_direction: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_peak_period_from_variance_spectral_density: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_significant_height: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_to_direction: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_mean_period: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_significant_height: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    surface_downward_x_stress: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    surface_downward_y_stress: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    turbulent_kinetic_energy: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    turbulent_generic_length_scale: 0.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    ocean_mixed_layer_thickness: 50.000000
12:51:47 INFO    opendrift.models.basemodel.environment:248:    sea_floor_depth_below_sea_level: 10000.000000
12:51:49 INFO    opendrift.models.basemodel:936: Using existing reader for land_binary_mask
12:51:49 INFO    opendrift.models.basemodel:947: All points are in ocean
12:51:49 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00 - step 1 of 100 - 5000 active elements (0 deactivated)
12:51:49 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.100000 - step 2 of 100 - 5000 active elements (0 deactivated)
12:51:49 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.200000 - step 3 of 100 - 5000 active elements (0 deactivated)
12:51:49 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.300000 - step 4 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.400000 - step 5 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.500000 - step 6 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.600000 - step 7 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.700000 - step 8 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.800000 - step 9 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:00.900000 - step 10 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01 - step 11 of 100 - 5000 active elements (0 deactivated)
12:51:50 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.100000 - step 12 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.200000 - step 13 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.300000 - step 14 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.400000 - step 15 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.500000 - step 16 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.600000 - step 17 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.700000 - step 18 of 100 - 5000 active elements (0 deactivated)
12:51:51 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.800000 - step 19 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:01.900000 - step 20 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02 - step 21 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.100000 - step 22 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.200000 - step 23 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.300000 - step 24 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.400000 - step 25 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.500000 - step 26 of 100 - 5000 active elements (0 deactivated)
12:51:52 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.600000 - step 27 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.700000 - step 28 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.800000 - step 29 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:02.900000 - step 30 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03 - step 31 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.100000 - step 32 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.200000 - step 33 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.300000 - step 34 of 100 - 5000 active elements (0 deactivated)
12:51:53 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.400000 - step 35 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.500000 - step 36 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.600000 - step 37 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.700000 - step 38 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.800000 - step 39 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:03.900000 - step 40 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04 - step 41 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.100000 - step 42 of 100 - 5000 active elements (0 deactivated)
12:51:54 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.200000 - step 43 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.300000 - step 44 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.400000 - step 45 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.500000 - step 46 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.600000 - step 47 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.700000 - step 48 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.800000 - step 49 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:04.900000 - step 50 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05 - step 51 of 100 - 5000 active elements (0 deactivated)
12:51:55 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.100000 - step 52 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.200000 - step 53 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.300000 - step 54 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.400000 - step 55 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.500000 - step 56 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.600000 - step 57 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.700000 - step 58 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.800000 - step 59 of 100 - 5000 active elements (0 deactivated)
12:51:56 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:05.900000 - step 60 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06 - step 61 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.100000 - step 62 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.200000 - step 63 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.300000 - step 64 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.400000 - step 65 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.500000 - step 66 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.600000 - step 67 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.700000 - step 68 of 100 - 5000 active elements (0 deactivated)
12:51:57 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.800000 - step 69 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:06.900000 - step 70 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07 - step 71 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.100000 - step 72 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.200000 - step 73 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.300000 - step 74 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.400000 - step 75 of 100 - 5000 active elements (0 deactivated)
12:51:58 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.500000 - step 76 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.600000 - step 77 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.700000 - step 78 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.800000 - step 79 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:07.900000 - step 80 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08 - step 81 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.100000 - step 82 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.200000 - step 83 of 100 - 5000 active elements (0 deactivated)
12:51:59 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.300000 - step 84 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.400000 - step 85 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.500000 - step 86 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.600000 - step 87 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.700000 - step 88 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.800000 - step 89 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:08.900000 - step 90 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09 - step 91 of 100 - 5000 active elements (0 deactivated)
12:52:00 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.100000 - step 92 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.200000 - step 93 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.300000 - step 94 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.400000 - step 95 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.500000 - step 96 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.600000 - step 97 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.700000 - step 98 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.800000 - step 99 of 100 - 5000 active elements (0 deactivated)
12:52:01 INFO    opendrift.models.basemodel:2038: 2000-01-01 00:00:09.900000 - step 100 of 100 - 5000 active elements (0 deactivated)
/opt/conda/envs/opendrift/lib/python3.11/site-packages/cartopy/mpl/geoaxes.py:1692: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
  result = super().scatter(*args, **kwargs)
12:52:04 INFO    opendrift.models.basemodel:4613: Saving animation to /root/project/docs/source/gallery/animations/example_double_gyre_0.gif...
12:53:20 INFO    opendrift.models.basemodel:3037: Time to make animation: 0:01:17.512615
../_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)
(<GeoAxes: title={'center': 'OpenDrift - OceanDrift\n2000-01-01 00:00 to 2000-01-01 00:00 UTC (101 steps)'}>, <Figure size 1100x539.173 with 1 Axes>)

Total running time of the script: (2 minutes 44.324 seconds)

Gallery generated by Sphinx-Gallery