.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_lake.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_example_lake.py: Caspian / lake =============== .. GENERATED FROM PYTHON SOURCE LINES 6-12 .. code-block:: Python from datetime import datetime, timedelta from opendrift.models.oceandrift import OceanDrift from opendrift.readers import reader_shape import cartopy .. GENERATED FROM PYTHON SOURCE LINES 13-16 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. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python 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. .. GENERATED FROM PYTHON SOURCE LINES 22-23 Disabling the default landmask reader, and using the above reader instead .. GENERATED FROM PYTHON SOURCE LINES 23-32 .. code-block:: Python 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) .. image-sg:: /gallery/images/sphx_glr_example_lake_001.png :alt: OpenDrift - OceanDrift 2025-08-13 08:58 to 2025-08-13 18:58 UTC (11 steps) :srcset: /gallery/images/sphx_glr_example_lake_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 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) (,
) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 30.224 seconds) .. _sphx_glr_download_gallery_example_lake.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_lake.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_lake.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_lake.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_