coordax.Field.order_as

Field.order_as(*axis_order: str | Coordinate | EllipsisType) Field[source]

Returns a field with the axes in the given order.

Parameters:

*axis_order – The desired order of axes, specified by name or coordinate. ... may be used once, to indicate all other dimensions in order of appearance on this array.

Returns:

A new Field with the axes permuted to match the requested order.

Examples

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