AttributeError: 'numpy.ndarray' object has no attribute 'mask'
还没有人认领这个 Issue。
评估
调研方向
从 makesurface/scripts/vectorize_raster.py 开始,重点检查 traceback 行中的 classify,并检查传递 nodata 值的 vectorize 入口点。使用不带 --nodata 的 makesurface vectorize 复现;对于没有 nodata 值的输入,矢量化不再引发报告的 AttributeError 即表示完成。
由索引模型根据 Issue 内容生成。
描述
This error occurs when vectorizing without a nodata value.
Use makesurface vectorize --nodata <value> to avoid the problem.
Related(?): https://github.com/mapbox/make-surface/issues/51 Masked arrays with no nodata
See also (?): https://github.com/mapbox/rasterio/issues/240, https://github.com/mapbox/rasterio/issues/241.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/makesurface", line 9, in <module>
load_entry_point('makesurface==0.2.14.dev0', 'console_scripts', 'makesurface')()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 664, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 644, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 464, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/makesurface/scripts/cli.py", line 42, in vectorize
makesurface.vectorize(infile, outfile, classes, classfile, weight, nodata, smoothing, bidx, carto, axonometrize, nosimple, setnodata, nibble, outvar)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/makesurface/__init__.py", line 4, in vectorize
vectorize_raster.vectorizeRaster(infile, outfile, classes, classfile, weight, nodata, smoothing, bidx, cartoCSS, axonometrize, nosimple, setNoData, nibbleMask, outvar)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/makesurface/scripts/vectorize_raster.py", line 128, in vectorizeRaster
classRas, breaks = classify(inarr, int(classes), weight)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/makesurface/scripts/vectorize_raster.py", line 33, in classify
outRas[np.where(inArr.mask == True)] = 0
AttributeError: 'numpy.ndarray' object has no attribute 'mask'
- 主要语言
- Python
- 星标
- 91
- 派生
- 16
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mapbox/make-surface 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
mapbox/make-surface#92 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
mapbox/make-surface#90 ·
-
难度 2/5 1-3 小时 新手友好度 25/100
mapbox/make-surface#89 ·
-
难度 4/5 3-5 天 新手友好度 25/100
mapbox/make-surface#84 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
mapbox/make-surface#76 ·
查看 mapbox/make-surface 的全部 Issue
相似的 Issue
-
feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 73/100
githubnext/gh-aw-workshop#4455 ·
维护者通常 1 天内回复
-
Triage 🩺
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_wait未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 77/100
krkn-chaos/krkn#1627 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
NousResearch/hermes-agent#136483 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复