Commit 597948bd authored by Daniel Scheffler's avatar Daniel Scheffler

Bugfix for GeoArray.get_subset(). Updated version info.

parent 7c1fbfa1
Pipeline #1654 passed with stages
in 1 minute and 42 seconds
......@@ -12,8 +12,8 @@ from .masks import CloudMask # noqa: E402
__author__ = """Daniel Scheffler"""
__email__ = 'danschef@gfz-potsdam.de'
__version__ = '0.7.6'
__versionalias__ = 'v20171127.01'
__version__ = '0.7.7'
__versionalias__ = 'v20171130.01'
__all__ = ['GeoArray',
'BadDataMask',
'NoDataMask',
......
......@@ -1422,9 +1422,9 @@ class GeoArray(object):
:return:
"""
sub_arr = self[yslice if yslice else slice(None), # row
xslice if xslice else slice(None), # col
zslice if zslice else slice(None)] # band
xslice, yslice, zslice = xslice or slice(None), yslice or slice(None), zslice or slice(None)
sub_arr = self[yslice, xslice, zslice] # row, col, band
if sub_arr is None:
raise ValueError('Unable to return an array for the given slice parameters.')
......
......@@ -24,7 +24,7 @@ test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutpu
setup(
name='geoarray',
version='0.7.6',
version='0.7.7',
description="Fast Python interface for geodata - either on disk or in memory.",
long_description=readme + '\n\n' + history,
author="Daniel Scheffler",
......
......@@ -456,6 +456,14 @@ class Test_GeoarrayFunctions(unittest.TestCase):
self.assertIsInstance(sub_gA, GeoArray)
self.assertTrue(list(sub_gA.bandnames), list(self.testtiff.bandnames)[1])
# test with providing only xslice
sub_gA = self.testtiff.get_subset(xslice=slice(2, 5))
self.assertIsInstance(sub_gA, GeoArray)
# test with providing only yslice
sub_gA = self.testtiff.get_subset(yslice=slice(None, 3))
self.assertIsInstance(sub_gA, GeoArray)
# test without providing zslice
sub_gA = self.testtiff.get_subset(xslice=slice(2, 5), yslice=slice(None, 3))
self.assertIsInstance(sub_gA, GeoArray)
......@@ -468,6 +476,7 @@ class Test_GeoarrayFunctions(unittest.TestCase):
# test not to return GeoArray
out = self.testtiff.get_subset(xslice=slice(2, 5), yslice=slice(None, 3), zslice=slice(1, 2),
return_GeoArray=False)
self.assertIsInstance(out, tuple)
self.assertTrue(len(out), 3)
self.assertIsInstance(out[0], np.ndarray)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment