multimodemodel.Variable

multimodemodel.Variable#

class multimodemodel.Variable(data, grid, time)[source]#

Variable class consisting of the data, a Grid instance and a time stamp.

A Variable object contains the data for a single time slice of a variable as a Array, the grid object describing the grid arrangement and a single time stamp. The data attribute can take the value of None which is treated like an array of zeros when adding the variable to another variable.

Variable implement summation with another Variable object, see Variable.__add__().

Parameters:
  • data (Array, default None) – Array containing a single time slice of a variable. If it is None, it will be interpreted as zero. To ensure a ndarray as return type, use the property safe_data.

  • grid (Grid) – Grid on which the variable is defined.

  • time (datetime64) – Time stamp of the time slice.

Raises:

ValueError – Raised if data.shape does not match grid.shape.

__init__(data, grid, time)#

Initialize Variable object with given data and grid.

Methods

__init__(data, grid, time)

Initialize Variable object with given data and grid.

copy()

Return a copy.

merge(others, merger)

Merge variable.

split(splitter)

Split variable.

Attributes

data

grid

time

as_dataarray

Return variable as xarray.DataArray.

safe_data

Return data or, if it is None, a zero array of appropriate shape.