arviz_base.ndarray_to_dataarray#
- arviz_base.ndarray_to_dataarray(ary, var_name, *, dims=None, sample_dims=None, coords=None, index_origin=None, skip_event_dims=False, check_conventions=True)[source]#
Convert a numpy array to an xarray.DataArray.
The conversion considers some ArviZ conventions and adds extra attributes, so it is similar to initializing an
xarray.DataArray
but not equivalent.- Parameters:
- aryarray_like
Values for the DataArray object to be created.
- var_namehashable
Name of the created DataArray object.
- dimsiterable of hashable, optional
Dimensions of the DataArray.
- coords
dict
of {hashable: array_like}, optional Coordinates for the dataarray
- sample_dimsiterable of hashable, optional
Dimensions that should be assumed to be present. If missing, they will be added as the dimensions corresponding to the leading axes.
- index_origin
int
, optional Passed to
generate_dims_coords
- skip_event_dimsbool, optional
Passed to
generate_dims_coords
- check_conventionsbool, optional
Check ArviZ conventions. Per the ArviZ schema, some dimension names have specific meaning and there might be inconsistencies caught here in the dimension naming step.
- Returns:
See also