convert_units

function of dascore.units source

convert_units(
    data: None ,
    to_units: None | str | pint.registry.Quantity[None, str, Quantity] ,
    from_units: None | str | pint.registry.Quantity[None, str, Quantity] = None,
)-> ‘numeric’

Convert units in array from one type of units to another.

Parameters

Parameter Description
data The data to convert.
to_units The desired units after the conversion
from_units The current units of the data. If None, simply set the units.

Raises

UnitError if conversion is not possible or if the datatype is not compatible (e.g., datetime must always be [time])