mapbox / make-surface

Vector surfaces creation routines
MIT License
89 stars 18 forks source link

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

Open jdtoy opened 9 years ago

jdtoy commented 9 years ago

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'