Double gyre - Lagrangian Coherent Structures

Calculating attracting and repelling LCS for an idealised (analytical) eddy current field.

from datetime import datetime, timedelta
import matplotlib.pyplot as plt

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)

Out:

13:45:34 INFO    opendrift.models.basemodel: OpenDriftSimulation initialised (version 1.7.1 / v1.7.1-87-g074c1d2)

Note that Runge-Kutta here makes a difference to Euler scheme

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)

lcs = o.calculate_ftle(time=double_gyre.initial_time+timedelta(seconds=3),
                       time_step=timedelta(seconds=.5),
                       duration=timedelta(seconds=15),
                       delta=.02)

Out:

===========================
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:45:34 INFO    opendrift.models.basemodel: No reader provided, using first available:
13:45:34 INFO    opendrift.models.basemodel: double_gyre
13:45:34 INFO    opendrift.models.basemodel: Calculating LCS for 2000-01-01 00:00:03
13:45:34 INFO    opendrift.models.basemodel: Nothing to reset
13:45:34 INFO    opendrift.models.basemodel: Fallback values will be used for the following variables which have no readers:
13:45:34 INFO    opendrift.models.basemodel:    x_wind: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    y_wind: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    upward_sea_water_velocity: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    ocean_vertical_diffusivity: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    sea_surface_wave_significant_height: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    surface_downward_x_stress: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    surface_downward_y_stress: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    turbulent_kinetic_energy: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    turbulent_generic_length_scale: 0.000000
13:45:34 INFO    opendrift.models.basemodel:    sea_floor_depth_below_sea_level: 10000.000000
13:45:34 INFO    opendrift.models.basemodel: No land reader added, making a temporary landmask reader
13:45:37 INFO    opendrift.models.basemodel: OpenDriftSimulation initialised (version 1.7.1 / v1.7.1-87-g074c1d2)
13:45:37 INFO    opendrift.models.basemodel: All points are in ocean
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03 - step 1 of 30 - 5000 active elements (0 deactivated)
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.500000 - step 2 of 30 - 5000 active elements (0 deactivated)
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04 - step 3 of 30 - 5000 active elements (0 deactivated)
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.500000 - step 4 of 30 - 5000 active elements (0 deactivated)
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05 - step 5 of 30 - 5000 active elements (0 deactivated)
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.500000 - step 6 of 30 - 5000 active elements (0 deactivated)
13:45:37 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06 - step 7 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.500000 - step 8 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07 - step 9 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.500000 - step 10 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08 - step 11 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.500000 - step 12 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09 - step 13 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.500000 - step 14 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:10 - step 15 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:10.500000 - step 16 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:11 - step 17 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:11.500000 - step 18 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:12 - step 19 of 30 - 5000 active elements (0 deactivated)
13:45:38 INFO    opendrift.models.basemodel: 2000-01-01 00:00:12.500000 - step 20 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:13 - step 21 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:13.500000 - step 22 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:14 - step 23 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:14.500000 - step 24 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:15 - step 25 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:15.500000 - step 26 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:16 - step 27 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:16.500000 - step 28 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:17 - step 29 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: 2000-01-01 00:00:17.500000 - step 30 of 30 - 5000 active elements (0 deactivated)
13:45:39 INFO    opendrift.models.basemodel: Fallback values will be used for the following variables which have no readers:
13:45:39 INFO    opendrift.models.basemodel:    x_wind: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    y_wind: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    upward_sea_water_velocity: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    ocean_vertical_diffusivity: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    sea_surface_wave_significant_height: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    surface_downward_x_stress: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    surface_downward_y_stress: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    turbulent_kinetic_energy: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    turbulent_generic_length_scale: 0.000000
13:45:39 INFO    opendrift.models.basemodel:    sea_floor_depth_below_sea_level: 10000.000000
13:45:39 INFO    opendrift.models.basemodel: Backwards simulation, starting from last seeded element
13:45:39 INFO    opendrift.models.basemodel: No land reader added, making a temporary landmask reader
13:45:42 INFO    opendrift.models.basemodel: OpenDriftSimulation initialised (version 1.7.1 / v1.7.1-87-g074c1d2)
13:45:42 INFO    opendrift.models.basemodel: All points are in ocean
13:45:42 INFO    opendrift.models.basemodel: Backwards simulation, starting at time of last seeded element
13:45:42 INFO    opendrift.models.basemodel: 2000-01-01 00:00:18 - step 1 of 30 - 5000 active elements (0 deactivated)
13:45:42 INFO    opendrift.models.basemodel: 2000-01-01 00:00:17.500000 - step 2 of 30 - 5000 active elements (0 deactivated)
13:45:42 INFO    opendrift.models.basemodel: 2000-01-01 00:00:17 - step 3 of 30 - 5000 active elements (0 deactivated)
13:45:42 INFO    opendrift.models.basemodel: 2000-01-01 00:00:16.500000 - step 4 of 30 - 5000 active elements (0 deactivated)
13:45:42 INFO    opendrift.models.basemodel: 2000-01-01 00:00:16 - step 5 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:15.500000 - step 6 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:15 - step 7 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:14.500000 - step 8 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:14 - step 9 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:13.500000 - step 10 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:13 - step 11 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:12.500000 - step 12 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:12 - step 13 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:11.500000 - step 14 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:11 - step 15 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:10.500000 - step 16 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:10 - step 17 of 30 - 5000 active elements (0 deactivated)
13:45:43 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09.500000 - step 18 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:09 - step 19 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08.500000 - step 20 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:08 - step 21 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07.500000 - step 22 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:07 - step 23 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06.500000 - step 24 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:06 - step 25 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05.500000 - step 26 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:05 - step 27 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04.500000 - step 28 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:04 - step 29 of 30 - 5000 active elements (0 deactivated)
13:45:44 INFO    opendrift.models.basemodel: 2000-01-01 00:00:03.500000 - step 30 of 30 - 5000 active elements (0 deactivated)

These plots should reproduce Mov 12 on this page: https://shaddenlab.berkeley.edu/uploads/LCS-tutorial/examples.html

plt.subplot(2,1,1)
plt.imshow(lcs['RLCS'][0,:,:], interpolation='nearest', cmap='jet', origin='lower')
plt.colorbar()
plt.title('Repelling LCS (forwards)')
plt.subplot(2,1,2)
plt.imshow(lcs['ALCS'][0,:,:], interpolation='nearest', cmap='jet', origin='lower')
plt.colorbar()
plt.title('Attracting LCS (backwards)')
plt.show()
Repelling LCS (forwards), Attracting LCS (backwards)

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

Gallery generated by Sphinx-Gallery