hubdc ImageScatterMatrix exception

Issue #69 closed
Benjamin Jakimow created an issue

The following call of hubdc (0.8.0) throws an exception: (numpy version is 1.9.2, tested on macOS 10.12.6)

from hubdc import HUBDC_VERSION
from hubflow import HUBFLOW_VERSION
from hubdc.applier import ApplierControls
from hubflow.types import *
from enmapboxtestdata import enmap
image = Image(enmap)

controls = ApplierControls().setReferenceGridByImage(image.filename)
controls.setNumThreads(1)

print('hubdc   : ' + HUBDC_VERSION)
print('hubflow : ' + HUBFLOW_VERSION)

i1 = 10
i2 = 20
(min1, min2), (max1, max2), (n1, n2) = image.basicStatistics(bandIndicies=[i1, i2])
m, xedges, yedges = image.scatterMatrix(image2=image, bandIndex=i1, bandIndex2=i2,
                                        range=[float(min1), float(max1)], \
                                        range2=[float(min2), float(max2)], bins=10,
                                        controls=controls)

Exception:

hubdc   : 0.8.0
hubflow : 0.5.0
start ImageBasicStatistics [60x80]
0%..100%
done ImageBasicStatistics in 0 sec | 0.0  min | 0.0 hours
start ImageScatterMatrix [60x80]
0%..Traceback (most recent call last):
  File "/Users/benjamin.jakimow/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/163.10154.50/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1596, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Users/benjamin.jakimow/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/163.10154.50/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 974, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Users/benjamin.jakimow/Repositories/QGIS_Plugins/enmap-box/snippets/hubdcerror.py", line 20, in <module>
    controls=controls)
  File "/Users/benjamin.jakimow/Repositories/QGIS_Plugins/enmap-box/site-packages/hubflow/types.py", line 96, in scatterMatrix
    controls=controls, progressBar=progressBar)
  File "/Users/benjamin.jakimow/Repositories/QGIS_Plugins/enmap-box/site-packages/hubflow/ip_algorithms.py", line 236, in imageScatterMatrix
    results = applier.apply(operator=ImageScatterMatrix, args=args)
  File "/Users/benjamin.jakimow/Repositories/QGIS_Plugins/enmap-box/site-packages/hubdc/applier.py", line 155, in apply
    results = self._runProcessSubgrids()
  File "/Users/benjamin.jakimow/Repositories/QGIS_Plugins/enmap-box/site-packages/hubdc/applier.py", line 213, in _runProcessSubgrids
    results = [applyResult.get() for applyResult in applyResults]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 567, in get
    raise self._value
IndexError: arrays used as indices must be of integer (or boolean) type

Comments (9)

  1. Andreas Janz

    Ich kann das nicht reproduzieren. Läuft alles durch und das 2dHisto sieht auch gut aus:

    hubdc   : 0.8.0dev
    hubflow : 0.5.0dev
    start ImageBasicStatistics [60x80]
    0%..100%
    done ImageBasicStatistics in 0 sec | 0.0  min | 0.0 hours
    start ImageScatterMatrix [60x80]
    0%..100%
    done ImageScatterMatrix in 8 sec | 0.13  min | 0.0 hours
    [[1953  283    0    0    0    0    0    0    0    0]
     [  83 1935   34    0    0    0    0    0    0    0]
     [   0   56  286    7    0    0    0    0    0    0]
     [   0    0   14   79    2    0    0    0    0    0]
     [   0    0    0    9   25    2    0    0    0    0]
     [   0    0    0    1    6   10    0    0    0    0]
     [   0    0    0    0    0    3    2    0    0    0]
     [   0    0    0    0    0    1    1    2    0    0]
     [   0    0    0    0    0    1    0    0    0    0]
     [   0    0    0    0    0    0    0    0    2    3]]
    

    Das müsste ich am Montag mal lokal auf deinem Rechner debuggen.

  2. Benjamin Jakimow reporter

    Das Standard QGIS für macOS* basiert auf numpy 1.9.2 (http://www.kyngchaos.com/software/qgis)

    Installationen mit neuerem numpy sind zwar möglich, aber i.d.R. nur für fortgeschrittene Anwender möglich.

    Vmtl. reicht es aus, wenn der hubdc prüft ob numpy.stack existert und falls nicht

    numpy.stack = numpy.hstack
    

    definiert.

    Gibt es unit-tests für hub-datacube und hub-workflow?

  3. Andreas Janz

    Ok. Ich würde vorschlagen, dass wir diesen Fix an der gleichen Stelle machen, wo die EnMAP-Box prüft, ob alle externen Packages da sind.

  4. Andreas Janz

    @jakimowb, ist die Mac Numpy-Version mittlerweile auf einem Stand, wo numpy.stack existiert oder müssen wir hier noch tätig werden?

  5. Benjamin Jakimow reporter

    Die OSGeo4mac nutzt numpy 1.14, das sollte reichen, macht die installation aber auch komplizierter. Solange es nur um den numpy.stack = numpy.hstack geht würde ich einen switch vorziehen. Die Zahl der mac user ist ja unter Studierenden nicht gerade gering.

  6. Log in to comment