{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Multi seed\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime\nfrom opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.models.openoil import OpenOil\n\no = OpenOil(loglevel=20) # Set loglevel to 0 for debug information\n\n# Arome\nreader_arome = reader_netCDF_CF_generic.Reader(o.test_data_folder() +\n '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')\n\n# Norkyst\nreader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() +\n '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')\n\no.add_reader([reader_norkyst, reader_arome])\no.set_config('processes:evaporation', False)\no.set_config('drift:vertical_mixing', False)\no.set_config('environment:fallback:x_sea_water_velocity', 0)\no.set_config('environment:fallback:y_sea_water_velocity', 0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seed oil particles within contour detected from satellite\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_from_gml(o.test_data_folder() + 'radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml',\n num_elements=2000, origin_marker=0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Additional continous point release, lasting 24 hours\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_elements(3.8, 60.9, radius=0, number=1000, origin_marker=1,\n time=[datetime(2015,11,16,8), datetime(2015,11,17,8)])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Additional cone release (e.g. from moving ship)\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_cone([3.6, 4.4], [61.5, 61.2], radius=[1000, 10000], origin_marker=2,\n number=1000, time=[datetime(2015,11,16,1), datetime(2015,11,16,8)])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(steps=50*4, time_step=900, time_step_output=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, color='origin_marker', legend=['satellite slick', 'continuous point', 'cone'], colorbar=False)" ] }, { "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 }