Commit 3cc9342e authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

The mapBounds_prj parameter of GeoArray.get_mapPos is not optional and defaults to GeoArray.prj.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 9490aec6
......@@ -8,6 +8,7 @@ History
* Slight improvements for GeoArray.show_map().
* Fixed a bug in GeoArray.get_mapPos() which leads to too small output
in case mapBounds_prj is unequal to GeoArray.prj (!29).
* The mapBounds_prj parameter of GeoArray.get_mapPos is not optional and defaults to GeoArray.prj.
0.15.0 (27.09.2021)
......
......@@ -1148,7 +1148,7 @@ class GeoArray(object):
nodataVal=None, out_prj=None, ignore_rotation=False):
# handle limits
if boundsMap:
boundsMapPrj = boundsMapPrj if boundsMapPrj else self.prj
boundsMapPrj = boundsMapPrj or self.prj
image2plot, gt, prj = self.get_mapPos(boundsMap, boundsMapPrj, band2get=band,
fillVal=nodataVal if nodataVal is not None else self.nodata)
else:
......@@ -1586,14 +1586,14 @@ class GeoArray(object):
:param poly: instance of shapely.geometry.Polygon
"""
self.arr, self.gt, self.projection = self.get_mapPos(mapBounds=poly.bounds, mapBounds_prj=self.prj)
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
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, mapBounds_prj=self.prj)
self.mask_baddata.get_mapPos(mapBounds=poly.bounds)
assert self.shape == self.mask_baddata.shape
# update footprint polygon
......@@ -1633,8 +1633,8 @@ class GeoArray(object):
return GeneratorLen(out_gen, length=len(bounds_alltiles))
def get_mapPos(self, mapBounds, mapBounds_prj, band2get=None, out_prj=None, arr_gt=None, arr_prj=None, fillVal=None,
rspAlg='near', progress=None, v=False): # TODO implement slice for indexing bands
def get_mapPos(self, mapBounds, mapBounds_prj=None, band2get=None, out_prj=None, arr_gt=None, arr_prj=None,
fillVal=None, rspAlg='near', progress=None, v=False): # TODO implement slice for indexing bands
# type: (tuple, str, int, str, tuple, str, int, str, bool, bool) -> (np.ndarray, tuple, str)
"""Return the array data of GeoArray at a given geographic position.
......@@ -1654,6 +1654,7 @@ class GeoArray(object):
:param v: verbose mode (not related to GeoArray.v; must be explicitly set)
:return:
"""
mapBounds_prj = mapBounds_prj if mapBounds_prj is not None else self.prj
arr_gt = arr_gt or self.geotransform
arr_prj = arr_prj or self.projection
out_prj = out_prj or arr_prj
......
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