You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was recently comparing the performance of point sampling from a raster in xvec (xarray-contrib/xvec#81) and learned that when using xarray's sel, the sampling is about 40x slower than if I use rasterio's sample method (see the notebook in the linked issue).
I can possibly use sample from the rasterio object available within the rio._manager as list(dtm_da.rio._manager.acquire().sample(list(zip(x, y)))) but that is using a private API of rioxarray.
Would it be in scope to expose sample directly on the rio accessor? We could then consume it in xvec when dealing with rioxarray-backed DataArrays.
The text was updated successfully, but these errors were encountered:
rio._manager is something that is easily lost after performing operations on the DataArray|Dataset and is only available when the DataArray|Dataset is opened with rioxarray.open_rasterio or when using engine="rasterio". Unfortunately, due to these limitations, exposing sample on the rio accessor would likely cause confusion as it would not always work as expected.
I would be interested to know if this method is any faster.
Using the DTM from the notebook above, the trip via MemoryFile takes 36s, about 4x more than using the built-in sel method of xarray, so there's no point in doing that.
It seems that exposing rasterio's sample is not a feasible option. Thanks anyway!
I was recently comparing the performance of point sampling from a raster in xvec (xarray-contrib/xvec#81) and learned that when using xarray's
sel
, the sampling is about 40x slower than if I use rasterio'ssample
method (see the notebook in the linked issue).I can possibly use
sample
from the rasterio object available within therio._manager
aslist(dtm_da.rio._manager.acquire().sample(list(zip(x, y))))
but that is using a private API of rioxarray.Would it be in scope to expose
sample
directly on therio
accessor? We could then consume it in xvec when dealing with rioxarray-backed DataArrays.The text was updated successfully, but these errors were encountered: