finam.Info#

class finam.Info(time=None, grid=None, meta=None, mask=Mask.FLEX, **meta_kwargs)[source]#

Bases: object

Data info containing grid specification and metadata

Parameters:
  • time (datetime or None, optional) – time specification, default: None

  • grid (Grid or NoGrid or None, optional) – grid specification, default: None

  • meta (dict, optional) – dictionary of metadata, default: None

  • mask (Mask value or valid boolean mask for Masked arrays, optional) –

    masking specification of the data. Options:
    • Mask.FLEX: data can be masked or unmasked (default)

    • Mask.NONE: data is unmasked and given as plain numpy array

    • valid boolean mask for MaskedArray

  • **meta_kwargs – additional metadata by name, will overwrite entries in meta

Variables:
  • grid (Grid or NoGrid or None) – grid specification

  • meta (dict) – dictionary of metadata

Attributes:
fill_value

Fill value for masked data.

grid

Grid: data grid.

grid_shape

tuple: shape of the data grid.

is_masked

bool: whether data is set to be masked.

mask

Mask or ndarray: data mask.

time

datetime: current time.

Methods

accepts(incoming, fail_info[, ...])

Tests whether this info can accept/is compatible with an incoming info.

as_dict()

Returns a dict containing all metadata in this Info.

copy()

Copies the info object

copy_with([use_none])

Copies the info object and sets variables and meta values according to the kwargs

property time#

current time.

Type:

datetime

property grid#

data grid.

Type:

Grid

property mask#

data mask.

Type:

Mask or ndarray

property grid_shape#

shape of the data grid.

Type:

tuple

property is_masked#

whether data is set to be masked.

Type:

bool

property fill_value#

Fill value for masked data.

copy()[source]#

Copies the info object

copy_with(use_none=True, **kwargs)[source]#

Copies the info object and sets variables and meta values according to the kwargs

Parameters:
  • use_none (bool) – whether properties with None value should also be transferred

  • **kwargs – key values pairs for properties to change

accepts(incoming, fail_info, incoming_donwstream=False)[source]#

Tests whether this info can accept/is compatible with an incoming info.

Tested attributes are: “grid”, “mask” and “units”

Parameters:
  • incoming (Info) – Incoming/source info to check. This is the info from upstream.

  • fail_info (dict) – Dictionary that will be filled with failed properties; name: (source, target).

  • incoming_donwstream (bool, optional) – Whether the incoming info is from downstream data. Default: False

Returns:

Whether the incoming info is accepted

Return type:

bool

as_dict()[source]#

Returns a dict containing all metadata in this Info.