Commit 0037b20a authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

L1B_P.DESHIFTER.correct_shifts now corrects shifts directly,...

L1B_P.DESHIFTER.correct_shifts now corrects shifts directly, align_coordinate_grids() and resample_without_grid_aligning() are deprecated and not existing anymore
L1B_P.DESHIFTER.correct_shifts: fixed a bug that caused wrong output with a non-standard output gsd
L1B_P.DESHIFTER.correct_shifts: minor bugfixes
L1B_P.COREG: scenes without existing reference scene are now automatically skipped wit a warning
HLP_F: added group_tuples_by_keys_of_tupleElements() and group_dicts_by_key() that are used in process controller
parent 81b8ecd8
......@@ -3617,7 +3617,7 @@ def warp_ndarray(ndarray,in_gt, in_prj, out_prj, out_gt=None, outRowsCols=None,
:param outUL: [X,Y] output upper left coordinates as floats in the source coordinate system
(requires outRowsCols)
:param outRowsCols: [rows, cols] (optional)
:param out_res: output resolution as float in the TARGET coordinate system
:param out_res: output resolution as tuple of floats (x,y) in the TARGET coordinate system
:param out_extent: [left, bottom, right, top] as floats in the source coordinate system
:param out_dtype: output data type as numpy data type
:param rsp_alg: Resampling method to use. One of the following (int, default is 0):
This diff is collapsed.
......@@ -127,8 +127,8 @@ class usecase:
skip_thermal = True
skip_pan = True
sort_bands_by_cwl = True
conversion_type_optical = 'Ref' # 'Rad' / 'Ref'
conversion_type_thermal = 'Rad' # 'Rad' / 'Temp'
conversion_type_optical = 'Ref' # 'Rad' / 'Ref'
conversion_type_thermal = 'Rad' # 'Rad' / 'Temp'
elif GMS_call_type == 'webapp':
skip_thermal = int(query(job.conn_db_meta,'skip_thermal'))
skip_pan = int(query(job.conn_db_meta,'skip_pan'))
......@@ -137,9 +137,8 @@ class usecase:
conversion_type_thermal = query(job.conn_db_meta,'conversion_type_thermal')
align_coord_grids = 1 # FIXME: könnte später sinnlos werden, da gemeinsame Auswertung von Multisensordaten inkl.
# FIXME: Zeitreihen ein grid aligning voraussetzt
userInp_match_gsd = True
userInp_target_gsd = 30 # [meters]
match_gsd = True if align_coord_grids else False if userInp_match_gsd else False # allows forced avoiding of gsd matching
userInp_target_gsd = 30 # [meters], overridden if match_gsd==True
match_gsd = True
userdef_EPSG = None # FIXME nutzerdefinierte Einstellung: int(query(job.conn_db_meta,'userdef_EPSG'))
EPSG = None if not align_coord_grids else 4326 if userdef_EPSG is None else get_usecase_coord_grid()[1] # if userdef_EPSG == 'auto'
......@@ -291,6 +291,18 @@ def group_objects_by_attribute(object_list, attr):
get_attr = operator.attrgetter(attr)
return [list(g) for k, g in itertools.groupby(sorted(object_list, key=get_attr), get_attr)]
def group_tuples_by_keys_of_tupleElements(tuple_list, tupleElement_index, key):
unique_vals = set([tup[tupleElement_index][key] for tup in tuple_list])
groups = []
for val in unique_vals:
groups.append([tup for tup in tuple_list if tup[tupleElement_index][key]==val])
return groups
def group_dicts_by_key(dict_list,key):
unique_vals = set([dic[key] for dic in dict_list])
groups = [ [dic for dic in dict_list if dic[key]==val] for val in unique_vals]
return groups
def set_CLD_obj_classifier(path_cloud_class_obj):
# global CLD_obj
config.CLD_obj = CLD_P.GmsCloudClassifier(classifier=path_cloud_class_obj)
......@@ -320,13 +320,14 @@ def run_processController_in_multiprocessing(usecase_data_list):
"""L1A_obj enthält KEINE ARRAY-DATEN!, nur die für die ganze Szene gültigen Metadaten"""
if not HLP_F.proc_level_already_present(L1A_obj.proc_level,'L1B') and not L1A_obj.georef\
and L1A_obj.scene_ID != 15546348: # Slave # FIXME
if not HLP_F.proc_level_already_present(L1A_obj.proc_level,'L1B') and not L1A_obj.georef:
L1A_obj = scene_tilelist[0]
#[print(i) for i in scene_tilelist[0].meta]
"""1. calculate shifts"""
COREG_obj = L1B_P.COREG(L1A_obj.__dict__.copy(),v=0)
if not COREG_obj.success: # FIXME
continue # skip coregistration if L1B_P.COREG returns 0 (e.g. if no reference scene exists)
"""2. get L1B object with attribute coreg_info"""
......@@ -334,14 +335,20 @@ def run_processController_in_multiprocessing(usecase_data_list):
del L1A_obj
"""3. perform deshifting"""
#GDAL variante
deshift_configs = L1B_P.get_DESHIFTER_configs(L1B_obj.__dict__.copy(),
DESHIFT_instances = [L1B_P.DESHIFTER(obj,attr,**kwargs) for obj,attr,kwargs in deshift_configs]
deshift_results =,DESHIFT_instances)
# TODO deshift_results nach attribut gruppieren -> apply_deshift_results mit Liste der Gruppierungen callen
fastfiltered_results = [res for res in deshift_results if res['attrname'] == 'arr']
deshift_results = []
for inst in DESHIFT_instances:
#deshift_configs = L1B_P.get_DESHIFTER_configs(L1B_obj.__dict__.copy(),
# ['arr','masks'],proc_bandwise=True)
#DESHIFT_instances = [L1B_P.DESHIFTER(obj,attr,**kwargs) for obj,attr,kwargs in deshift_configs]
#deshift_results =,DESHIFT_instances)
grouped_deshift_results = HLP_F.group_dicts_by_key(deshift_results,'attrname')
[L1B_obj.apply_deshift_results(deshift_results) for deshift_results in grouped_deshift_results]
"""write L1B"""
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