{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Seeding from shapefile\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime\nfrom opendrift.models.oceandrift import OceanDrift\n\n\no = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information\no.set_config('environment:fallback:x_wind', -4) # Constant wind drift\no.set_config('environment:fallback:y_wind', 8)\no.set_config('drift:wind_uncertainty', 4) # Adding some diffusion\no.set_config('drift:vertical_mixing', False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seed particles within contours from shapefile\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_from_shapefile(o.test_data_folder() +\n 'shapefile_spawning_areas/Torsk.shp',\n number=2000, layername=None,\n featurenum=[2, 4], time=datetime.utcnow())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(steps=50, time_step=3600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print and plot results\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(o)\no.plot(fast=True)\no.animation(fast=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] } ], "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.11.6" } }, "nbformat": 4, "nbformat_minor": 0 }