Dimensions
- class deker.dimensions.Dimension(name, size, labels=None, scale=None, **kwargs)
Bases:
SelfLoggerMixin,BaseDimensionDimensionof a grid axes or any other series except time (for time series useTimeDimension).May be used for defining the majority of parameters which may be stored in an array. You can use
labelsorscaleparameter to create a mapping of some names or values to the dimension indexes.- Parameters
name (str) – dimension unique name (e.g. “length”)
size (int) – dimension cells quantity
labels (Optional[Union[Tuple[Union[str, int, float], ...], List[Union[str, int, float]]]]) –
ordered mapping of dimension values names to their indexes
["name1", "name2", ..., "nameN"] ("float1", "float2", ..., "floatN")
scale (Optional[dict]) – a description of dimension regular scale; default None
kwargs (Any) –
- __len__()
Get
Dimensionsize.- Return type
int
- property as_dict: dict
Serialize
Dimensioninto dict.
- property labels: Optional[IndexLabels]
Get
Dimensionlabels.
- property name: str
Get
Dimensionname.
- property size: int
Get
Dimensionsize.
- property step: int
Get
Dimensionstep.
- class deker.dimensions.TimeDimension(name, size, start_value, step)
Bases:
SelfLoggerMixin,BaseDimensionSpecial dimension for time series.
- Parameters
name (str) – dimension name (e.g. “time”)
size (int) – dimension cells quantity
start_value (datetime) – time mark of the first cell (index 0) in dimension
step (timedelta) – a
datetime.timedeltastep ofTimeDimensionseries within the grid
Note
start_valueshall be:either
datetime.datetimeobject with explicittimezoneor
datetime.isoformat()with explicittimezoneor a reference to an array
attributename which shall start with$(attribute name shall be defined without prefix “$”):custom_attributes( {"my_start_value": datetime.datetime(2023, 1, 1, 0, tzinfo=timezone.utc), } TimeDimension(start_value: "$my_start_value", ...)
- __len__()
Get
TimeDimensionsize.- Return type
int
- property as_dict: dict
Serialize
TimeDimensioninto dict.
- property name: str
Get
TimeDimensionname.
- property size: int
Get
TimeDimensionsize.
- property start_value: Union[datetime, str]
Get
TimeDimensionstart value.
- property step: timedelta
Get
TimeDimensionstep.