Commit ca8c7a72 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Moved option 'spathomo_estimate_accuracy' to L2A processor.

Added loggin to L1B_P.L1B_object.get_opt_bands4matching().
parent 0c67304b
...@@ -451,11 +451,10 @@ class L1B_object(L1A_object): ...@@ -451,11 +451,10 @@ class L1B_object(L1A_object):
return filt_overlap_scenes return filt_overlap_scenes
def get_opt_bands4matching(self, target_cwlPos_nm=550, v=False): def get_opt_bands4matching(self, target_cwlPos_nm=550):
"""Automatically determines the optimal bands used für fourier shift theorem matching """Automatically determines the optimal bands used für fourier shift theorem matching
:param target_cwlPos_nm: the desired wavelength used for matching :param target_cwlPos_nm: the desired wavelength used for matching
:param v: verbose mode
""" """
# get GMS_object for reference scene # get GMS_object for reference scene
path_gmsFile = PG.path_generator(scene_ID=self.spatRef_scene.scene_ID).get_path_gmsfile() path_gmsFile = PG.path_generator(scene_ID=self.spatRef_scene.scene_ID).get_path_gmsfile()
...@@ -501,14 +500,13 @@ class L1B_object(L1A_object): ...@@ -501,14 +500,13 @@ class L1B_object(L1A_object):
shift_band4match = shift_cwl.index(closestWvl_to_target) + 1 # the shift band closest to target shift_band4match = shift_cwl.index(closestWvl_to_target) + 1 # the shift band closest to target
ref_band4match = ref_cwl.index(match_dic[closestWvl_to_target]) + 1 # matching ref ref_band4match = ref_cwl.index(match_dic[closestWvl_to_target]) + 1 # matching ref
else: # all reference bands are outside of shift-cwl +- fwhm/2 else: # all reference bands are outside of shift-cwl +- fwhm/2
warnings.warn('Optimal bands for matching could not be automatically determined. Choosing first band of' self.logger.warning('Optimal bands for matching could not be automatically determined. '
'each image.') 'Choosing first band of each image.')
shift_band4match = 1 shift_band4match = 1
ref_band4match = 1 ref_band4match = 1
if v: self.logger.info('Shift band for matching: %s (%snm)' % (shift_band4match, shift_cwl[shift_band4match - 1]))
print('Shift band for matching: %s (%snm)' % (shift_band4match, shift_cwl[shift_band4match - 1])) self.logger.info('Reference band for matching: %s (%snm)' % (ref_band4match, ref_cwl[ref_band4match - 1]))
print('Reference band for matching: %s (%snm)' % (ref_band4match, ref_cwl[ref_band4match - 1]))
return ref_band4match, shift_band4match return ref_band4match, shift_band4match
...@@ -524,8 +522,7 @@ class L1B_object(L1A_object): ...@@ -524,8 +522,7 @@ class L1B_object(L1A_object):
elif self.coreg_needed and self.spatRef_available: elif self.coreg_needed and self.spatRef_available:
geoArr_ref = GeoArray(self.spatRef_scene.filePath) geoArr_ref = GeoArray(self.spatRef_scene.filePath)
geoArr_shift = GeoArray(self.arr) geoArr_shift = GeoArray(self.arr)
r_b4match, s_b4match = self.get_opt_bands4matching(target_cwlPos_nm=CFG.coreg_band_wavelength_for_matching, r_b4match, s_b4match = self.get_opt_bands4matching(target_cwlPos_nm=CFG.coreg_band_wavelength_for_matching)
v=False)
coreg_kwargs = dict( coreg_kwargs = dict(
r_b4match=r_b4match, r_b4match=r_b4match,
s_b4match=s_b4match, s_b4match=s_b4match,
......
...@@ -350,8 +350,6 @@ class JobConfig(object): ...@@ -350,8 +350,6 @@ class JobConfig(object):
gp('coreg_max_shift_allowed', json_processors['L1B']['coreg_max_shift_allowed']) gp('coreg_max_shift_allowed', json_processors['L1B']['coreg_max_shift_allowed'])
self.coreg_window_size = \ self.coreg_window_size = \
gp('coreg_window_size', json_processors['L1B']['coreg_window_size']) gp('coreg_window_size', json_processors['L1B']['coreg_window_size'])
self.spathomo_estimate_accuracy = \
gp('spathomo_estimate_accuracy', json_processors['L1B']['spathomo_estimate_accuracy'])
# L1C # L1C
self.exec_L1CP = gp('exec_L1CP', [ self.exec_L1CP = gp('exec_L1CP', [
...@@ -386,6 +384,8 @@ class JobConfig(object): ...@@ -386,6 +384,8 @@ class JobConfig(object):
self.match_gsd = gp('match_gsd', json_processors['L2A']['match_gsd']) self.match_gsd = gp('match_gsd', json_processors['L2A']['match_gsd'])
self.spatial_resamp_alg = gp('spatial_resamp_alg', json_processors['L2A']['spatial_resamp_alg']) self.spatial_resamp_alg = gp('spatial_resamp_alg', json_processors['L2A']['spatial_resamp_alg'])
self.clip_to_extent = gp('clip_to_extent', json_processors['L2A']['clip_to_extent']) self.clip_to_extent = gp('clip_to_extent', json_processors['L2A']['clip_to_extent'])
self.spathomo_estimate_accuracy = \
gp('spathomo_estimate_accuracy', json_processors['L1B']['spathomo_estimate_accuracy'])
# L2B # L2B
self.exec_L2BP = gp('exec_L2BP', [ self.exec_L2BP = gp('exec_L2BP', [
......
...@@ -87,8 +87,7 @@ ...@@ -87,8 +87,7 @@
"spatial_ref_plusminus_years": 10, /*maximum time interval between target and reference scene in years*/ "spatial_ref_plusminus_years": 10, /*maximum time interval between target and reference scene in years*/
"coreg_band_wavelength_for_matching": 550, /*optimal wavelength [nm] of the spectral bands used for matching*/ "coreg_band_wavelength_for_matching": 550, /*optimal wavelength [nm] of the spectral bands used for matching*/
"coreg_max_shift_allowed": 5, /*maximum shift distance in reference image pixel units (default: 5 px)*/ "coreg_max_shift_allowed": 5, /*maximum shift distance in reference image pixel units (default: 5 px)*/
"coreg_window_size": [256, 256], "coreg_window_size": [256, 256]
"spathomo_estimate_accuracy": false
}, },
"L1C": { /*Level 1C processing: atmospheric correction*/ "L1C": { /*Level 1C processing: atmospheric correction*/
...@@ -125,7 +124,8 @@ ...@@ -125,7 +124,8 @@
"spatial_resamp_alg": "cubic", /*the resampling algorithm to be used if neccessary "spatial_resamp_alg": "cubic", /*the resampling algorithm to be used if neccessary
(valid algorithms: nearest, bilinear, cubic, cubic_spline, lanczos, (valid algorithms: nearest, bilinear, cubic, cubic_spline, lanczos,
average, mode, max, min, med, q1, q3)*/ average, mode, max, min, med, q1, q3)*/
"clip_to_extent": true /*whether to clip the output to its actual corner coordinates*/ "clip_to_extent": true, /*whether to clip the output to its actual corner coordinates*/
"spathomo_estimate_accuracy": false
}, },
"L2B": { /*Level 2B processing: spectral homogenization*/ "L2B": { /*Level 2B processing: spectral homogenization*/
......
...@@ -76,7 +76,6 @@ gms_schema_input = dict( ...@@ -76,7 +76,6 @@ gms_schema_input = dict(
coreg_max_shift_allowed=dict(type='float', required=False, min=0), coreg_max_shift_allowed=dict(type='float', required=False, min=0),
coreg_window_size=dict(type='list', required=False, minlength=0, maxlength=2, coreg_window_size=dict(type='list', required=False, minlength=0, maxlength=2,
schema=dict(type='integer', required=False, min=8)), schema=dict(type='integer', required=False, min=8)),
spathomo_estimate_accuracy=dict(type='boolean', required=False),
)), )),
L1C=dict(type='dict', required=False, schema=dict( L1C=dict(type='dict', required=False, schema=dict(
run_processor=dict(type='boolean', required=False), run_processor=dict(type='boolean', required=False),
...@@ -112,6 +111,7 @@ gms_schema_input = dict( ...@@ -112,6 +111,7 @@ gms_schema_input = dict(
allowed=['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', allowed=['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average',
'mode', 'max', 'min', 'med', 'q1', 'q3']), 'mode', 'max', 'min', 'med', 'q1', 'q3']),
clip_to_extent=dict(type='boolean', required=False), clip_to_extent=dict(type='boolean', required=False),
spathomo_estimate_accuracy=dict(type='boolean', required=False),
)), )),
L2B=dict(type='dict', required=False, schema=dict( L2B=dict(type='dict', required=False, schema=dict(
run_processor=dict(type='boolean', required=False), run_processor=dict(type='boolean', required=False),
......
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