EnMAP-Box / enmap-box

EnMAP-Box source code repository. See https://enmap-box.readthedocs.io for documentation
GNU General Public License v3.0
35 stars 16 forks source link

Raster Math IndexError: list index out of range #601

Closed KhalilM94 closed 1 year ago

KhalilM94 commented 1 year ago

I get the following error whenever I want to make an operation over a raster. Any idea how to resolve this?

QGIS version: 3.32.2-Lima
Qt version: 5.15.8
Python version: 3.11.5
GDAL version: 3.7.1
GEOS version: 3.12.0-CAPI-1.18.0
PROJ version: Rel. 9.2.1, June 1st, 2023
PDAL version: 2.5.6 (git-version: Release)
Algorithm started at: 2023-09-06T15:14:47
Algorithm 'Raster math' starting…
Input parameters:
{ 'R1' : None, 'R10' : None, 'R2' : None, 'R3' : None, 'R4' : None, 'R5' : None, 'R6' : None, 'R7' : None, 'R8' : None, 'R9' : None, 'RS' : None, 'V1' : None, 'V10' : None, 'V2' : None, 'V3' : None, 'V4' : None, 'V5' : None, 'V6' : None, 'V7' : None, 'V8' : None, 'V9' : None, 'code' : '# __03_29_strip_2240911_composite := QgsRasterLayer("/Volumes/LUCAMARRONE/2019-03-29_strip_2240911_composite.tif")\n__03_29_strip_2240911_composite / 1000', 'floatInput' : True, 'grid' : None, 'monolithic' : False, 'outputRaster' : 'TEMPORARY_OUTPUT', 'overlap' : None }

Traceback (most recent call last):
File "/Users/khalilmisbah/.local/lib/python3.11/site-packages/typeguard/__init__.py", line 1033, in wrapper
retval = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/algorithm/rastermathalgorithm/rastermathalgorithm.py", line 270, in processAlgorithm
writers = self.makeWriter(code, filename, grid, readers, readers2, floatInput, feedback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/.local/lib/python3.11/site-packages/typeguard/__init__.py", line 1033, in wrapper
retval = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/algorithm/rastermathalgorithm/rastermathalgorithm.py", line 353, in makeWriter
writer = driver.createLike(grid, dataType, bandCount)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/.local/lib/python3.11/site-packages/typeguard/__init__.py", line 1033, in wrapper
retval = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/driver.py", line 100, in createLike
raster2 = self.create(dataType, provider.xSize(), provider.ySize(), nBands, provider.extent(), provider.crs())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/.local/lib/python3.11/site-packages/typeguard/__init__.py", line 1033, in wrapper
retval = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/driver.py", line 53, in create
info = f'Create Raster [{width}x{height}x{nBands}]({Utils.qgisDataTypeName(dataType)})' \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/.local/lib/python3.11/site-packages/typeguard/__init__.py", line 1033, in wrapper
retval = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/khalilmisbah/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/utils.py", line 91, in qgisDataTypeName
return str(dataType).split('.')[1]
~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Execution failed after 0.11 seconds

Loading resulting layers
Algorithm 'Raster math' finished
KhalilM94 commented 1 year ago

As of the date of this comment, to avoid the above issue, it'd be safe to consider python version < 3.10

janzandr commented 1 year ago

Already fixed and released in v3.13.alpha.1: https://plugins.qgis.org/plugins/enmapboxplugin/version/3.13.0-alpha-1/