{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Ship drift\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime\nfrom opendrift.models.shipdrift import ShipDrift\n\no = ShipDrift(loglevel=20)\n\no.add_readers_from_list([\n 'https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml',\n 'https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc',\n 'https://thredds.met.no/thredds/dodsC/cmems/mywavewam3km/dataset-wam-arctic-1hr3km-be.ncml'\n ])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seed ship elements at defined position and time\nNote: beam/length ratio is larger than allowed, but is then clipped internally\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_elements(lon=5.0, lat=63.0, radius=1000, number=1000,\n time=datetime.utcnow(),\n length=80.0, beam=20.0, height=9.0, draft=4.0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(steps=24, stop_on_error=True)" ] }, { "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(linecolor='orientation')\n#o.animation(color='orientation', markersize=20, filename=\"orientation.gif\", legend=['left','right'],colorbar=False,cmap='bwr')\no.animation(color='orientation', legend=['left','right'], markersize=20, colorbar=False, cmap='bwr')" ] }, { "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 }