Performance of extract_points vs rasterio sample
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- performance
调研方向
Reproduce the comparison using the linked notebook and the Prague DTM, then inspect xvec/accessor.py around lines 1261-1263 where extract_points delegates to sel(method='nearest'). Compare that behavior with rasterio's sample path, and consider the available xarray and rioxarray routes. Done means identifying and documenting a supported approach that materially improves lazy-raster point extraction.
由索引模型根据 Issue 内容生成。
描述
One of the questions in the recent Earthmover's webinar on xvec was about the performance of extract_points compared to rasterio's sample method. I have never tested this before so wanted to give it a go and for a large lazy-loaded raster (digital terrain model), our extract_points is waaaay slower. See https://notebooksharing.space/view/4459f651d27b2f214f8590c30aba0782f7515d4c16b00dcd3283492f19f8e694#displayOptions=
The DTM is from https://geoportalpraha.cz/en/data-and-services/97d2c9c11aa9478cb21b469b8a4f820e in case you'd like to test the same but any raster should do the trick I assume.
Under the hood, extract_points is simply passing the coordinates to .sel with method='nearest', which should be doing exactly the same as rasterio's sample. https://github.com/xarray-contrib/xvec/blob/66b541bd509b4bcaade0bbeed3dd90b852b602a3/xvec/accessor.py#L1261-L1263
This is not optimal.
We could possibly use sample via rioxarray if the raster is loaded via xarray as it is available through dtm_da.rio._manager.acquire().sample(list(zip(x, y))) but that is relying on a private API of rasterio. I'll open an issue there if there's an appetite to expose sample on the rio accessor.
Outside of relying on rasterio, is there a way of speeding it up using some xarray magic?
- 主要语言
- Python
- 星标
- 139
- 派生
- 14
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
xarray-contrib/xvec 的其他 Issue
-
CI
难度 3/5 1-2 天 新手友好度 35/100
xarray-contrib/xvec#145 ·
-
难度 3/5 1-2 天 新手友好度 58/100
xarray-contrib/xvec#141 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
xarray-contrib/xvec#129 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
xarray-contrib/xvec#113 ·
-
难度 4/5 3-5 天 新手友好度 35/100
xarray-contrib/xvec#100 ·
查看 xarray-contrib/xvec 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
instance instance add
难度 2/5 1-3 小时 新手友好度 68/100
searxng/searx-instances#941 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
FluidNumerics/fluid-walk-blocker#89 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复