{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Grid\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nfrom opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.models.oceandrift import OceanDrift\n\no = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information\n\n# Norkyst\nreader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() + '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')\n\no.add_reader(reader_norkyst)\n#o.set_config('environment:fallback:land_binary_mask', 0)\no.set_config('drift:vertical_mixing', False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seeding some particles\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "lons = np.linspace(3.5, 5.0, 100)\nlats = np.linspace(60, 61, 100)\nlons, lats = np.meshgrid(lons, lats)\nlons = lons.ravel()\nlats = lats.ravel()\no.seed_elements(lons, lats, radius=0, number=10000,\n time=reader_norkyst.start_time)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(steps=60*2, time_step=1800, time_step_output=1800)" ] }, { "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.animation(fast=False, corners=[3.5, 5.5, 59.9, 61.2])" ] }, { "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 }