Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

AttributeError: 'numpy.ndarray' object has no attribute 'mask'

Open
#91 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
numpy, python
Domain
data

Research direction

Start in makesurface/scripts/vectorize_raster.py, especially classify at the traceback line, and inspect the vectorize entry point that passes the nodata value. Reproduce with makesurface vectorize without --nodata; done means vectorization no longer raises the reported AttributeError for inputs without a nodata value.

Written by the indexing model from the issue text.

Description

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'
Dominant language
Python
Stars
91
Forks
18
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mapbox/make-surface

All issues in mapbox/make-surface

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.