{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# CMEMS\n\nThis example runs an OceanDrift simulation\nwith current data from CMEMS\nTo run this example, you need a CMEMS account created at\nhttps://marine.copernicus.eu\nwith username and password stored in a ``.netrc`` file with contents::\n\n machine copernicusmarine login password \n\nThis file must be stored in your home folder (and unreadable by others) or in the main OpenDrift folder\n\nAlternatively, an Xarray dataset can be created explicitly with the copernicusmarine client, and provided to reader_netCDF_CF_generic:\nhttps://opendrift.github.io/gallery/example_long_cmems_new.html\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime, timedelta\nfrom opendrift.models.oceandrift import OceanDrift\n\nlon = 4.8; lat = 60 # Bergen, Norway\nlon = -89; lat = 29.8 # New Orleans\nlon = 107; lat = 10 # Ho Chi Minh\nlon = 123; lat = -16.3 # Australia\n\n\no = OceanDrift()\n\no.add_readers_from_list(['cmems_mod_glo_phy_anfc_merged-uv_PT1H-i'])\n\no.seed_elements(lon=lon, lat=lat, number=5000, radius=1000, time=datetime.utcnow())\no.run(duration=timedelta(days=3))\n\no.animation(fast=True, clabel='Ocean current [m/s]',\n background=['x_sea_water_velocity', 'y_sea_water_velocity'])" ] }, { "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 }