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-10-02 15:18 to 2025-10-03 01:18 UTC (11 steps)
15:18:54 INFO    opendrift:569: OpenDriftSimulation initialised (version 1.14.3 / v1.14.3-21-g8f1ec61)
15:18:54 INFO    opendrift.models.basemodel.environment:229: Fallback values will be used for the following variables which have no readers:
15:18:54 INFO    opendrift.models.basemodel.environment:232:    y_sea_water_velocity: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    sea_surface_height: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    x_wind: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    y_wind: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    upward_sea_water_velocity: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    ocean_vertical_diffusivity: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    sea_surface_wave_significant_height: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    ocean_mixed_layer_thickness: 50.000000
15:18:54 INFO    opendrift.models.basemodel.environment:232:    sea_floor_depth_below_sea_level: 10000.000000
15:18:54 INFO    opendrift:1779: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False]
15:18:54 INFO    opendrift:1779: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False]
15:18:54 INFO    opendrift:1790: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous']))
15:18:54 INFO    opendrift:1790: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous']))
15:18:54 INFO    opendrift:1798: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True]
15:18:54 INFO    opendrift:945: Using existing reader for land_binary_mask to move elements to ocean
15:18:54 INFO    opendrift.readers.reader_shape:149: Building KDTree from 6601 geometries with buffer distance 0.000000e+00
15:18:59 INFO    opendrift:2086: 2025-10-02 15:18:54.467102 - step 1 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 16:18:54.467102 - step 2 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 17:18:54.467102 - step 3 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 18:18:54.467102 - step 4 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 19:18:54.467102 - step 5 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 20:18:54.467102 - step 6 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 21:18:54.467102 - step 7 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 22:18:54.467102 - step 8 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-02 23:18:54.467102 - step 9 of 10 - 100 active elements (0 deactivated)
15:18:59 INFO    opendrift:2086: 2025-10-03 00:18:54.467102 - step 10 of 10 - 100 active elements (0 deactivated)

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

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

Gallery generated by Sphinx-Gallery