convert_units

function of dascore.proc.units source

convert_units(
    patch: Patch ,
    data_units: str | pint.registry.Quantity | pint.registry.Unit | None[str, Quantity, Unit, None] = None,
    **kwargs ,
)-> ‘PatchType’

Convert the patch data or coordinate units.

Preform proper conversions from one unit to another, changing patch data and dimension labels to the new unit specified. If the data or coordinates whose units are to be converted are not set, the new units will simply be set without performing any conversions.

See also set_units and simplify_units

Parameters

Parameter Description
data_units If provided, new units for the patch data.
**kwargs Used to specify the new units of the coordinates.

Raises

UnitError if any of the new units are not compatible with the old units.