Commit 37baec53 authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

ENH : Add a finest selection for input images (with patterns) into SAR_MultiSlc* chains

parent 7e61f7a6
......@@ -370,11 +370,26 @@ if __name__ == "__main__":
# Get the elements from os.dirs
# =============================
# ====== Get the list of GTiff corresponding to dates
tiff_list = func_utils.get_AllTiff(pol=pol, ext=master_ext[0], searchDir=dict_Global["in"]["Input_Path"])
# ====== Get the list of GTiff corresponding to dates and patterns
tiff_list, throw_warning = func_utils.get_AllTiff(pol=pol, ext=master_ext[0], searchDir=dict_Global["in"]["Input_Path"])
# Throw a warning
if throw_warning :
func_utils.log(logging.WARNING, "WARNING : At least one of selected images into your input path does not match the expected pattern"+ "\n")
tiff_dates = func_utils.get_Tiff_WithDates(start_time, end_time, exclude, tiff_list, master_ext[0])
counter = 0
if len(tiff_dates)-1 <= 0 :
func_utils.log(logging.CRITICAL, "ERROR : None secondary images found, please check your input path and your selection (dates, exclude ...)"+ "\n")
quit()
if throw_warning :
# Indicate reference and all secondary images
func_utils.printOnStd("Reference and Secondary images : ")
func_utils.printOnStd(tiff_dates)
counter = 0
# ====== For loop processing
for i in (i for i in tiff_dates if i != master_Image_base):
total_slaves = len(tiff_dates)-1
......@@ -698,7 +713,6 @@ if __name__ == "__main__":
InterferoB123 = ""
Interfero_Ortho = ""
Interfero_Ortho = ""
if not master_ext[0] == "h5":
InterferoB123 = mib[:14]+"M"+mib[14:30]+mib[47:53]+"S"+sib[
......
......@@ -330,10 +330,26 @@ if __name__ == "__main__":
# Get the elements from os.dirs
# ============================
tiff_list = func_utils.get_AllTiff(pol, iw, searchDir=dict_Global["in"]["Input_Path"])
# ====== Get the list of GTiff corresponding to dates and patterns
tiff_list, throw_warning = func_utils.get_AllTiff(pol, iw, searchDir=dict_Global["in"]["Input_Path"])
# Throw a warning
if throw_warning :
func_utils.log(logging.WARNING, "WARNING : At least one of selected images into your input path does not match the expected pattern"+ "\n")
tiff_dates = func_utils.get_Tiff_WithDates(start_time, end_time, exclude, tiff_list)
counter = 0
if len(tiff_dates)-1 <= 0 :
func_utils.log(logging.CRITICAL, "ERROR : None secondary images found, please check your input path and your selection (dates, exclude ...)"+ "\n")
quit()
if throw_warning :
# Indicate reference and all secondary images
func_utils.printOnStd("Reference and Secondary images : ")
func_utils.printOnStd(tiff_dates)
counter = 0
for i in (i for i in tiff_dates if i != master_Image_base):
total_slaves = len(tiff_dates)-1
slave_Image_base = i
......
......@@ -344,30 +344,69 @@ def check_srtm_coverage(inSHP_Geometry, SRTM):
def get_AllTiff(pol, iw="", ext="", searchDir="."):
"""
Get all tiff from an input directory
Get all tiff from an input directory (check on pattern)
"""
TiffList = []
throw_warning = False
# Mode S1 IW
if not iw == "" :
for root, dirs, files in os.walk(searchDir):
for i in (i for i in files): # if i != inTIF):
if i.endswith(".tiff") and pol == i.split("-")[3]:
if iw == i.split("-")[1]:
TiffList.append(i)
for i in (i for i in files):
# Selection with extension (.tiff)
if i.endswith(".tiff") :
# Check pattern
correct = check_image_pattern(i, "S1IW")
if correct :
# Selection with polarisation and subwath
if pol == i.split("-")[3]:
if iw == i.split("-")[1]:
TiffList.append(i)
else :
throw_warning = True
else :
# Mode Cosmo
if ext == "h5":
for root, dirs, files in os.walk(searchDir):
for i in (i for i in files): # if i != inTIF):
if i.endswith(".h5") and pol == i.split("_")[5]:
TiffList.append(i)
for i in (i for i in files):
# Selection with extension (.h5)
if i.endswith(".h5") :
# Check pattern
correct = check_image_pattern(i, "Cosmo")
if correct :
# Selection with polarisation
if pol == i.split("_")[5]:
TiffList.append(i)
else :
throw_warning = True
# Mode S1 SM
if not ext == "h5":
for root, dirs, files in os.walk(searchDir):
for i in (i for i in files): # if i != inTIF):
if i.endswith(".tiff") and pol == i.split("-")[3]:
TiffList.append(i)
return TiffList
for i in (i for i in files):
# Selection with extension (.tiff)
if i.endswith(".tiff") :
# Check pattern
correct = check_image_pattern(i, "S1SM")
if correct :
# Selection with polarisation
if pol == i.split("-")[3]:
TiffList.append(i)
else :
throw_warning = True
return TiffList, throw_warning
def get_AllFilesWithExt(searchDir, ext) :
"""
......
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