PlasmaCalcs.tools.xarray_tools.xarray_coords.xarray_fill_coords

PlasmaCalcs.tools.xarray_tools.xarray_coords.xarray_fill_coords(array, dim=None, *, need=None)
return copy of array with coords filled for indicated dims.
(if all indicated dims have coords already, return original array, not a copy.)
E.g. array with dim_1 length 50 but no coords
–> result is just like array but has dim_1 coords = np.arange(50)
dim: None, str, or iterable of strs
dims for which to consider filling coords. None –> array.dims.
need: None, str, or iterable of str or None
coords which the result must contain.
if any of these look like ‘{coord}_index’, ‘log_{coord}’, or ‘str_{coord}’,
create them via xarray_index_coords, xarray_log_coords, or xarray_str_coords.