coordax.Field.to_xarray¶
- Field.to_xarray() xarray.DataArray[source]¶
Convert this Field to an xarray.DataArray with NumPy array data.
- Returns:
An xarray.DataArray object with the same data as the input coordax.Field. This DataArray will still be wrapping a jax.Array, and have operations implemented on jax.Array objects using the Python Array API interface.
Examples
>>> import coordax as cx >>> import jax.numpy as jnp >>> import numpy as np >>> field = cx.field(jnp.zeros((2, 3)), 'x', 'y') >>> field.to_xarray() <xarray.DataArray (x: 2, y: 3)>... array([[0., 0., 0.], [0., 0., 0.]], dtype=float32) Dimensions without coordinates: x, y