set_units

function of dascore.proc.units source

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

Set the units of a patch’s data or coordinates.

Parameters

Parameter Description
patch The input patch.
data_units New units for the patch data. Accepts both unit and quantity strings.
**kwargs Used to specify new units for any of the patch’s coordinates.

Warning

Old units will be deleted without performing conversions. To convert units see convert_units.

Examples

import dascore as dc
patch = dc.get_example_patch()
# set the data units
patch_with_units = patch.set_units("km/ms")
# set the units of the distance coordinate
patch_feet = patch.set_units(distance='feet')