null_set_range does not support multi-band tiffs. Results in 'list' object has no attribute 'NoData_Value' error
TFenn2 opened this issue · 2 comments
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)
If you print your rast_filelist
variable, are all the items as you expect? No non-Tiff images?
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.