{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Constant current\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime, timedelta\nfrom opendrift.models.oceandrift import OceanDrift\n\no = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Adding no input models, but instead constant northwards current of 1 m/s\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.set_config('environment:fallback:x_sea_water_velocity', 0)\no.set_config('environment:fallback:y_sea_water_velocity', 1)\no.set_config('environment:fallback:land_binary_mask', 0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seed elements at defined position and time\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_elements(lon=4.0, lat=60.0, radius=5000, number=100,\n time=datetime(2015, 9, 22, 6, 0, 0))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model for 50 hours\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(duration=timedelta(hours=50))" ] }, { "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, buffer=1)" ] } ], "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 }