conversion_factors

function of dascore.units source

conversion_factors(
    from_units: 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] ,
    to_units: 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] ,
)-> ‘tuple[Any, Any, Any] | None’

Return the factors converting values: (value * mult1 + add) * mult2.

None when there is nothing to convert: from_units is None or already matches to_units.

Raises

UnitError if conversion is not possible.