ChemicalDrift is an OpenDrift module for drift and fate of chemicals. The module is under development within the scope of the Horizon2020 project EMERGE Manuel Aghito. Norwegian Meteorological Institute. 2021. The initial version is based on Radionuclides module by Magne Simonsen

Module Contents



Extending Lagrangian3DArray with specific properties for chemicals


Chemical particle trajectory model based on the OpenDrift framework.

class opendrift.models.chemicaldrift.Chemical(**kwargs)[source]

Bases: opendrift.models.oceandrift.Lagrangian3DArray

Extending Lagrangian3DArray with specific properties for chemicals

Initialises a LagrangianArray with given properties.


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.

class opendrift.models.chemicaldrift.ChemicalDrift(*args, **kwargs)[source]

Bases: opendrift.models.oceandrift.OceanDrift

Chemical particle trajectory model based on the OpenDrift framework.

Developed at MET Norway

Generic module for particles that are subject to vertical turbulent mixing with the possibility for positive or negative buoyancy

Particles could be e.g. oil droplets, plankton, or sediments

Chemical functionality include interactions with solid matter (particles and sediments) through transformation processes, implemented with stochastic approach for speciation.

Under construction.

Initialise OpenDriftSimulation

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 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’)

specie_num2name(self, num)[source]
specie_name2num(self, name)[source]
seed_elements(self, *args, **kwargs)[source]

Seed elements with given position(s), time and properties.

lon: scalar or array

central longitude(s).

lat: scalar or array

central latitude(s).

radius: scalar or array

radius in meters around each lon-lat pair, within which particles will be randomly seeded.

number: integer, total number of particles to be seeded

If number is None, the number of elements is the length of lon/lat or time if these are arrays. Otherwise the number of elements are obtained from the config-default.

time: datenum or list

The time at which particles are seeded/released. If time is a list with two elements, elements are seeded continously from start/first to end/last time. If time is a list with more than two elements, the number of elements is equal to len(time) and are seeded as a time series.

radius_type: string

If ‘gaussian’ (default), the radius is the standard deviation in x-y-directions. If ‘uniform’, elements are spread evenly and always inside a circle with the given radius.


keyword arguments containing properties/attributes and values corresponding to the actual particle type (ElementType). These are forwarded to the ElementType class. All properties for which there are no default value must be specified.

tempcorr(self, mode, DeltaH, T_C, Tref_C)[source]
salinitycorr(self, Setschenow, Temperature, Salinity)[source]

Initialization of background values in the transfer rates 2D array.

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

Calculate terminal velocity for Pelagic Egg

according to S. Sundby (1983): A one-dimensional model for the vertical distribution of pelagic fish eggs in the mixed layer Deep Sea Research (30) pp. 645-661

Method copied from ibm.f90 module of LADIM: Vikebo, F., S. Sundby, B. Aadlandsvik and O. Otteraa (2007), Fish. Oceanogr. (16) pp. 216-228


Pick out the correct row from transfer_rates for each element. Modify the transfer rates according to local environmental conditions


Check if transformation processes shall occur Do transformation (change value of self.elements.specie) Update element properties for the transformed elements

sorption_to_sediments(self, sp_in=None, sp_out=None)[source]

Update Chemical properties when sorption to sediments occurs

desorption_from_sediments(self, sp_in=None, sp_out=None)[source]

Update Chemical properties when desorption from sediments occurs

update_chemical_diameter(self, sp_in=None, sp_out=None)[source]

Update the diameter of the chemicals when specie is changed

bottom_interaction(self, Zmin=None)[source]

Change speciation of chemicals that reach bottom due to settling. particle specie -> sediment specie


Simple method to estimate the resuspension of sedimented particles, checking whether the current speed near the bottom is above a critical velocity Sediment species -> Particle specie


degradation. Test implementations


Update positions and properties of Chemical particles.

write_netcdf_chemical_density_map(self, filename, pixelsize_m='auto', zlevels=None, deltat=None, density_proj=None, llcrnrlon=None, llcrnrlat=None, urcrnrlon=None, urcrnrlat=None, activity_unit=None, time_avg_conc=False, horizontal_smoothing=False, smoothing_cells=0)[source]

Write netCDF file with map of Chemical species densities and concentrations

get_chemical_density_array(self, pixelsize_m, z_array, density_proj=None, llcrnrlon=None, llcrnrlat=None, urcrnrlon=None, urcrnrlat=None, weight=None)[source]

compute a particle concentration map from particle positions Use user defined projection (density_proj=<proj4_string>) or create a lon/lat grid (density_proj=None)

get_pixel_mean_depth(self, lons, lats)[source]
horizontal_smooth(self, a, n=0)[source]
seed_from_STEAM(self, steam, lowerbound=0, higherbound=np.inf, radius=0, scrubber_type='open_loop', chemical_compound='Copper', **kwargs)[source]

Seed elements based on a dataarray with STEAM emission data

steam: dataarray with steam emission data, with coordinates
  • latitude (latitude) float32

  • longitude (longitude) float32

  • time (time) datetime64[ns]

radius: scalar, unit: meters lowerbound: scalar, elements with lower values are discarded