DriesLanduyt / PMAT

QGIS plug-in: Probabilistic Map Algebra Tool
3 stars 3 forks source link

Strange behaviour of np.unique() #1

Closed DriesLanduyt closed 9 years ago

DriesLanduyt commented 9 years ago

The fast run mode produces an error with the newest QGIS versions (2.9; 2.10) while the second process bar is loading. This due to a wrongly created casefile that contains the characteristics of the unique pixels. Probably this has something to do with unstable behaviour of np.unique():

import numpy as np
a = np.array([[1,2],[2,1],[3,4],[3,4]])
np.unique(tuple(row) for row in a)

numpy version 1.7.0 prints the desired result:

array([[1, 2],
       [2, 1],
       [3, 4]])

numpy version 1.8.2 prints a wrong result:

array([[1, 2],
       [1, 2],
       [3, 4]])

numpy version 1.9.2 prints a wrong result:

array([<generator object <genexpr> at 0x00000000161451F8>], dtype=object)
DriesLanduyt commented 9 years ago

This bug has been solved in the new version