arviz.sel_utils.xarray_var_iter#
- arviz.sel_utils.xarray_var_iter(data, var_names=None, combined=False, skip_dims=None, reverse_selections=False)[source]#
Convert xarray data to an iterator over vectors.
Iterates over each var_name and all of its coordinates, returning the 1d data.
- Parameters
- dataxarray.Dataset
Posterior data in an xarray
- var_namesiterator of strings (optional)
Should be a subset of data.data_vars. Defaults to all of them.
- combinedbool
Whether to combine chains or leave them separate
- skip_dimsset
dimensions to not iterate over
- reverse_selectionsbool
Whether to reverse selections before iterating.
- Returns
- Iterator of (str, dict(str, any), np.array)
The string is the variable name, the dictionary are coordinate names to values, and the array are the values of the variable at those coordinates.