import dascore as dc
meters = dc.get_quantity("m")
accel = dc.get_quantity("m/s^2")
# This can also convert date times.
many_seconds = dc.get_quantity(dc.to_timedelta64(200))get_quantity
get_quantity(
value: str | bytes | pint.registry.Quantity | pint.facets.plain.unit.PlainUnit | numpy.datetime64 | numpy.timedelta64 | int | float | ellipsis | None[str, <class ’bytes, Quantity, PlainUnit, datetime64, timedelta64, int, float, <class ’ellipsis, None] ,
)-> ‘Quantity | None’
Convert a value to a pint quantity.
Returns None for a null-ish input: None, Ellipsis, or the empty string, which is how dascore spells “carries no units”. Callers doing arithmetic on the result have to handle that, since an unset unit reaching a multiplication is a real error rather than a typing one.
Parameters
| Parameter | Description |
|---|---|
| value | The value to convert to a quantity. |