Commit 6c96f64d authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

pipeline.L1B_map: refactored L1B_obj.coregister_spatially() to...

pipeline.L1B_map: refactored L1B_obj.coregister_spatially() to L1B_obj.compute_global_shifts(). Revised L1B_object.get_spatial_reference_scene().
Former-commit-id: a5dc89b6
Former-commit-id: 7b5384b8
parent 8009b6d6
......@@ -17,6 +17,7 @@ import numpy as np
from geopandas import GeoDataFrame
from shapely.geometry import box
import pytz
from typing import Union # noqa F401 # flake8 issue
from arosics import COREG, DESHIFTER
from geoarray import GeoArray
......@@ -251,20 +252,21 @@ class L1B_object(L1A_object):
RSF.spatial_query(timeout=5)
if RSF.possib_ref_scenes:
self.logger.info('Query result: %s reference scenes with matching metadata.' % len(RSF.possib_ref_scenes))
else:
self.logger.warning('Spatial query returned no matches. Coregistration impossible.')
self.spatRef_available = False
# try to get a spatial reference scene by applying some filter criteria
self.spatRef_scene = RSF.choose_ref_scene()
if self.spatRef_scene:
self.spatRef_available = True
self.logger.info('Found a suitable reference image for coregistration: scene ID %s (entity ID %s).'
% (self.spatRef_scene.scene_ID, self.spatRef_scene.entity_ID))
# try to get a spatial reference scene by applying some filter criteria
self.spatRef_scene = RSF.choose_ref_scene() # type: Union[ref_Scene, None]
if self.spatRef_scene:
self.spatRef_available = True
self.logger.info('Found a suitable reference image for coregistration: scene ID %s (entity ID %s).'
% (self.spatRef_scene.scene_ID, self.spatRef_scene.entity_ID))
else:
self.spatRef_available = False
self.logger.warning('No scene fulfills all requirements to serve as spatial reference for scene %s '
'(entity ID %s). Coregistration impossible.' % (self.scene_ID, self.entity_ID))
else:
self.logger.warning('Spatial query returned no matches. Coregistration impossible.')
self.spatRef_available = False
self.logger.warning('No scene fulfills all requirements to serve as spatial reference for scene %s '
'(entity ID %s). Coregistration impossible.' % (self.scene_ID, self.entity_ID))
def _get_reference_image_params_pgSQL(self):
# TODO implement earlier version of this function as a backup for SpatialIndexMediator
......@@ -496,7 +498,7 @@ class L1B_object(L1A_object):
return ref_band4match, shift_band4match
def coregister_spatially(self):
def compute_global_shifts(self):
spatIdxSrv_status = os.environ['GMS_SPAT_IDX_SRV_STATUS'] if 'GMS_SPAT_IDX_SRV_STATUS' in os.environ else True
if spatIdxSrv_status == 'unavailable':
......@@ -553,7 +555,7 @@ class L1B_object(L1A_object):
def correct_spatial_shifts(self, cliptoextent=True, clipextent=None, clipextent_prj=None, v=False):
# type: (bool, list, any, bool) -> None
"""Corrects the spatial shifts calculated by self.coregister_spatially().
"""Corrects the spatial shifts calculated by self.compute_global_shifts().
:param cliptoextent: whether to clip the output to the given extent
:param clipextent: list of XY-coordinate tuples giving the target extent (if not given and cliptoextent is
......
......@@ -106,7 +106,7 @@ def L1B_map(L1A_obj):
nur die für die ganze Szene gültigen Metadaten"""
L1B_obj = L1B_P.L1B_object(L1A_obj)
L1B_obj.coregister_spatially()
L1B_obj.compute_global_shifts()
if CFG.job.exec_L1BP[1]:
L1B_obj.to_ENVI()
......
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