diff --git a/json_schemas/schema_MultiSlc.json b/json_schemas/schema_MultiSlc.json index 67d27d8a45306414419c4f22de3428fc5e2d881b..8138ec13041a7326e00f8e9083dbec9973d6fd5f 100644 --- a/json_schemas/schema_MultiSlc.json +++ b/json_schemas/schema_MultiSlc.json @@ -22,13 +22,14 @@ "End_Date", "Input_Path"], "additionalProperties": false, "properties": {"SRTM_Shapefile": {"type": "string"}, - "SRTM_Path": {"type": "string"}, - "Geoid": {"type": "string"}, - "Master_Image": {"type": "string"}, - "Start_Date": {"type": "string"}, - "End_Date": {"type": "string"}, - "Exclude": {"type": "string", "default": "-9999"}, - "Input_Path": {"type": "string"}} + "SRTM_Path": {"type": "string"}, + "EOF_Path": {"type": "string"}, + "Geoid": {"type": "string"}, + "Master_Image": {"type": "string"}, + "Start_Date": {"type": "string"}, + "End_Date": {"type": "string"}, + "Exclude": {"type": "string", "default": "-9999"}, + "Input_Path": {"type": "string"}} }, "out": { diff --git a/json_schemas/schema_MultiSlc_IW.json b/json_schemas/schema_MultiSlc_IW.json index cad9e7759b7f62cd1c2b401f685b4ec24a37b522..b74d7b7d03011fe24ffad14c2fde7f5187cc5513 100644 --- a/json_schemas/schema_MultiSlc_IW.json +++ b/json_schemas/schema_MultiSlc_IW.json @@ -21,13 +21,14 @@ "End_Date", "Input_Path"], "additionalProperties": false, "properties": {"SRTM_Shapefile": {"type": "string"}, - "SRTM_Path": {"type": "string"}, - "Geoid": {"type": "string"}, - "Master_Image": {"type": "string"}, - "Start_Date": {"type": "string"}, - "End_Date": {"type": "string"}, - "Exclude": {"type": "string", "default": "-9999"}, - "Input_Path": {"type": "string"}} + "SRTM_Path": {"type": "string"}, + "Geoid": {"type": "string"}, + "EOF_Path": {"type": "string"}, + "Master_Image": {"type": "string"}, + "Start_Date": {"type": "string"}, + "End_Date": {"type": "string"}, + "Exclude": {"type": "string", "default": "-9999"}, + "Input_Path": {"type": "string"}} }, "out": { diff --git a/python_src/SAR_MultiSlc.py b/python_src/SAR_MultiSlc.py index e79d633f0d4c23b03e6620b08ad2d8db9e07b72e..a111fa0b0efe2ceedd114c636befd9034b7e76db 100644 --- a/python_src/SAR_MultiSlc.py +++ b/python_src/SAR_MultiSlc.py @@ -92,6 +92,10 @@ if __name__ == "__main__": hgts_path = dict_Global['in']['SRTM_Path'] geoid_path = dict_Global['in']['Geoid'] + eof_Path = None + if 'EOF_Path' in dict_Global['in']: + eof_Path = dict_Global['in']['EOF_Path'] + output_dir = dict_Global['out']['Output_Path'] if not os.path.exists(output_dir): @@ -234,6 +238,12 @@ if __name__ == "__main__": func_utils.check_ifExist(hgts_path) func_utils.check_ifExist(master_Image) + # Check eof path + if eof_Path : + if not os.path.exists(eof_Path) : + func_utils.log(logging.CRITICAL, "Error, {path} does not exist. Check its path.".format(path=eof_Path)) + quit() + # ====== Check roi format (if roi) if roi : func_utils.check_roiFormat(roi) @@ -408,6 +418,66 @@ if __name__ == "__main__": slave_Image = "HDF5:" + slave_Image + "://S01/SBI" + # Find eof files for each image if not cosmo + # Then, create the "fine" geom (with precise orbits) + # Eventually, assign an extended filename if EOF file correspond to the image + if satellite != "cosmo" : + if eof_Path : + list_ofEOF = func_utils.get_AllFilesWithExt(eof_Path, ".EOF") + + + # master + if counter <= 1 : + start_master = dictKWLMaster['support_data.first_line_time'] + end_master = dictKWLMaster['support_data.last_line_time'] + + # Get a eof file + eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF) + + if (eof_file) : + # Create the new geom file into dedicated repository + extendedGeom_Path = os.path.join(master_data_dir, "extended_geom") + if not os.path.exists(extendedGeom_Path): + os.makedirs(extendedGeom_Path) + + # Call SARMetadataCorrection + diapOTBApp.metadataCorrection(mode="orbits", insar=master_Image, indem=None, + infineorbits=os.path.join(eof_Path, eof_file), + outPath=os.path.join(extendedGeom_Path, + "extended_master.geom")) + + + # Assign new geom file with extended filename + master_Image += "?geom=" + os.path.join(extendedGeom_Path, + "extended_master.geom") + + + # slave + dictKWLSlave = func_utils.getImageKWL(slave_Image) + start_slave = dictKWLSlave['support_data.first_line_time'] + end_slave = dictKWLSlave['support_data.last_line_time'] + + # Get a eof file + eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF) + + if (eof_file) : + # Create the new geom file into dedicated repository + extendedGeom_Path = os.path.join(output_dir, "extended_geom") + if not os.path.exists(extendedGeom_Path): + os.makedirs(extendedGeom_Path) + + # Call SARMetadataCorrection + diapOTBApp.metadataCorrection(mode="orbits", insar=slave_Image, indem=None, + infineorbits=os.path.join(eof_Path, eof_file), + outPath=os.path.join(extendedGeom_Path, + "extended_slave.geom")) + + # Assign new geom file with extended filename + slave_Image += "?geom=" + os.path.join(extendedGeom_Path, + "extended_slave.geom") + + + func_utils.log(logging.INFO, "########### Input Images for the current execution ############## ") func_utils.log(logging.INFO, "Nb iteration : {param} with : ".format(param=counter)) func_utils.log(logging.INFO, "master_Image : {param}".format(param=master_Image)) diff --git a/python_src/SAR_MultiSlc_IW.py b/python_src/SAR_MultiSlc_IW.py index 03965645ef96069b1174219b180019ca66e4eeed..c5460fc3b040c32630cf53880351ed7167311c8c 100644 --- a/python_src/SAR_MultiSlc_IW.py +++ b/python_src/SAR_MultiSlc_IW.py @@ -95,6 +95,10 @@ if __name__ == "__main__": hgts_path = dict_Global['in']['SRTM_Path'] geoid_path = dict_Global['in']['Geoid'] + eof_Path = None + if 'EOF_Path' in dict_Global['in']: + eof_Path = dict_Global['in']['EOF_Path'] + output_dir = dict_Global['out']['Output_Path'] if not os.path.exists(output_dir): @@ -225,6 +229,12 @@ if __name__ == "__main__": func_utils.check_ifExist(hgts_path) func_utils.check_ifExist(master_Image) + # Check eof path + if eof_Path : + if not os.path.exists(eof_Path) : + func_utils.log(logging.CRITICAL, "Error, {path} does not exist. Check its path.".format(path=eof_Path)) + quit() + # ====== Check roi format (if roi) if roi : func_utils.check_roiFormat(roi) @@ -325,6 +335,72 @@ if __name__ == "__main__": os.makedirs(master_data_dir) + # ============================================== + # Retrieving informations about master and slave + # ============================================== + dictKWLMaster = func_utils.getImageKWL(master_Image) + dictKWLSlave = func_utils.getImageKWL(slave_Image) + + + # Find eof files for each image if not cosmo + # Then, create the "fine" geom (with precise orbits) + # Eventually, assign an extended filename if EOF file correspond to the image + if eof_Path : + list_ofEOF = func_utils.get_AllFilesWithExt(eof_Path, ".EOF") + + + # master + if counter <= 1 : + start_master = dictKWLMaster['support_data.first_line_time'] + end_master = dictKWLMaster['support_data.last_line_time'] + + # Get a eof file + eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF) + + if (eof_file) : + # Create the new geom file into dedicated repository + extendedGeom_Path = os.path.join(master_data_dir, "extended_geom") + if not os.path.exists(extendedGeom_Path): + os.makedirs(extendedGeom_Path) + + # Call SARMetadataCorrection + diapOTBApp.metadataCorrection(mode="orbits", insar=master_Image, indem=None, + infineorbits=os.path.join(eof_Path, eof_file), + outPath=os.path.join(extendedGeom_Path, + "extended_master.geom")) + + + # Assign new geom file with extended filename + master_Image += "?geom=" + os.path.join(extendedGeom_Path, + "extended_master.geom") + + + # slave + start_slave = dictKWLSlave['support_data.first_line_time'] + end_slave = dictKWLSlave['support_data.last_line_time'] + + # Get a eof file + eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF) + + if (eof_file) : + # Create the new geom file into dedicated repository + extendedGeom_Path = os.path.join(output_dir, "extended_geom") + if not os.path.exists(extendedGeom_Path): + os.makedirs(extendedGeom_Path) + + # Call SARMetadataCorrection + diapOTBApp.metadataCorrection(mode="orbits", insar=slave_Image, indem=None, + infineorbits=os.path.join(eof_Path, eof_file), + outPath=os.path.join(extendedGeom_Path, + "extended_slave.geom")) + + # Assign new geom file with extended filename + slave_Image += "?geom=" + os.path.join(extendedGeom_Path, + "extended_slave.geom") + + + + func_utils.log(logging.INFO, "########### Input Images for the current execution ############## ") func_utils.log(logging.INFO, "Nb iteration : {param} with : ".format(param=counter)) func_utils.log(logging.INFO, "master_Image : {param}".format(param=master_Image)) @@ -334,12 +410,6 @@ if __name__ == "__main__": func_utils.printOnStd("\n master_Image : {param} : \n".format(param=master_Image)) func_utils.printOnStd("\n slave_Image : {param} : \n".format(param=slave_Image)) - # ============================================== - # Retrieving informations about master and slave - # ============================================== - dictKWLMaster = func_utils.getImageKWL(master_Image) - dictKWLSlave = func_utils.getImageKWL(slave_Image) - # ===== Check header version if int(dictKWLMaster['header.version']) < 3 or int(dictKWLSlave['header.version']) < 3 :