Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null_set_range does not support multi-band tiffs. Results in 'list' object has no attribute 'NoData_Value' error #78

Open
TFenn2 opened this issue Oct 19, 2015 · 2 comments

Comments

@TFenn2
Copy link
Collaborator

TFenn2 commented Oct 19, 2015

Whenever I try to run the null_set_range tool for my data, it throws this error.

Files found which meet all input criteria: 7

Traceback (most recent call last):
File "C:\Users\tefenn\Documents\Fellow\Projects\Texas_Disasters\set_null.py", line 8, in
raster.null_set_range(rast_filelist, high_thresh = 5000, low_thresh = 0, NoData_Value = None)
File "C:\Python27\ArcGISx6410.3\lib\site-packages\dnppy\raster\null_set_range.py", line 30, in null_set_range
rast, meta = to_numpy(rastname)
File "C:\Python27\ArcGISx6410.3\lib\site-packages\dnppy\raster\to_numpy.py", line 78, in to_numpy
mask[numpy_rast != meta.NoData_Value] = False # do not mask
AttributeError: 'list' object has no attribute 'NoData_Value'

This is the script I was running.

from dnppy import time_series
from dnppy import raster
from dnppy import core
mydir = r"C:\Users\tefenn\Documents\Fellow\Projects\Texas_Disasters\data"
rast_filelist = core.list_files(False, mydir, ["tif"], ["ovr","xml"])

raster.null_set_range(rast_filelist, high_thresh = 5000, low_thresh = 0, NoData_Value = None)

@Jwely
Copy link
Member

Jwely commented Oct 19, 2015

If you print your rast_filelist variable, are all the items as you expect? No non-Tiff images?

@Jwely
Copy link
Member

Jwely commented Oct 19, 2015

Ah, In order for that error to occur, it looks like you are probably using multi band tiffs. This null_set_range function does not yet support multi band tiffs (because each band may have a different nodata value, and hence the current set of inputs lead to ambiguous scenarios). I'll add that to the to-do list, it may be possible to get a quick solution up soon.

In the meantime, if it is practical to convert your raster to single band tiffs, that may be the fastest solution.

@Jwely Jwely changed the title null_set_range 'list' object has no attribute 'NoData_Value' null_set_range does not support multi-band tiffs. Results in 'list' object has no attribute 'NoData_Value' error Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants