- class tensorstore.Unit
Specifies a physical quantity/unit.
The quantity is specified as the combination of:
A numerical
multiplier
, represented as a double-precision floating-point number. A multiplier of1
may be used to indicate a quanity equal to a single base unit.A
base_unit
, represented as a string. An empty string may be used to indicate a dimensionless quantity. In general, TensorStore does not interpret the base unit string; some drivers impose additional constraints on the base unit, while other drivers may store the specified unit directly. It is recommended to follow the udunits2 syntax unless there is a specific need to deviate.
Objects of this type are immutable.
Constructors¶
-
Unit(multiplier: float =
1
) Constructs a dimension-less quantity of the specified value.
- Unit(multiplier: float, base_unit: str)
Constructs a unit from a multiplier and base unit.
- Unit(*, json: Any)
Constructs a unit from its
JSON representation
.
Accessors¶
- multiplier : float
Multiplier for the
base_unit
.
- to_json() Any
Converts to the
JSON representation
.
Comparison operators¶
Arithmetic operators¶
- __mul__(multiplier: float) Unit
Multiplies this unit by the specified multiplier.
- __truediv__(divisor: float) Unit
Divides this unit by the specified divisor.