Commit 3c70c06a authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfix for failed L2A map in case of failed coregistration

     - __init__(): bugfix for "NoneType object is not subscriptable" within mapinfo2geotransform (resulted from failed coregistration)
- reformatted some docstrings
parent c7e3832e
......@@ -168,7 +168,8 @@ class DESHIFTER(object):
self.updated_map_info = dict_GMS_obj['coreg_info']['updated map info']
self.original_map_info= dict_GMS_obj['coreg_info']['original map info']
self.updated_gt = GEOP.mapinfo2geotransform(self.updated_map_info)
self.updated_gt = GEOP.mapinfo2geotransform(self.updated_map_info) \
if self.updated_map_info else self.shift_gt
self.ref_scene_ID = dict_GMS_obj['coreg_info']['reference scene ID']
self.ref_entity_ID = dict_GMS_obj['coreg_info']['reference entity ID']
self.ref_prj = dict_GMS_obj['coreg_info']['reference projection']
......@@ -290,7 +291,7 @@ class DESHIFTER(object):
self.updated_map_info = GEOP.geotransform2mapinfo(self.updated_gt,self.updated_projection)
pass # FIXME
raise NotImplementedError # FIXME
else: # FIXME equal_prj==False ist noch NICHT implementiert
......@@ -318,6 +318,7 @@ def sorted_nicely(iterable):
def find_nearest(array, value, roundAlg='auto', extrapolate=False, exclude_val=False):
"""finds the value of an array nearest to a another single value
NOTE: In case of extrapolation an EQUALLY INCREMENTED array (like a coordinate grid) is assumed!
:param array:
:param value:
:param roundAlg:
......@@ -333,11 +334,10 @@ def find_nearest(array, value, roundAlg='auto', extrapolate=False, exclude_val=F
if extrapolate:
increment = array[1] - array[0]
if value > max(array):
array = np.arange(min(array), value + increment, increment) # expand array until value
if value < min(array):
array = (np.arange(-max(array), value + increment, increment) * -1)[
::-1] # negatively expand array until value
if value > max(array): # expand array until value
array = np.arange(min(array), value + increment, increment)
if value < min(array): # negatively expand array until value
array = (np.arange(-max(array), value + increment, increment) * -1)[::-1]
elif value < min(array) or value > max(array):
raise ValueError('Value %s is outside of the given array.' % value)
......@@ -453,6 +453,7 @@ def open_specific_file_within_archive(path_archive,matching_expression, read_mod
def get_image_tileborders(target_tileShape, target_tileSize, path_GMS_file=None, shape_fullArr=None):
"""Calculates row/col bounds for image tiles according to the given parameters.
:param target_tileShape: <str> 'cube','row','col','band','block','pixel' or 'custom'
:param target_tileSize: None or <tuple>. Only needed if target_tileShape=='block': (rows,cols)
:param path_GMS_file: <str> path to the *.gms file. Only needed if shape_fullArr is not given
......@@ -516,7 +517,9 @@ def cut_GMS_obj_into_blocks(tuple__In_obj__blocksize_RowsCols): # FIXME should b
def merge_GMS_tiles_to_GMS_obj(list_GMS_tiles):
# type: (list) -> L1A_object
"""Merge separate GMS objects belonging to the same scene-ID to ONE GMS object
:param list_GMS_tiles: <list> of GMS objects that have been created by cut_GMS_obj_into_blocks()"""
:param list_GMS_tiles: <list> of GMS objects that have been created by cut_GMS_obj_into_blocks()
if 'IMapUnorderedIterator' in str(type(list_GMS_tiles)): list_GMS_tiles = list(list_GMS_tiles)
procLvl = list_GMS_tiles[0].proc_level
GMS_obj = parentObjDict[procLvl](*initArgsDict[procLvl])
......@@ -336,12 +336,6 @@ def run_processController_in_multiprocessing(usecase_data_list):
L1A_Instances = L1A_newObjects + L1A_DBObjects # combine newly and earlier processed L1A data
## add SpatialIndexMediator connection to L1A_Instances # FIXME dirty hack
#from .misc.SpatialIndexMediator import SpatialIndexMediator
#SpIM_connection = SpatialIndexMediator(timeout=5)
#for obj in L1A_Instances:
# obj.SpIM_connection = SpIM_connection
with multiprocessing.Pool() as pool: L1B_resObjects =, L1A_Instances)
L1B_newObjects = [obj for obj in L1B_resObjects if isinstance(obj,L1B_P.L1B_object)]
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