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

added progress keyword to GeoArray.get_mapPos() and get_array_at_mapPos()

io.raster.GeoArray:
- GeoArray.get_mapPos(): added progress keyword
- get_array_at_mapPos(): added progress keyword

- updated __version__
parent 67c19433
......@@ -15,7 +15,7 @@ __all__=[#'compatibility',
'similarity',
'GeoArray']
__version__ = '20170124_02'
__version__ = '20170125_01'
__author__='Daniel Scheffler'
# Validate GDAL version
......
......@@ -1103,8 +1103,8 @@ class GeoArray(object):
def get_mapPos(self, mapBounds, mapBounds_prj, band2get=None, arr_gt=None, arr_prj=None, fillVal=None,
rspAlg='near', v=False): # TODO implement slice for indexing bands
# type: (tuple, str, int, tuple, str, int, str, bool) -> (np.ndarray, tuple, str)
rspAlg='near', progress=None, v=False): # TODO implement slice for indexing bands
# type: (tuple, str, int, tuple, str, int, str, bool, bool) -> (np.ndarray, tuple, str)
"""Returns the array data of GeoArray at a given geographic position.
NOTE: The given mapBounds are snapped to the pixel grid of GeoArray. If the given mapBounds include areas
......@@ -1118,13 +1118,16 @@ 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 progress: whether to show progress bars or not
:param v: verbose mode (not related to GeoArray.v; must be explicitly set)
:return:
"""
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
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
progress = progress if progress is not None else self.progress
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.')
......@@ -1138,7 +1141,8 @@ class GeoArray(object):
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)
rspAlg=rspAlg, out_gsd=(self.xgsd,self.ygsd), band2get=band2get,
progress=progress)
return sub_arr, sub_gt, sub_prj
......@@ -1550,8 +1554,8 @@ def get_array_at_mapPosOLD(arr, arr_gt, arr_prj, mapBounds, mapBounds_prj, band2
def get_array_at_mapPos(arr, arr_gt, arr_prj, out_prj, mapBounds, mapBounds_prj=None, out_gsd=None, band2get=None,
fillVal=0, rspAlg='near'):
# type: (np.ndarray, tuple, str, str, tuple, str, tuple, int, int,str) -> (np.ndarray, tuple, str)
fillVal=0, rspAlg='near', progress=True):
# type: (np.ndarray, tuple, str, str, tuple, str, tuple, int, int, str, bool) -> (np.ndarray, tuple, str)
"""
:param arr:
......@@ -1565,6 +1569,7 @@ def get_array_at_mapPos(arr, arr_gt, arr_prj, out_prj, mapBounds, mapBounds_prj=
:param fillVal:
:param rspAlg: <str> Resampling method to use. Available methods are:
near, bilinear, cubic, cubicspline, lanczos, average, mode, max, min, med, q1, q2
:param progress:
:return:
"""
......@@ -1585,6 +1590,6 @@ def get_array_at_mapPos(arr, arr_gt, arr_prj, out_prj, mapBounds, mapBounds_prj=
from ...geo.raster.reproject import warp_ndarray
out_arr, out_gt, out_prj = \
warp_ndarray(arr, arr_gt, arr_prj, out_prj=out_prj, out_bounds=mapBounds, out_bounds_prj=mapBounds_prj,
in_nodata=fillVal, out_nodata=fillVal, rspAlg=rspAlg, out_gsd=out_gsd)
in_nodata=fillVal, out_nodata=fillVal, rspAlg=rspAlg, out_gsd=out_gsd, progress=progress)
return out_arr, out_gt, out_prj
\ No newline at end of file
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