Commit e331bea6 authored by Daniel Scheffler's avatar Daniel Scheffler Committed by Mathias Peters
Browse files

added verbose mode to GeoArray.get_mapPos()

- get_mapPos(): added verbose mode that must be explicitly set
parent c4a7f80a
......@@ -71,7 +71,7 @@ class GeoArray(object):
# FIXME implement compatibility to GDAL VRTs
if not (isinstance(path_or_array, (str, np.ndarray, GeoArray)) or
issubclass(getattr(path_or_array,'__class__'), GeoArray)):
raise ValueError("%s parameter 'arg' takes only string, np.ndarray or GeoArray(and subclass) instances."
raise ValueError("%s parameter 'arg' takes only string, np.ndarray or GeoArray(and subclass) instances. "
"Got %s." %(self.__class__.__name__,type(path_or_array)))
if path_or_array is None:
......@@ -1045,7 +1045,7 @@ class GeoArray(object):
def get_mapPos(self, mapBounds, mapBounds_prj, band2get=None, arr_gt=None, arr_prj=None, fillVal=None,
rspAlg='near'): # TODO implement slice for indexing bands
rspAlg='near', v=False): # TODO implement slice for indexing bands
:param mapBounds: xmin, ymin, xmax, ymax
......@@ -1056,16 +1056,25 @@ class GeoArray(object):
:param fillVal: nodata value
:param rspAlg: <str> Resampling method to use. Available methods are:
near, bilinear, cubic, cubicspline, lanczos, average, mode, max, min, med, q1, q2
:param v: verbose mode (not related to GeoArray.v; must be explicitly set)
arr_gt = arr_gt if arr_gt else self.geotransform
arr_prj = arr_prj if arr_prj else self.projection
fillVal = fillVal if fillVal is not None else self.nodata
if self.is_inmem and not arr_gt or not arr_prj:
if self.is_inmem and (not arr_gt or not arr_prj):
raise ValueError('In case of in-mem arrays the respective geotransform and projection of the array '
'has to be passed.')
if v:
print('%s.get_mapPos() input parameters:')
print('\tmapBounds', mapBounds, '<==>',
print('\tEPSG', WKT2EPSG(mapBounds_prj), self.epsg)
print('\tarr_gt', arr_gt,
print('\tarr_prj', WKT2EPSG(arr_prj), self.epsg)
print('\tfillVal', fillVal, self.nodata, '\n')
sub_arr, sub_gt, sub_prj = get_array_at_mapPos(self, arr_gt, arr_prj, mapBounds_prj, mapBounds, fillVal=fillVal,
rspAlg=rspAlg, out_gsd=(self.xgsd,self.ygsd), band2get=band2get)
return sub_arr, sub_gt, sub_prj
Supports Markdown
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