#!/usr/bin/env python """ Cod egg ============= """ from opendrift.readers import reader_netCDF_CF_generic from opendrift.models.pelagicegg import PelagicEggDrift from datetime import datetime, timedelta o = PelagicEggDrift(loglevel=20) # Set loglevel to 0 for debug information # Forcing with Topaz ocean model and MEPS atmospheric model o.add_readers_from_list([ 'https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml', 'https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc']) #%% # Adjusting some configuration o.set_config('drift:vertical_mixing', True) o.set_config('vertical_mixing:diffusivitymodel', 'windspeed_Sundby1983') # windspeed parameterization for eddy diffusivity #%% # Vertical mixing requires fast time step o.set_config('vertical_mixing:timestep', 60.) # seconds #%% # spawn NEA cod eggs at defined position and time time = datetime.utcnow() o.seed_elements(14. , 68.1, z=-40, radius=2000, number=500, time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25) o.seed_elements(12.5, 68., z=-40, radius=2000, number=500, time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25) o.seed_elements(13.5, 68., z=-40, radius=2000, number=500, time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25) o.seed_elements(13., 67.8, z=-40, radius=2000, number=500, time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25) #%% # Running model o.run(duration=timedelta(hours=48), time_step=3600) #%% # Print and plot results. # At the end the wind vanishes, and eggs come to surface print(o) o.plot(fast=True) o.animation(fast=True, color='z') #%% # .. image:: /gallery/animations/example_codegg_0.gif #%% Vertical distribution of particles o.animate_vertical_distribution() #%% # .. image:: /gallery/animations/example_codegg_1.gif