opendrift.models.oceandrift

Attributes

logger

Classes

Lagrangian3DArray

Extending LagrangianArray for elements moving in 3 dimensions

OceanDrift

Open source buoyant particle trajectory model based on OpenDrift.

Module Contents

opendrift.models.oceandrift.logger
class opendrift.models.oceandrift.Lagrangian3DArray(**kwargs)[source]

Bases: opendrift.elements.LagrangianArray

Extending LagrangianArray for elements moving in 3 dimensions The Particle may be buoyant and/or subject to vertical mixing buoyant bahaviour is described by terminal velocity

Initialises a LagrangianArray with given properties.

Args:

Keyword arguments (kwargs) with names corresponding to the OrderedDict ‘variables’ of the class, and corresponding values. The values must be ndarrays of equal length, or scalars. All (or none) variables must be given, unless a default value is specified in the OrderedDict ‘variables’ An empty object may be created by giving no input.

variables
class opendrift.models.oceandrift.OceanDrift(*args, **kwargs)[source]

Bases: opendrift.models.basemodel.OpenDriftSimulation

Open source buoyant particle trajectory model based on OpenDrift.

Developed at MET Norway

Generic module for particles that move in 3 dimensions and may be to vertical turbulent mixing with the possibility for positive or negative buoyancy

Particles could be e.g. oil droplets, plankton, nutrients or sediments, Model may be subclassed for more specific behaviour.

Initialise OpenDriftSimulation

Args:
seed: integer or None. A given integer will yield identical

random numbers drawn each simulation. Random numbers are e.g. used to distribute particles spatially when seeding, and may be used by modules (subclasses) for e.g. diffusion. Specifying a fixed value (default: 0) is useful for sensitivity tests. With seed = None, different random numbers will be drawn for subsequent runs, even with identical configuration/input.

iomodule: name of module used to export data

default: netcdf, see opendrift.io for more alternatives. iomodule is module/filename without preceeding io_

loglevel: set to 0 (default) to retrieve all debug information.

Provide a higher value (e.g. 20) to receive less output. Use the string ‘custom’ to configure logging from outside.

logtime: if True, a time stamp is given for each logging line.

logtime can also be given as a python time specifier (e.g. ‘%H:%M:%S’)

ElementType

Any trajectory model implementation must define an ElementType.

required_variables

Any trajectory model implementation must list needed variables.

update()[source]

Update positions and properties of elements.

simulate_trajectories(outfile, trajectories, number=1, wind_drift_factors=None, current_drift_factors=None, time_step=None, time_step_output=None, simulation_duration=None, simulation_interval=None)[source]
wind_drift_factor_from_trajectory_lw(drifters, wind_drift_factors, simulation_length, simulation_interval)[source]

Perform simulations and use skillscore to optimize wind_drift_factor

drifters: list of dictionaries with numpy arrays of ‘lon’ and ‘lat’

and list of datetimes

wind_drift_factors: the wind_drift_factors to use for simulations/optimalizations

machine_learning_correction()[source]
disable_vertical_motion()[source]

Deactivate any vertical processes/advection

update_terminal_velocity(Tprofiles=None, Sprofiles=None, z_index=None)[source]

Calculate terminal velocity due to bouyancy from own properties and environmental variables. Sub-modules should overload this method for particle-specific behaviour

prepare_vertical_mixing()[source]
prepare_run()[source]
vertical_advection()[source]

Move particles vertically according to vertical ocean current

Vertical advection by ocean currents is normally small compared to termical velocity

vertical_buoyancy()[source]

Move particles vertically according to their buoyancy

surface_stick()[source]

To be overloaded by subclasses, e.g. downward mixing of oil

bottom_interaction(Zmin=None)[source]

To be overloaded by subclasses, e.g. radionuclides in sediments

surface_wave_mixing(time_step_seconds)[source]

To be overloaded by subclasses, e.g. downward mixing of oil

get_diffusivity_profile(model, depths)[source]
vertical_mixing(store_depths=False)[source]

Mix particles vertically according to eddy diffusivity and buoyancy

Buoyancy is expressed as terminal velocity, which is the steady-state vertical velocity due to positive or negative buoyant behaviour. It is usually a function of particle density, diameter, and shape.

Vertical particle displacemend du to turbulent mixing is calculated using a random walk scheme” (Visser et al. 1996)

animate_vertical_distribution(depths=None, maxdepth=None, bins=50, filename=None, subsamplingstep=1)[source]

Function to animate vertical distribution of particles bins: number of bins in the histogram maxdepth: maximum depth subsamplingstep: speed-up the generation of the animation reducing the number of output frames fasterwriter: speed-up the writing to outpute file

plot_vertical_distribution(maxdepth=None, bins=None, maxnum=None)[source]

Function to plot vertical distribution of particles

maxdepth: maximum depth considered for the profile bins: number of bins between surface and maxdepth maxnum: range of bars in histogram is [0,maxnum]

plotter_vertical_distribution_time(ax=None, mask=None, dz=1.0, maxrange=-100, bins=None, step=1)[source]

Function to plot vertical distribution of particles.

Use mask to plot any selection of particles.