:py:mod:`opendrift.models.model_template` ========================================= .. py:module:: opendrift.models.model_template .. autoapi-nested-parse:: This file is a template for an ocean trajectory model to be implemented within the OpenDrift framework. To create a new model, make a copy (renamed) of this file, and modify the class names and details below, according to the comments. Alternatively, another existing class can be used as a starting point. For more help, see https://opendrift.github.io/writing_a_new_model.html For usage of the new model, see example scripts. First we define an element type to be used by the trajectory model. An element type (class) may also be imported/reused from another module - see examples in the folder "elements" Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: opendrift.models.model_template.TemplateElementType opendrift.models.model_template.ModelTemplate .. py:class:: TemplateElementType(**kwargs) Bases: :py:obj:`opendrift.models.oceandrift.Lagrangian3DArray` Extending LagrangianArray with relevant properties. 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. .. py:attribute:: variables .. py:class:: ModelTemplate(*args, **kwargs) Bases: :py:obj:`opendrift.models.oceandrift.OceanDrift` Open source trajectory model based on the OpenDrift framework. This is a template model, to be copied and modified according to need. This class is a subclass of "OceanDrift", and thus inherits all its functionality. More specialised models may also be subclassed. 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 :py:mod:`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') .. py:attribute:: ElementType .. py:attribute:: required_variables .. py:method:: update() Update positions and properties of particles. .. py:method:: prepare_run() Code to be run before a simulation loop (``update()``) .. py:method:: bottom_interaction(seafloor_depth) Sub method of vertical_mixing, determines settling