set_units

function of dascore.proc.units source

set_units(
    self ,
    data_units: Any = None,
    **kwargs ,
)-> ‘Self’

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')

# remove data units
patch_removed_units = patch_with_units.set_units(None)