PlasmaCalcs.tools.xarray_tools.xarray_misc.xarray_copy_kw

PlasmaCalcs.tools.xarray_tools.xarray_misc.xarray_copy_kw(array, dims=None, *, name=None, array_to_dataset=False)
return dict of info suitable for creating a similar array or dataset.
result includes dims, coords, and attrs (unchanged, copied).
dims: None, str, or iterable of str
if provided, only include these dims (and related coords) in the result.
Useful if only interested in some of the dims,
e.g. if array has x,y,z,t dims but only want to mimic dims and coords from x,t.
name: None, bool, or str
whether to also include name in result
None –> True if array has name, else False
True –> name = array.name.
str –> name = name.
array_to_dataset: bool
if True, result will be suitable for creating a Dataset based on the input DataArray.
(Equivalent to using dims=[], name=False, and deleting ‘dims’ key from result.)