coordax.Field.broadcast_like

Field.broadcast_like(other: Self | Coordinate) Self[source]

Returns a field broadcasted like other.

Parameters:

other – The field or coordinate to broadcast to.

Returns:

A new Field broadcasted to match other.

Examples

>>> import coordax as cx
>>> import jax.numpy as jnp
>>> field = cx.field(jnp.zeros((2,)), 'x')
>>> other = cx.field(jnp.zeros((2, 3)), 'x', 'y')
>>> field.broadcast_like(other)
<Field dims=('x', 'y') shape=(2, 3) axes={} >