Constant current

from datetime import datetime, timedelta
from opendrift.models.oceandrift import OceanDrift

o = OceanDrift(loglevel=20)  # Set loglevel to 0 for debug information

Out:

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

Adding no input models, but instead constant northwards current of 1 m/s

o.set_config('environment:fallback:x_sea_water_velocity', 0)
o.set_config('environment:fallback:y_sea_water_velocity', 1)
o.set_config('environment:fallback:land_binary_mask', 0)

Seed elements at defined position and time

o.seed_elements(lon=4.0, lat=60.0, radius=5000, number=100,
                time=datetime(2015, 9, 22, 6, 0, 0))

Running model for 50 hours

o.run(duration=timedelta(hours=50))

Out:

13:51:02 INFO    opendrift.models.basemodel: Fallback values will be used for the following variables which have no readers:
13:51:02 INFO    opendrift.models.basemodel:    x_sea_water_velocity: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    y_sea_water_velocity: 1.000000
13:51:02 INFO    opendrift.models.basemodel:    x_wind: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    y_wind: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    upward_sea_water_velocity: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    ocean_vertical_diffusivity: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    sea_surface_wave_significant_height: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    surface_downward_x_stress: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    surface_downward_y_stress: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    turbulent_kinetic_energy: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    turbulent_generic_length_scale: 0.000000
13:51:02 INFO    opendrift.models.basemodel:    sea_floor_depth_below_sea_level: 10000.000000
13:51:02 INFO    opendrift.models.basemodel: No land reader added, making a temporary landmask reader
13:51:05 INFO    opendrift.models.basemodel: OpenDriftSimulation initialised (version 1.7.1 / v1.7.1-87-g074c1d2)
13:51:05 INFO    opendrift.models.basemodel: All points are in ocean
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 06:00:00 - step 1 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 07:00:00 - step 2 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 08:00:00 - step 3 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 09:00:00 - step 4 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 10:00:00 - step 5 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 11:00:00 - step 6 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 12:00:00 - step 7 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 13:00:00 - step 8 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 14:00:00 - step 9 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 15:00:00 - step 10 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 16:00:00 - step 11 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 17:00:00 - step 12 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 18:00:00 - step 13 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 19:00:00 - step 14 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 20:00:00 - step 15 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 21:00:00 - step 16 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 22:00:00 - step 17 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-22 23:00:00 - step 18 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 00:00:00 - step 19 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 01:00:00 - step 20 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 02:00:00 - step 21 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 03:00:00 - step 22 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 04:00:00 - step 23 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 05:00:00 - step 24 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 06:00:00 - step 25 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 07:00:00 - step 26 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 08:00:00 - step 27 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 09:00:00 - step 28 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 10:00:00 - step 29 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 11:00:00 - step 30 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 12:00:00 - step 31 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 13:00:00 - step 32 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 14:00:00 - step 33 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 15:00:00 - step 34 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 16:00:00 - step 35 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 17:00:00 - step 36 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 18:00:00 - step 37 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 19:00:00 - step 38 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 20:00:00 - step 39 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 21:00:00 - step 40 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 22:00:00 - step 41 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-23 23:00:00 - step 42 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 00:00:00 - step 43 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 01:00:00 - step 44 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 02:00:00 - step 45 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 03:00:00 - step 46 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 04:00:00 - step 47 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 05:00:00 - step 48 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 06:00:00 - step 49 of 50 - 100 active elements (0 deactivated)
13:51:05 INFO    opendrift.models.basemodel: 2015-09-24 07:00:00 - step 50 of 50 - 100 active elements (0 deactivated)

Print and plot results

print(o)
o.plot(fast=True, buffer=1)
OpenDrift - OceanDrift 2015-09-22 06:00 to 2015-09-24 08:00 UTC (51 steps)

Out:

===========================
--------------------
Reader performance:
--------------------
Performance:
    3.5 total time
    0.3 configuration
    2.8 preparing main loop
      2.8 moving elements to ocean
    0.3 main loop
      0.1 readers
        0.1 postprocessing
      0.0 updating elements
    0.0 cleaning up
--------------------
===========================
Model:  OceanDrift     (OpenDrift version 1.7.1)
        100 active Lagrangian3DArray particles  (0 deactivated, 0 scheduled)
-------------------
Environment variables:
  -----
Readers not added for the following variables:
  land_binary_mask
  ocean_vertical_diffusivity
  sea_floor_depth_below_sea_level
  sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment
  sea_surface_wave_period_at_variance_spectral_density_maximum
  sea_surface_wave_significant_height
  sea_surface_wave_stokes_drift_x_velocity
  sea_surface_wave_stokes_drift_y_velocity
  surface_downward_x_stress
  surface_downward_y_stress
  turbulent_generic_length_scale
  turbulent_kinetic_energy
  upward_sea_water_velocity
  x_sea_water_velocity
  x_wind
  y_sea_water_velocity
  y_wind

Time:
        Start: 2015-09-22 06:00:00
        Present: 2015-09-24 08:00:00
        Calculation steps: 50 * 1:00:00 - total time: 2 days, 2:00:00
        Output steps: 51 * 1:00:00
===========================

13:51:05 WARNING opendrift.models.basemodel: Plotting fast. This will make your plots less accurate.

(<GeoAxesSubplot:title={'center':'OpenDrift - OceanDrift\n2015-09-22 06:00 to 2015-09-24 08:00 UTC (51 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 6.073 seconds)

Gallery generated by Sphinx-Gallery