{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# ROMS native reader\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nfrom opendrift.readers import reader_ROMS_native\nfrom opendrift.models.oceandrift import OceanDrift\n\no = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Creating and adding reader for Nordic 4km current dataset\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "nordic_native = reader_ROMS_native.Reader(o.test_data_folder() +\n '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc')\no.add_reader(nordic_native)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seed elements at defined positions, depth and time\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_elements(lon=12.0, lat=68.3, radius=0, number=10,\n z=np.linspace(0, -150, 10), time=nordic_native.start_time)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(time_step=3600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print and plot results, with lines colored by particle depth\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(o)\no.plot(linecolor='z', fast=True)\n#o.animation()" ] } ], "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 }