{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Compare\n\nComparing two oil drift simulation runs, with and without wind\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import timedelta\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 atmospheric model\nreader_arome = reader_netCDF_CF_generic.Reader(o.test_data_folder() +\n '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')\n# Norkyst ocean model\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])\n\n# Seeding some particles\nlon = 4.5; lat = 60.0; # Outside Bergen\ntime = [reader_arome.start_time,\n reader_arome.start_time + timedelta(hours=30)]\no.seed_elements(lon, lat, radius=50, number=5000, time=time,\n oil_type='GENERIC HEAVY CRUDE',\n wind_drift_factor=0.03) # 3% wind drift\n\n# Running model\no.run(steps=66, time_step=1800, time_step_output=3600)\n\n# Second run, for comparison\no2 = OpenOil(loglevel=20) # Set loglevel to 0 for debug information\no2.add_reader([reader_norkyst, reader_arome])\no2.seed_elements(lon, lat, radius=50, number=5000, time=time,\n oil_type='GENERIC HEAVY CRUDE',\n wind_drift_factor=0.0) # No wind drift\no2.run(steps=66, time_step=1800, time_step_output=3600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Animate and compare the two runs.\nWe see that there is much more stranding of oil when wind is considered.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.animation(fast=True, compare=o2,\n legend=['Current + 3 % wind drift', 'Current only'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.plot(fast=True, compare=o2,\n legend=['Current + 3 % wind drift', 'Current only'])" ] } ], "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 }