PlasmaCalcs.tools.xarray_tools.xarray_masks.xarray_unmask_vars

PlasmaCalcs.tools.xarray_tools.xarray_masks.xarray_unmask_vars(ds, vars, mask=None, stackdim='_mask_stack', *, store_mask=False, reindex=True, _upcast_bool=True)
unmask multiple variables from a Dataset. returns a Dataset with unmasked vars.
ds: xarray.Dataset
will unmask ds[vars].
vars: str or list of str
variables whose unmasked values should be returned.
if single str, treated as [vars].
mask: None or xarray.DataArray
mask to use. If None, use mask stored in ds[‘_mask’].
store_mask: None or bool
whether to store full mask as a data_var in result.
None –> True if result would otherwise be a Dataset, else False
True –> result will be a Dataset with full mask in data_var ‘_mask’.
False –> do not store mask in result.
stackdim: str, default ‘_mask_stack’
dimension along which the mask stacking occurred.
reindex: bool
whether to result.reindex_like(mask). Highly recommended, but not required…
_upcast_bool: bool
whether to upcast dtype=bool array or data_vars to int8 before unstacking.
when False, unstacking produces a dtype=object array due to the nans for missing values.
(when True, unstacking makes dtype=float32, using 0 for False, 1 for True, nan for nan.)