import dascore as dc
pa = dc.get_example_patch("random_das")
# Get a patch with non-coordinate dimensions
patch = pa.mean()
out = patch.make_broadcastable_to(shape=(2, 3))
assert out.shape == (2, 3)MakeBroadcastableTo
MakeBroadcastableTo(
*args ,
shape: tuple[int, …] ,
drop_coords: bool = False,
)-> None
Stretch a patch until it broadcasts against a shape.
Parameters
| Parameter | Description |
|---|---|
| shape | The new shape the patch should be able to broadcast with. |
| drop_coords |
If True, drop coords that need to be broadcasted up, otherwise only NonCoordinate dimensions can change shape. |
Examples
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return the stretched coordinates, and the shape to stretch to. |
| kernel | Return the data broadcast to the target shape. |
| new | Create new instance with some attributed updated. |
| make_broadcastable_to | Stretch a patch until it broadcasts against a shape. |
| reconcile | Return the result’s metadata once the data are known; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |