Simple numpy operations with xarray dataarray #6254
-
Hi, I wanted to do the following simple numpy difference operations using xarray dataarray:
However, I get the following error: I can resolve the issue if I use ds2.values but that would mean loading the data into memory. I don't want to do that because the actual dataarray is much bigger (out-of-memory). The idea is to apply a chain of functions to my bigger dataarray using dask's client.submit function. Is there a better way of doing this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @gewitterblitz, would you mind posting a minimal reproducible example please? I ask because when I try to recreate your differencing operation it works as expected: In [1]: import xarray as xr
In [2]: import numpy as np
In [3]: da = xr.DataArray(np.arange(10))
In [4]: da[2:-1] - da[1:-2]
Out[4]:
<xarray.DataArray (dim_0: 7)>
array([1, 1, 1, 1, 1, 1, 1])
Dimensions without coordinates: dim_0 and I don't have enough information from your post to recreate your |
Beta Was this translation helpful? Give feedback.
-
Hi @TomNicholas, thanks for your reply. Here you go!
|
Beta Was this translation helpful? Give feedback.
Hi @TomNicholas, thanks for your reply. Here you go!