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('environment:constant: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 2026-05-11 12:22 to 2026-05-11 22:22 UTC (11 steps)
12:22:59 INFO    opendrift:568: OpenDriftSimulation initialised (version 1.14.9 / v1.14.9-47-gbdbbf88)
12:22:59 INFO    opendrift.models.basemodel.environment:227: Fallback values will be used for the following variables which have no readers:
12:22:59 INFO    opendrift.models.basemodel.environment:230:    y_sea_water_velocity: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    sea_surface_height: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    x_wind: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    y_wind: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    upward_sea_water_velocity: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    ocean_vertical_diffusivity: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    sea_surface_wave_significant_height: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    ocean_mixed_layer_thickness: 50.000000
12:22:59 INFO    opendrift.models.basemodel.environment:230:    sea_floor_depth_below_sea_level: 10000.000000
12:22:59 INFO    opendrift:1894: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False]
12:22:59 INFO    opendrift:1894: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False]
12:22:59 INFO    opendrift:1905: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous']))
12:22:59 INFO    opendrift:1905: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous']))
12:22:59 INFO    opendrift:1913: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True]
12:22:59 INFO    opendrift:947: Using existing reader for land_binary_mask to move elements to ocean
12:22:59 INFO    opendrift.readers.reader_shape:149: Building KDTree from 6601 geometries with buffer distance 0.000000e+00
12:23:04 INFO    opendrift:2202: 2026-05-11 12:22:59.658382 - step 1 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 13:22:59.658382 - step 2 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 14:22:59.658382 - step 3 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 15:22:59.658382 - step 4 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 16:22:59.658382 - step 5 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 17:22:59.658382 - step 6 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 18:22:59.658382 - step 7 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 19:22:59.658382 - step 8 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 20:22:59.658382 - step 9 of 10 - 100 active elements (0 deactivated)
12:23:04 INFO    opendrift:2202: 2026-05-11 21:22:59.658382 - step 10 of 10 - 100 active elements (0 deactivated)

(<GeoAxes: title={'center': 'OpenDrift - OceanDrift\n2026-05-11 12:22 to 2026-05-11 22:22 UTC (11 steps)'}>, <Figure size 1100x755.105 with 1 Axes>)

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

Gallery generated by Sphinx-Gallery