import dascore as dc
= dc.get_example_patch()
patch # set the data units
= patch.set_units("km/ms")
patch_with_units # set the units of the distance coordinate
= patch.set_units(distance='feet')
patch_feet # remove data units
= patch_with_units.set_units(None) patch_removed_units
set_units
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.