import numpy as np
import dascore as dc
pa = dc.get_example_patch()
# Add 1 to all distance coords
new_dist = pa.coords.get_array('distance') + 1
pa2 = pa.update_coords(distance=new_dist)
assert np.allclose(pa2.coords.get_array('distance'), new_dist)UpdateCoords
UpdateCoords(
*args ,
**kwargs ,
)-> None
Update the coordinates of a patch.
Will either add new coordinates, or update existing ones.
Parameters
| Parameter | Description |
|---|---|
| kwargs |
The name of the coordinate (key) and coordinate values. Values can either be a sequence (eg array) or a single int. If an int is used it will create a non-coord. |
Examples
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return the new coordinates; the data they label do not move. |
| new | Create new instance with some attributed updated. |
| update_coords | Update the coordinates of a patch. |
| reconcile | Return the result’s metadata once the data are known; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |