Constant current

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

o = OceanDrift(loglevel=20)  # Set loglevel to 0 for debug information
17:17:50 INFO    opendrift:509: OpenDriftSimulation initialised (version 1.13.0 / v1.13.0-15-g93fccf7)

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))
17:17:50 INFO    opendrift.models.basemodel.environment:206: Adding a dynamical landmask with max. priority based on assumed maximum speed of 2.0 m/s. Adding a customised landmask may be faster...
17:17:54 INFO    opendrift.models.basemodel.environment:233: Fallback values will be used for the following variables which have no readers:
17:17:54 INFO    opendrift.models.basemodel.environment:236:    x_sea_water_velocity: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    y_sea_water_velocity: 1.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_height: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    x_wind: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    y_wind: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    upward_sea_water_velocity: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    ocean_vertical_diffusivity: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wave_significant_height: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_swell_wave_to_direction: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_swell_wave_peak_period_from_variance_spectral_density: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_swell_wave_significant_height: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wind_wave_to_direction: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wind_wave_mean_period: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_surface_wind_wave_significant_height: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    surface_downward_x_stress: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    surface_downward_y_stress: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    turbulent_kinetic_energy: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    turbulent_generic_length_scale: 0.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    ocean_mixed_layer_thickness: 50.000000
17:17:54 INFO    opendrift.models.basemodel.environment:236:    sea_floor_depth_below_sea_level: 10000.000000

Running model for 50 hours

o.run(duration=timedelta(hours=50))
17:17:54 INFO    opendrift:919: Using existing reader for land_binary_mask
17:17:54 INFO    opendrift:930: All points are in ocean
17:17:54 INFO    opendrift:2056: 2015-09-22 06:00:00 - step 1 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 07:00:00 - step 2 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 08:00:00 - step 3 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 09:00:00 - step 4 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 10:00:00 - step 5 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 11:00:00 - step 6 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 12:00:00 - step 7 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 13:00:00 - step 8 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 14:00:00 - step 9 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 15:00:00 - step 10 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 16:00:00 - step 11 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 17:00:00 - step 12 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 18:00:00 - step 13 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 19:00:00 - step 14 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 20:00:00 - step 15 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 21:00:00 - step 16 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 22:00:00 - step 17 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-22 23:00:00 - step 18 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 00:00:00 - step 19 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 01:00:00 - step 20 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 02:00:00 - step 21 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 03:00:00 - step 22 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 04:00:00 - step 23 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 05:00:00 - step 24 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 06:00:00 - step 25 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 07:00:00 - step 26 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 08:00:00 - step 27 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 09:00:00 - step 28 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 10:00:00 - step 29 of 50 - 100 active elements (0 deactivated)
17:17:55 INFO    opendrift:2056: 2015-09-23 11:00:00 - step 30 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 12:00:00 - step 31 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 13:00:00 - step 32 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 14:00:00 - step 33 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 15:00:00 - step 34 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 16:00:00 - step 35 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 17:00:00 - step 36 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 18:00:00 - step 37 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 19:00:00 - step 38 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 20:00:00 - step 39 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 21:00:00 - step 40 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 22:00:00 - step 41 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-23 23:00:00 - step 42 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 00:00:00 - step 43 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 01:00:00 - step 44 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 02:00:00 - step 45 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 03:00:00 - step 46 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 04:00:00 - step 47 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 05:00:00 - step 48 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 06:00:00 - step 49 of 50 - 100 active elements (0 deactivated)
17:17:56 INFO    opendrift:2056: 2015-09-24 07:00:00 - step 50 of 50 - 100 active elements (0 deactivated)
<xarray.Dataset> Size: 715kB
Dimensions:                                                                              (
                                                                                          trajectory: 100,
                                                                                          time: 51)
Coordinates:
  * trajectory                                                                           (trajectory) int64 800B ...
  * time                                                                                 (time) datetime64[ns] 408B ...
Data variables: (12/35)
    status                                                                               (trajectory, time) float32 20kB ...
    moving                                                                               (trajectory, time) float32 20kB ...
    age_seconds                                                                          (trajectory, time) float32 20kB ...
    origin_marker                                                                        (trajectory, time) float32 20kB ...
    lon                                                                                  (trajectory, time) float32 20kB ...
    lat                                                                                  (trajectory, time) float32 20kB ...
    ...                                                                                   ...
    surface_downward_y_stress                                                            (trajectory, time) float32 20kB ...
    turbulent_kinetic_energy                                                             (trajectory, time) float32 20kB ...
    turbulent_generic_length_scale                                                       (trajectory, time) float32 20kB ...
    ocean_mixed_layer_thickness                                                          (trajectory, time) float32 20kB ...
    sea_floor_depth_below_sea_level                                                      (trajectory, time) float32 20kB ...
    land_binary_mask                                                                     (trajectory, time) float32 20kB ...
Attributes: (12/153)
    Conventions:                                                             ...
    standard_name_vocabulary:                                                ...
    featureType:                                                             ...
    title:                                                                   ...
    summary:                                                                 ...
    keywords:                                                                ...
    ...                                                                                                               ...
    geospatial_lon_units:                                                    ...
    geospatial_lon_resolution:                                               ...
    runtime:                                                                 ...
    geospatial_vertical_min:                                                 ...
    geospatial_vertical_max:                                                 ...
    geospatial_vertical_positive:                                            ...


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)
===========================
--------------------
Reader performance:
--------------------
global_landmask
 0:00:00.0  total
 0:00:00.0  preparing
 0:00:00.0  reading
 0:00:00.0  masking
--------------------
Performance:
    6.2 total time
    4.3 configuration
    0.0 preparing main loop
      0.0 moving elements to ocean
    1.8 main loop
      0.0 updating elements
    0.0 cleaning up
--------------------
===========================
Model:  OceanDrift     (OpenDrift version 1.13.0)
        100 active Lagrangian3DArray particles  (0 deactivated, 0 scheduled)
-------------------
Environment variables:
  -----
  land_binary_mask
     1) global_landmask
  -----
Readers not added for the following variables:
  ocean_mixed_layer_thickness
  ocean_vertical_diffusivity
  sea_floor_depth_below_sea_level
  sea_surface_height
  sea_surface_swell_wave_peak_period_from_variance_spectral_density
  sea_surface_swell_wave_significant_height
  sea_surface_swell_wave_to_direction
  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
  sea_surface_wind_wave_mean_period
  sea_surface_wind_wave_significant_height
  sea_surface_wind_wave_to_direction
  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

Discarded readers:

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

17:17:56 WARNING opendrift:2429: Plotting fast. This will make your plots less accurate.

(<GeoAxes: title={'center': 'OpenDrift - OceanDrift\n2015-09-22 06:00 to 2015-09-24 08:00 UTC (51 steps)'}>, <Figure size 622.055x1100 with 1 Axes>)

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

Gallery generated by Sphinx-Gallery