{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Macondo\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime, timedelta\nfrom opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.models.openoil import OpenOil" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is a highly simplified 2D simulation, for illustration purpose only\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o = OpenOil(loglevel=20) # Set loglevel to 0 for debug information" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this datasource which does not contain standard_name, we impose a variable mapping\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "reader_globcurrent = None\n\ntry:\n reader_globcurrent = reader_netCDF_CF_generic.Reader(\n 'https://tds0.ifremer.fr/thredds/dodsC/GLOBCURRENT-L4-CUREUL_HS-ALT_SUM-V03.0',\n standard_name_mapping={'eastward_eulerian_current_velocity': 'x_sea_water_velocity',\n 'northward_eulerian_current_velocity': 'y_sea_water_velocity'})\nexcept:\n print('Thredds server not available, cannot run example')\n\nif reader_globcurrent is not None:\n reader_oceanwind = reader_netCDF_CF_generic.Reader('https://tds0.ifremer.fr/thredds/dodsC/CERSAT-GLO-CLIM_WIND_L4-OBS_FULL_TIME_SERIE')\n\n # Add readers\n o.add_reader([reader_globcurrent, reader_oceanwind])\n\n # Seed some particles\n lon = -88.387161; lat = 28.736669 # Macondo location\n starttime = datetime(2010, 4, 21, 6, 0, 0) # 4 hours after explosion\n time = [starttime, starttime + timedelta(hours=24*30)]\n o.seed_elements(lon, lat, radius=0, number=15000, time=time, oil_type='LIGHT LOUISIANNA SWEET, BP')\n\n # Run model\n print(o)\n o.run(duration=timedelta(days=30),\n time_step=timedelta(hours=3),\n time_step_output=timedelta(hours=6))\n\n # Print and plot results\n print(o)\n o.plot(fast=True)\n o.plot_oil_budget()\n o.animation(fast=True)\n o.animation(fast=True, frames = range(0, 120, 4), fps = 1)" ] }, { "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 }