{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Caspian / lake\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime, timedelta\nfrom opendrift.models.oceandrift import OceanDrift\nfrom opendrift.readers import reader_shape\nimport cartopy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The default GSHHG landmask reader classifies lakes\n(e.g. Caspian Sea) as land and not water.\nFor simulations in lakes, we can use a custom reader for lakes only.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "level = 'h' # using high resolution coastline\nreader_lakes = reader_shape.Reader.from_shpfiles(\n f'{cartopy.config['data_dir']}/shapefiles/gshhs/{level}/GSHHS_{level}_L2.shp',\n invert=True) # Inverting since inside of polygons is water (lake) and not land." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Disabling the default landmask reader, and using the above reader instead\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o = OceanDrift(loglevel=20)\no.add_reader(reader_lakes)\no.set_config('general:use_auto_landmask', False) # To use custom landmask instead\no.set_config('environment:constant:x_sea_water_velocity', 1)\no.set_config('drift:horizontal_diffusivity', 100)\no.seed_elements(lon=48.819, lat=44.959, radius=5000, number=100, time=datetime.now())\n\no.run(steps=10)\no.plot(fast=False, buffer=2)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.14.2" } }, "nbformat": 4, "nbformat_minor": 0 }