PlasmaCalcs.tools.xarray_tools.xarray_dimensions.xarray_assign

PlasmaCalcs.tools.xarray_tools.xarray_dimensions.xarray_assign(array, coords=None, attrs=None, *, name=UNSET, overwrite=None, expand_if_iterable=False)
array.assign_coords(coords).assign_attrs(attrs).rename(name)
coords: None or dict of {dim: coord}
each coord must be “non-iterable”, as per is_iterable_dim(),
unless expand_if_iterable=True.
attrs: None or dict
assign these attrs. dict of arbitrary values.
name: UNSET, None, or str
assign this name to the result, if provided.
overwrite: None or bool
whether to overwrite an existing value for coord in array.
(note - array will never be altered here; only the result might be altered.)
If any coord already in array.coords, behavior depends on overwrite:
None –> crash with DimensionKeyError.
True –> overwrite the coord using the new value.
False –> return array, unchanged.
expand_if_iterable: bool
whether to expand_dims for any iterable coords,
e.g. array.expand_dims(coords) for the relevant coords.