...
 
Commits (2)
......@@ -866,7 +866,7 @@ class GeoArray(object):
arr = arr[:, :, np.newaxis]
# 3D -> 2D
if 1 in arr.shape:
if 1 in arr.shape and len(getitem_params) != 1:
outshape = []
for i, sh in enumerate(arr.shape):
if sh == 1 and isinstance(getitem_params[i], (int, np.integer, float, np.floating)):
......
__version__ = '0.8.18'
__versionalias__ = '20190514.01'
__version__ = '0.8.19'
__versionalias__ = '20190522.01'
......@@ -346,6 +346,21 @@ class Test_GeoarrayAppliedOnPathArray(unittest.TestCase):
self.assertEqual(inmem_res.ndim, notinmem_res.ndim)
self.assertEqual(inmem_res.shape, notinmem_res.shape)
def test___getitem__consistency_3d_array_1_column(self):
testarr = np.array([[1, 2], [3, 4]]).reshape(2, 1, 2)
gA_inmem = GeoArray(testarr)
inmem_res = gA_inmem[:]
with tempfile.TemporaryDirectory() as tf:
gA_inmem.save(os.path.join(tf, 'test.bsq'))
gA_notinmem = GeoArray(os.path.join(tf, 'test.bsq'))
notinmem_res = gA_notinmem[:]
self.assertEqual(inmem_res.ndim, notinmem_res.ndim)
self.assertEqual(inmem_res.shape, notinmem_res.shape)
def test___getitem__consistency_2d_array(self):
testarr = np.zeros((2, 2))
testarr[:, :] = [[11, 12], [13, 14]]
......