Skip to content

Commit

Permalink
Fixed #26432 -- Fixed size tuple order when using numpy reshape on a …
Browse files Browse the repository at this point in the history
…GDALBand.
  • Loading branch information
Opa- authored and yellowcap committed Apr 18, 2016
1 parent ddfeb9e commit 67a1cd2
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django/contrib/gis/gdal/raster/band.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ def data(self, data=None, offset=None, size=None, shape=None, as_memoryview=Fals
if as_memoryview:
return memoryview(data_array)
elif numpy:
# reshape() needs a reshape parameter with the height first.
return numpy.frombuffer(
data_array, dtype=numpy.dtype(data_array)).reshape(size)
data_array, dtype=numpy.dtype(data_array)
).reshape(tuple(reversed(size)))
else:
return list(data_array)
else:
Expand Down
Loading

0 comments on commit 67a1cd2

Please sign in to comment.