make_broadcastable_to

function of dascore.proc.coords source

make_broadcastable_to(
    self: Patch ,
    shape: tuple[int, …] ,
    drop_coords = False,
)-> ‘PatchType’

Update the coordiantes of a patch.

Will either add new coordinates, or update existing ones.

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

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)