Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • danschef/geoarray
1 result
Select Git revision
Loading items
Show changes
Commits on Source (4)
......@@ -2,6 +2,12 @@
History
=======
0.15.11 (09.02.2023)
--------------------
* Fixed issue #36 (clip_to_poly fails for multiband raster) (!34).
0.15.10 (15.11.2022)
--------------------
......
......@@ -1609,12 +1609,12 @@ class GeoArray(object):
self.arr, self.gt, self.projection = self.get_mapPos(mapBounds=poly.bounds)
self.mask_nodata.arr, self.mask_nodata.gt, self.mask_nodata.projection = \
self.mask_nodata.get_mapPos(mapBounds=poly.bounds, mapBounds_prj=self.prj)
assert self.shape == self.mask_nodata.shape
assert self.shape[:2] == self.mask_nodata.shape
if self._mask_baddata is not None:
self.mask_baddata.arr, self.mask_baddata.gt, self.mask_baddata.projection = \
self.mask_baddata.get_mapPos(mapBounds=poly.bounds)
assert self.shape == self.mask_baddata.shape
assert self.shape[:2] == self.mask_baddata.shape
# update footprint polygon
if self._footprint_poly:
......
......@@ -337,6 +337,20 @@ class Test_GeoArray(TestCase):
"""Test GeoArray.footprint_poly."""
self.assertIsInstance(self.gA.footprint_poly, Polygon)
def test_clip_to_footprint(self):
# 3D GeoArray
gA_3D = GeoArray(path_data_tif).to_mem() # (10, 11, 2)
gA_3D[:, 0, :] = -9999 # set first column to nodata so that the footprint is a bit smaller
gA_3D.clip_to_footprint()
self.assertEqual(gA_3D.shape, (10, 10, 2))
# 2D GeoArray
_gA_3D = GeoArray(path_data_tif).to_mem()
gA_2D = GeoArray(_gA_3D[0], _gA_3D.gt, _gA_3D.prj, nodata=-9999) # (10, 11)
gA_2D[:, 0] = -9999 # set first column to nodata so that the footprint is a bit smaller
gA_2D.clip_to_footprint()
self.assertEqual(gA_2D.shape, (10, 10))
def test_metadata(self):
# TODO: Create a metadata-file for the tested TIFF-Image.
# TODO: Test, if the metadata-function gives an output
......