xarray.Dataset.from_array #5768
-
I would be interested in a This would act as a wrapper for Motivation here is a one-line inverse transform of Obviously this has draw backs compared to building up the xarray object using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @raybellwaves, thanks for the suggestion.
I'm a bit confused though - this is already a one-line conversion? You could of course make it neater by locally defining def numpy_array_to_ds(arr, name="arr"):
return xr.DataArray(arr).to_dataset(name=name) I suppose we could perhaps try to further generalise
(FYI the original motivation for |
Beta Was this translation helpful? Give feedback.
Hi @raybellwaves, thanks for the suggestion.
I'm a bit confused though - this is already a one-line conversion? You could of course make it neater by locally defining
I suppose we could perhaps try to further generalise
Dataset.__init__
, although it is already quite a complicated constructor...(FYI the original motivation for
ds.to_numpy()
was situations where you need to strip the array of any other duck-type wrappers, for instance pint units. I feel like that isn…