arviz.sel_utils.xarray_sel_iter — ArviZ dev documentation (original) (raw)
arviz.sel_utils.xarray_sel_iter(data, var_names=None, combined=False, skip_dims=None, reverse_selections=False)[source]#
Convert xarray data to an iterator over variable names and selections.
Iterates over each var_name and all of its coordinates, returning the variable names and selections that allow properly obtain the data from data
as desired.
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 (var_name: str, selection: dict(str, any))
The string is the variable name, the dictionary are coordinate names to values,. To get the values of the variable at these coordinates, dodata[var_name].sel(**selection)
.