Open gdkrmr opened 4 years ago
hmmm ... do you know how memory allocation is performed when reading these arrays? could be that there lies the problem with xtensor-r.
hmm. the other potential problem could be that R uses col-major and xtensor by default uses row-major? Not sure about zarr.
I think zarr can be both, but z5 currently only supports row major. If this is a problem, why does
transform(xarray.begin(), xarray.end(), rarray.begin(), [](auto x){ return x; });
work fine?
I am writing a package to read
zarr
arrays (https://zarr.readthedocs.io/en/stable/) inR
. For this I am using thez5
headers (https://github.com/constantinpape/z5/tree/master/include/z5) andxtensor-r
.z5
includes facilities to read data intoxarray
s (https://github.com/constantinpape/z5/blob/master/include/z5/multiarray/xtensor_access.hxx).I have tried reading data directly into
rarrays
(https://github.com/gdkrmr/zarr-R/blob/31c4176bcba8b841080d56abed231d2c8f773cd3/src/xtensor-write.cpp#L156) but this failed when reading in entire chunks. Reading into anxarray
and then copying into anrarray
works fine.My question is if this is a bug or if I tried to use
rarray
s in a way I was not supposed to.CC: @constantinpape
The related issue can be found here: https://github.com/gdkrmr/zarr-R/issues/12