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)SetUnits
SetUnits(
*args ,
data_units: Any = None,
**kwargs ,
)-> None
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
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return the coordinates and data units with the units set. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| set_units | Set the units of a patch’s data or coordinates. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |