Caspian / lake

from datetime import datetime, timedelta
from opendrift.models.oceandrift import OceanDrift
from opendrift.readers import reader_shape
import cartopy

The default GSHHG landmask reader classifies lakes (e.g. Caspian Sea) as land and not water. For simulations in lakes, we can use a custom reader for lakes only.

level = 'h'  # using high resolution coastline
reader_lakes = reader_shape.Reader.from_shpfiles(
    f'{cartopy.config['data_dir']}/shapefiles/gshhs/{level}/GSHHS_{level}_L2.shp',
    invert=True)  # Inverting since inside of polygons is water (lake) and not land.

Disabling the default landmask reader, and using the above reader instead

o = OceanDrift(loglevel=20)
o.add_reader(reader_lakes)
o.set_config('general:use_auto_landmask', False)  # To use custom landmask instead
o.set_config('environment:constant:x_sea_water_velocity', 1)
o.set_config('drift:horizontal_diffusivity', 100)
o.seed_elements(lon=48.819, lat=44.959, radius=5000, number=100, time=datetime.now())

o.run(steps=10)
o.plot(fast=False, buffer=2)
OpenDrift - OceanDrift 2025-08-13 08:58 to 2025-08-13 18:58 UTC (11 steps)
08:58:21 INFO    opendrift:513: OpenDriftSimulation initialised (version 1.14.2 / v1.14.2-108-gbbc988b)
08:58:21 INFO    opendrift.models.basemodel.environment:229: Fallback values will be used for the following variables which have no readers:
08:58:21 INFO    opendrift.models.basemodel.environment:232:    y_sea_water_velocity: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    sea_surface_height: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    x_wind: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    y_wind: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    upward_sea_water_velocity: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    ocean_vertical_diffusivity: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    sea_surface_wave_significant_height: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    ocean_mixed_layer_thickness: 50.000000
08:58:21 INFO    opendrift.models.basemodel.environment:232:    sea_floor_depth_below_sea_level: 10000.000000
08:58:21 INFO    opendrift:1733: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False]
08:58:21 INFO    opendrift:1733: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False]
08:58:21 INFO    opendrift:1744: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous']))
08:58:21 INFO    opendrift:1744: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous']))
08:58:21 INFO    opendrift:1752: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True]
08:58:21 INFO    opendrift:899: Using existing reader for land_binary_mask to move elements to ocean
08:58:21 INFO    opendrift.readers.reader_shape:149: Building KDTree from 6601 geometries with buffer distance 0.000000e+00
08:58:26 INFO    opendrift:2036: 2025-08-13 08:58:21.232251 - step 1 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 09:58:21.232251 - step 2 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 10:58:21.232251 - step 3 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 11:58:21.232251 - step 4 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 12:58:21.232251 - step 5 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 13:58:21.232251 - step 6 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 14:58:21.232251 - step 7 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 15:58:21.232251 - step 8 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 16:58:21.232251 - step 9 of 10 - 100 active elements (0 deactivated)
08:58:26 INFO    opendrift:2036: 2025-08-13 17:58:21.232251 - step 10 of 10 - 100 active elements (0 deactivated)

(<GeoAxes: title={'center': 'OpenDrift - OceanDrift\n2025-08-13 08:58 to 2025-08-13 18:58 UTC (11 steps)'}>, <Figure size 1100x755.105 with 1 Axes>)

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

Gallery generated by Sphinx-Gallery