PANOimagen / batch_hillshader

Plugin to generate a three light exposure hillshade (shaded relief by combining three light exposures)
GNU General Public License v3.0
16 stars 3 forks source link

Python error in QGIS 2.18.19 #3

Closed evanapplegate closed 6 years ago

evanapplegate commented 6 years ago

When I try to run the plugin on a geotiff DEM (both unprojected and projected), it throws the following error. It will generate the intermediate files if I tick that option, but apparently won't combine them. Any ideas?

An error has occurred while executing Python code:

TypeError: unsupported operand type(s) for -: 'int' and 'NoneType' Traceback (most recent call last): File "/Users/admin/.qgis2/python/plugins/batch_hillshader-master/batch_hillshader_dialog.py", line 415, in preparingProcess self.settingProcessParams(full_filename, outPath) File "/Users/admin/.qgis2/python/plugins/batch_hillshader-master/batch_hillshader_dialog.py", line 585, in settingProcessParams out_path) File "/Users/admin/.qgis2/python/plugins/batch_hillshader-master/hillshader_process.py", line 150, in init self.process(dtm_array, no_data_value) File "/Users/admin/.qgis2/python/plugins/batch_hillshader-master/hillshader_process.py", line 217, in process dtm_array, no_data_value) File "/Users/admin/.qgis2/python/plugins/batch_hillshader-master/bandCalc.py", line 54, in merge_arrays eroded_hill = output * ndimage.binary_erosion(dtm_array - no_data_value) TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'

Python version: 2.7.10 (default, Oct 6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] QGIS version: 2.18.19 Las Palmas, exported

Python Path: /Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing /Applications/QGIS.app/Contents/MacOS/../Resources/python /Users/admin/.qgis2/python /Users/admin/.qgis2/python/plugins /Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins /Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7 /Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages /Library/Python/2.7/site-packages/numpy-override /Library/Python/2.7/site-packages/matplotlib-override /Library/Frameworks/GDAL.framework/Versions/2.1/Python/2.7/site-packages /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload /Library/Python/2.7/site-packages /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC /Users/admin/.qgis2//python

JaviBecerra commented 6 years ago

Hi @evanapplegate: From the stacktrace it seems that we are expecting for the raster to have a 'no data value' set. We will take a look at it, actually we need to handle no data values if they are present but it should not be a requirement to have it defined. It would be helpful if you could post one of your dem files (a small one should do) to reproduce your issue and confirm that this is actually the source of your problem.

evanapplegate commented 6 years ago

Here you go, it's an ALOS DSM: https://www.dropbox.com/s/9gkxi0d05w5q3tt/AW3D30_V1_1.AVE.tif?dl=0

JaviBecerra commented 6 years ago

Thanks @evanapplegate! I have committed a fix, that should fix it. Next week we will take a closer look to add some unit tests and upload an updated version to QGis repos. If you are not sure how to update the plugin from source, you can open your geotiff in QGis and save it under other name 'Save as...'. I have tested in QGis 3.2 and the new gif defines the no data value avoiding the current issue, I think it is the standard behaviour in QGis 2.x too. Let us know if you have any additional problems regarding this issue after the update.