opendrift.models.shipdrift

Module Contents

Classes

ShipObject

Extending LagrangianArray with variables relevant for leeway objects.

ShipDrift

Demonstration trajectory model based on OpenDrift framework.

opendrift.models.shipdrift.logger
class opendrift.models.shipdrift.ShipObject(**kwargs)[source]

Bases: opendrift.elements.LagrangianArray

Extending LagrangianArray with variables relevant for leeway objects.

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.shipdrift.ShipDrift(*args, **kwargs)[source]

Bases: opendrift.models.basemodel.OpenDriftSimulation

Demonstration trajectory model based on OpenDrift framework.

Simply advects a particle (passive tracer with no properties except for position) with the ambient wind.

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
required_variables
max_speed = 2
winwav_angle = 20
seed_elements(self, *args, **kwargs)[source]

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

Arguments:
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.

kwargs:

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.

update(self)[source]

Any trajectory model implementation must define an update method. This method must/can use environment data (self.environment) to update properties (including position) of its particles (self.elements)

import_ascii_format(self, filename)[source]