data is consecutive
This commit is contained in:
parent
7df3563ced
commit
67f69fc8a5
|
@ -266,13 +266,9 @@ class Geom:
|
||||||
|
|
||||||
labels_ = [labels] if isinstance(labels,str) else labels
|
labels_ = [labels] if isinstance(labels,str) else labels
|
||||||
unique,unique_inverse = np.unique(np.hstack([table.get(l) for l in labels_]),return_inverse=True,axis=0)
|
unique,unique_inverse = np.unique(np.hstack([table.get(l) for l in labels_]),return_inverse=True,axis=0)
|
||||||
if len(unique) == grid.prod():
|
|
||||||
ma = np.arange(grid.prod())
|
ma = np.arange(grid.prod()) if len(unique) == grid.prod() else \
|
||||||
else:
|
np.arange(unique.size)[np.argsort(pd.unique(unique_inverse))][unique_inverse]
|
||||||
from_ma = pd.unique(unique_inverse)
|
|
||||||
sort_idx = np.argsort(from_ma)
|
|
||||||
idx = np.searchsorted(from_ma,unique_inverse,sorter = sort_idx)
|
|
||||||
ma = np.arange(from_ma.size)[sort_idx][idx]
|
|
||||||
|
|
||||||
return Geom(ma.reshape(grid,order='F'),size,origin,util.execution_stamp('Geom','from_table'))
|
return Geom(ma.reshape(grid,order='F'),size,origin,util.execution_stamp('Geom','from_table'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue