shnitsel._contracts¶
Attributes¶
Classes¶
Functions¶
|
Decorator to add information about required data in an initial argument of a function that can be applied to a Dataset or a DataArray |
Module Contents¶
- _fields = ['to_be', 'dims', 'coords', 'data_vars', 'groupable', 'coords_or_vars', 'name', 'not_dims']¶
- class Needs¶
Bases:
tuple- to_be¶
- dims¶
- coords¶
- data_vars¶
- groupable¶
- coords_or_vars¶
- name¶
- not_dims¶
- T¶
- P¶
- DatasetOrArray¶
- needs(to_be=None, dims=None, coords=None, data_vars=None, groupable=None, coords_or_vars=None, name=None, not_dims=None)¶
Decorator to add information about required data in an initial argument of a function that can be applied to a Dataset or a DataArray
- Parameters:
to_be (Literal['da', 'ds', None] , optional) – Whether the initial argument needs to be a DataArray or a Dataset. Defaults to None.
dims (set[str] | None, optional) – A list of dimensions that need to be present. Defaults to None.
coords (set[str] | None, optional) – A list of coordinates that need to be present. Defaults to None.
data_vars (set[str] | None, optional) – A list of data variables that need to be present. Defaults to None.
groupable (set[str] | None, optional) – A list of coordinates by which the data needs to be groupable. Defaults to None.
coords_or_vars (set[str] | None, optional) – A list of entries that can either be present as a coordinate or a variable. Defaults to None.
name (str | None, optional) – Whether the data needs to have an attribute name set. Defaults to None.
not_dims (set[str] | None, optional) – A list of dimensions that must not be present on the data. Defaults to None.
- Returns:
A descriptor that does not change the method signature but sets a _needs property of the function object for later use.
- Return type:
Callable[[Callable[P,T]], Callable[P,T]]