diff --git a/python_src/SAR_MultiSlc.py b/python_src/SAR_MultiSlc.py index c3e68d880afe5a1fa61416c90db7ce1650aa2431..f609f7ba839a7efa2073c8ebc97a88857a8d97c2 100644 --- a/python_src/SAR_MultiSlc.py +++ b/python_src/SAR_MultiSlc.py @@ -191,6 +191,10 @@ if __name__ == "__main__": func_utils.check_ifExist(hgts_path) func_utils.check_ifExist(master_Image) + # ====== Check roi format (if roi) + if roi : + func_utils.check_roiFormat(roi) + # ====== Create global folder with starting and ending dates + master date output_glob = "{}/output_{}_to_{}_m_{}".format(output_dir, start_time, end_time, master_date) diff --git a/python_src/SAR_MultiSlc_IW.py b/python_src/SAR_MultiSlc_IW.py index 188cf0682f69f4522a70e03f74f0b7fc285b4de5..22b642a00dcdb291d4c62541723498dc98f59aea 100644 --- a/python_src/SAR_MultiSlc_IW.py +++ b/python_src/SAR_MultiSlc_IW.py @@ -188,6 +188,10 @@ if __name__ == "__main__": func_utils.check_ifExist(hgts_path) func_utils.check_ifExist(master_Image) + # ====== Check roi format (if roi) + if roi : + func_utils.check_roiFormat(roi) + # ====== Check regex for Burst index firstBurst, lastBurst, burstList = func_utils.check_burstIndex(burst_index) print("from check regex",firstBurst, lastBurst)########################################################### diff --git a/python_src/utils/func_utils.py b/python_src/utils/func_utils.py index 62efd84defb6b707482d358b95405b7ec16b91e8..6106d8609520d35fcc188838be53646581f7c6cc 100644 --- a/python_src/utils/func_utils.py +++ b/python_src/utils/func_utils.py @@ -473,6 +473,20 @@ def selectBurst(dictMaster, dictSlave, firstBurst, lastBurst, nbBurstSlave): return validBurstMaster, validBurstSlave +def check_roiFormat(roi): + """ + Check the roi format, must be 'ulx uly lrx lry' (ex: -roi 2.44115 48.96126 2.44176 48.95927) + """ + regx_exp = re.compile("^([+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)\s){4}$") + if not roi.endswith(' '): + roi = roi + ' ' + + res = regx_exp.match(roi) + # If res = None => does not match with the correct format => quit the progrm + if not res : + print("Wrong format for roi paramater, must be 'ulx uly lrx lry' (ex: -roi 2.44115 48.96126 2.44176 48.95927)") + quit() + def str2bool(v): """ Conversion between a string to a boolean (several ways to say yes into json configuration file).