Commit 827b36f2 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

added quiet mode an progress keyword for GeoArray

components.CoReg:
- imParams:
    - quiet mode and progress keyword are now passed to GeoArray

components.CoReg_local:
- COREG_LOCAL:
    - quiet mode and progress keyword are now passed to GeoArray

components.Geom_Quality_Grid.Geom_Quality_Grid:
 - quiet mode and progress keyword are now passed to GeoArray
parent 33574a48
......@@ -53,6 +53,10 @@ class imParamObj(object):
# set GeoArray
get_geoArr = lambda p: GeoArray(p) if not isinstance(p,GeoArray) else p
self.GeoArray = get_geoArr(CoReg_params['im_ref']) if imID == 'ref' else get_geoArr(CoReg_params['im_tgt'])
init_nodata = CoReg_params['nodata'][0 if imID == 'ref' else 1]
self.GeoArray.nodata = init_nodata if init_nodata is not None else self.GeoArray.nodata
self.GeoArray.progress = CoReg_params['progress']
self.GeoArray.q = CoReg_params['q']
# set title to be used in plots
self.title = os.path.basename(self.GeoArray.filePath) if self.GeoArray.filePath else self.imName
......@@ -89,6 +93,7 @@ class imParamObj(object):
if CoReg_params['calc_corners']:
if not CoReg_params['q']:
print('Calculating actual data corner coordinates for %s...' % self.imName)
self.corner_coord = GEO.get_true_corner_mapXY(self.GeoArray, self.band4match, self.nodata,
CoReg_params['multiproc'], v=self.v, q=self.q)
else:
......@@ -100,6 +105,7 @@ class imParamObj(object):
# set footprint polygon
#self.poly = get_footprint_polygon(self.corner_coord, fix_invalid=True) # this is the old algorithm
self.GeoArray.calc_mask_nodata(fromBand=self.band4match) # this avoids that all bands have to be read
self.poly = self.GeoArray.footprint_poly
for XY in self.corner_coord:
......
......@@ -69,8 +69,15 @@ class COREG_LOCAL(object):
self.params = dict([x for x in locals().items() if x[0] != "self" and not x[0].startswith('__')])
self.imref = im_ref if isinstance(im_ref, GeoArray) else GeoArray(im_ref)
self.im2shift = im_tgt if isinstance(im_tgt, GeoArray) else GeoArray(im_tgt)
if isinstance(im_ref, GeoArray) and nodata is not None: im_ref.nodata = nodata[0]
if isinstance(im_tgt, GeoArray) and nodata is not None: im_tgt.nodata = nodata[1]
self.imref = im_ref if isinstance(im_tgt, GeoArray) else GeoArray(im_ref, nodata=nodata[0])
self.im2shift = im_tgt if isinstance(im_tgt, GeoArray) else GeoArray(im_tgt, nodata=nodata[1])
self.imref.progress = progress
self.im2shift.progress = progress
self.imref.q = q
self.im2shift.q = q
self.path_out = path_out # updated by self.set_outpathes
self.fmt_out = fmt_out
......@@ -95,7 +102,6 @@ class COREG_LOCAL(object):
self.path_out = os.path.join(self.projectDir, os.path.basename(self.path_out))
gdal.AllRegister()
self.COREG_obj = COREG(self.imref, self.im2shift,
ws = window_size,
data_corners_im0 = data_corners_im0,
......@@ -108,6 +114,7 @@ class COREG_LOCAL(object):
nodata = nodata,
multiproc = self.CPUs is None or self.CPUs > 1,
binary_ws = self.bin_ws,
progress = self.progress,
v = v,
q = q,
ignore_errors = True)
......
......@@ -49,8 +49,8 @@ class Geom_Quality_Grid(object):
:param CPUs(int): number of CPUs to use during calculation of geometric quality grid
(default: None, which means 'all CPUs available')
:param progress(bool): show progress bars (default: True)
:param v(bool): verbose mode (default: 0)
:param q(bool): quiet mode (default: 0)
:param v(bool): verbose mode (default: False)
:param q(bool): quiet mode (default: False)
"""
if not isinstance(COREG_obj, COREG): raise ValueError("'COREG_obj' must be an instance of COREG class.")
......
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