diff --git a/json_schemas/schema_S1IW.json b/json_schemas/schema_S1IW.json index f8c9911633b55dd57fd265cb7f215c337b57ecab..d6ea807b104e5406207b8a17371cbe2f267cb03b 100644 --- a/json_schemas/schema_S1IW.json +++ b/json_schemas/schema_S1IW.json @@ -35,7 +35,8 @@ { "type": "object", "additionalProperties": false, - "properties": {"burst_index": {"type": "string", "pattern":"^[-0-9]+$"}} + "properties": {"burst_index": {"type": "string", "pattern":"^[-0-9]+$"}, + "optram": {"type": "number", "default": 4000}} } }, "additionalProperties": false, diff --git a/json_schemas/schema_S1SM.json b/json_schemas/schema_S1SM.json index c69614c415fceb224b544bceb16f0b746a5cd17e..b998bbca7378b7aaf19b991232bc8d33abd42e1f 100644 --- a/json_schemas/schema_S1SM.json +++ b/json_schemas/schema_S1SM.json @@ -39,6 +39,12 @@ "additionalProperties": false, "properties": {"satellite": {"type": "string"}, "mode": {"type": "string"}} + }, + "parameter": + { + "type": "object", + "additionalProperties": false, + "properties": {"optram": {"type": "number", "default": 4000}} } }, "additionalProperties": false, diff --git a/python_src/SAR_MultiSlc.py b/python_src/SAR_MultiSlc.py index 13e2f5eb8a46b6f13e4b6cdfccd95bda3b348d1d..32be6d5c12a5baaa97ff0ed58eef6a57e9c59d4e 100644 --- a/python_src/SAR_MultiSlc.py +++ b/python_src/SAR_MultiSlc.py @@ -116,10 +116,12 @@ if __name__ == "__main__": relative_orbit = "" manifest = "" light_version = "yes" - ram = 4000 + ram = str(4000) if 'parameter' in dict_Global: if 'optram' in dict_Global['parameter']: - ram = dict_Global['parameter']['optram'] + ram = str(dict_Global['parameter']['optram']) + if int(ram) > 4000 : + ram = str(4000) if 'clean' in dict_Global['parameter']: light_version = dict_Global['parameter']['clean'] light_version = func_utils.str2bool(light_version) @@ -488,7 +490,8 @@ if __name__ == "__main__": 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")) + "extended_master.geom"), + ram=ram) # Assign new geom file with extended filename @@ -514,7 +517,8 @@ if __name__ == "__main__": 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")) + "extended_slave.geom"), + ram=ram) # Assign new geom file with extended filename slave_Image += "?geom=" + os.path.join(extendedGeom_Path, @@ -544,7 +548,9 @@ if __name__ == "__main__": master_slc = master_Image_base[:30] + master_Image_base[46:53]+str(relative_orbit) + ".tif" # === Here we convert master single band CInt16 to dual band FLOAT32 # === To do so, OTB_ExtractRoi is much faster than OTB_DynamicConvert - diapOTBApp.extractROI(master_Image, os.path.join(master_data_dir, master_slc+"?&gdal:co:TILED=YES")) + diapOTBApp.extractROI(master_Image, + os.path.join(master_data_dir, master_slc+"?&gdal:co:TILED=YES"), + ram) if master_ext[0] == "h5": master_slc = master_Image_base[:35]+".tif" @@ -558,6 +564,7 @@ if __name__ == "__main__": paramPreMaster['ml_azimut'] = ml_azimut paramPreMaster['ml_gain'] = ml_gain paramPreMaster['dop_file'] = dop_file + paramPreMaster['ram'] = ram Pre_Processing.extractToMultilook(master_Image, master_Image_base, paramPreMaster, "Others", master_data_dir) @@ -571,6 +578,7 @@ if __name__ == "__main__": paramPreSlave['ml_azimut'] = ml_azimut paramPreSlave['ml_gain'] = ml_gain paramPreSlave['dop_file'] = dop_file + paramPreSlave['ram'] = ram dop0Slave = Pre_Processing.extractToMultilook(slave_Image, slave_Image_base, paramPreSlave, "Others", output_dir) @@ -613,6 +621,7 @@ if __name__ == "__main__": paramGroundMaster['nodata'] = -32768 paramGroundMaster['withxyz'] = "true" paramGroundMaster['for_slave_Image'] = False + paramGroundMaster['ram'] = ram Ground.demProjectionAndCartesianEstimation(master_Image, master_Image_base, dem, paramGroundMaster, "Others", master_data_dir) @@ -623,6 +632,7 @@ if __name__ == "__main__": paramGroundSlave['nodata'] = -32768 paramGroundSlave['withxyz'] = "true" paramGroundSlave['for_slave_Image'] = True + paramGroundSlave['ram'] = ram Ground.demProjectionAndCartesianEstimation(slave_Image, slave_Image_base, dem, paramGroundSlave, "Others", output_dir) @@ -651,6 +661,7 @@ if __name__ == "__main__": param['doppler0'] = dop0Slave param['gain_interfero'] = gain_interfero param['advantage'] = "projection" # By default projection + param['ram'] = ram if satellite == "cosmo" or satellite == "CSK": param['advantage'] = "correlation" @@ -694,6 +705,7 @@ if __name__ == "__main__": paramPost['geoGrid_gridstep_azimut'] = geoGrid_gridstep_azimut paramPost['ml_filt_interf_gain'] = gain_interfero paramPost['filt_alpha'] = interf_filt_alpha + paramPost['ram'] = ram Post_Processing.filtering(master_Image, master_Image_base, slave_Image, slave_Image_base, master_data_dir, output_dir, paramPost, @@ -705,7 +717,7 @@ if __name__ == "__main__": func_utils.silentremove(output_dir, slave_Image_ML) slave_Image_ML = os.path.splitext(slave_Image_base)[0] + "_ml" + str(ml_azimut) + str(ml_range) + ".tif" diapOTBApp.multilook(os.path.join(output_dir, slave_Image_CoRe), ml_range, ml_azimut, ml_gain, - os.path.join(output_dir, slave_Image_ML)) + os.path.join(output_dir, slave_Image_ML), ram) ### Names definition ### @@ -736,7 +748,9 @@ if __name__ == "__main__": ### ROI, Ortho and band_extract ### if func_utils.str2bool(ortho_interferogram): interf_ortho = "interferogram_ortho.tif" - diapOTBApp.orthorectification(interferogram_path, spacingxy, hgts_path, geoid_path, os.path.join(output_dir, interf_ortho)) + diapOTBApp.orthorectification(interferogram_path, spacingxy, + hgts_path, geoid_path, + os.path.join(output_dir, interf_ortho), ram) if not roi: func_utils.extract_band123(os.path.join(output_dir, interf_ortho), os.path.join(output_dir, Interfero_Ortho)) func_utils.extract_band123(interferogram_path, os.path.join(output_dir, InterferoB123)) diff --git a/python_src/SAR_MultiSlc_IW.py b/python_src/SAR_MultiSlc_IW.py index 6333fe00334ee5a33be0869394cf8fa641dd5810..854c9e4e7fffb31d0ae8ace156cf7c5444734ae1 100644 --- a/python_src/SAR_MultiSlc_IW.py +++ b/python_src/SAR_MultiSlc_IW.py @@ -132,11 +132,13 @@ if __name__ == "__main__": pol = master_Image_base.split("-")[3] iw = master_Image_base.split("-")[1] burst_index = "0-8" - ram = 4000 + ram = str(4000) light_version = "yes" if 'parameter' in dict_Global: if 'optram' in dict_Global['parameter']: - ram = dict_Global['parameter']['optram'] + ram = str(dict_Global['parameter']['optram']) + if int(ram) > 4000 : + ram = 4000 if 'clean' in dict_Global['parameter']: light_version = dict_Global['parameter']['clean'] if 'burst_index' in dict_Global['parameter']: @@ -400,7 +402,8 @@ if __name__ == "__main__": 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")) + "extended_master.geom"), + ram=ram) # Assign new geom file with extended filename @@ -425,7 +428,8 @@ if __name__ == "__main__": 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")) + "extended_slave.geom"), + ram=ram) # Assign new geom file with extended filename slave_Image += "?geom=" + os.path.join(extendedGeom_Path, @@ -523,6 +527,7 @@ if __name__ == "__main__": paramPreMaster['ml_gain'] = ml_gain paramPreMaster['dop_file'] = dop_file paramPreMaster['validBurstMaster'] = validBurstMaster + paramPreMaster['ram'] = ram dop0Master, BurstToConcatenateM, Deramp_BurstToConcatenateM = Pre_Processing.extractToMultilook(master_Image, master_Image_base, paramPreMaster, "S1_IW", Master_temp_dir) @@ -531,14 +536,16 @@ if __name__ == "__main__": # Master SLC masterSlc = master_Image_base[:30] + master_Image_base[46:53]+ "-" +str(relative_orbit) + ".tif" Con_masterSlc = os.path.join(master_data_dir, masterSlc) - diapOTBApp.concatenate(BurstToConcatenateM, master_Image, firstBurst, Con_masterSlc) + diapOTBApp.concatenate(BurstToConcatenateM, master_Image, firstBurst, + Con_masterSlc, ram) # Master deramp if light_version is not True: masterDeramp = os.path.splitext(master_Image_base)[0]+"_deramp.tif" Con_masterDeramp = os.path.join(master_data_dir, masterDeramp) - diapOTBApp.concatenate(Deramp_BurstToConcatenateM, master_Image, firstBurst, Con_masterDeramp) + diapOTBApp.concatenate(Deramp_BurstToConcatenateM, master_Image, firstBurst, + Con_masterDeramp, ram) # Slave func_utils.printOnStd("\n Slave Pre_Processing chain \n") @@ -551,6 +558,7 @@ if __name__ == "__main__": paramPreSlave['dop_file'] = dop_file paramPreSlave['validBurstMaster'] = validBurstMaster paramPreSlave['validBurstSlave'] = validBurstSlave + paramPreSlave['ram'] = ram dop0Slave, BurstToConcatenateS, Deramp_BurstToConcatenateS = Pre_Processing.extractToMultilook(slave_Image, slave_Image_base, paramPreSlave, "S1_IW", temp_dir) @@ -571,6 +579,7 @@ if __name__ == "__main__": paramGroundMaster['nodata'] = -32768 paramGroundMaster['withxyz'] = "true" paramGroundMaster['validBurstMaster'] = validBurstMaster + paramGroundMaster['ram'] = ram Ground.demProjectionAndCartesianEstimation(master_Image, master_Image_base, dem, paramGroundMaster, "S1_IW", Master_temp_dir) @@ -586,6 +595,7 @@ if __name__ == "__main__": paramGroundSlave['withxyz'] = "true" paramGroundSlave['validBurstMaster'] = validBurstMaster paramGroundSlave['validBurstSlave'] = validBurstSlave + paramGroundSlave['ram'] = ram Ground.demProjectionAndCartesianEstimation(slave_Image, slave_Image_base, dem, paramGroundSlave, "S1_IW", temp_dir) @@ -616,6 +626,7 @@ if __name__ == "__main__": param['esd_AutoMode'] = esd_AutoMode param['with_interferogram'] = version_interferogram param['with_concatenate'] = "no" + param['ram'] = ram list_of_Grids, interfToConcatenate, slaveCorRerampToConcatenate, masterRerampToConcatenate = DInSar.gridToInterferogram(dem, master_Image, master_Image_base, slave_Image, slave_Image_base, Master_temp_dir, temp_dir, param, 'S1_IW', output_dir) @@ -623,11 +634,13 @@ if __name__ == "__main__": # Slave Coregistrated Reramped slaveCorRE = slave_Image_base[:30] + slave_Image_base[46:53]+"-"+str(relative_orbit) + ".tif" Con_slaveCorRE = os.path.join(output_dir, slaveCorRE) - diapOTBApp.concatenate(slaveCorRerampToConcatenate, master_Image, firstBurst, Con_slaveCorRE) + diapOTBApp.concatenate(slaveCorRerampToConcatenate, master_Image, firstBurst, + Con_slaveCorRE, ram) masterRerampMl = os.path.splitext(master_Image_base)[0] + "_ml" + str(ml_azimut) + str(ml_range) + "Master.tif" Con_masterReramp = os.path.join(master_data_dir, masterRerampMl) - diapOTBApp.concatenate(masterRerampToConcatenate, master_Image, firstBurst, Con_masterReramp) + diapOTBApp.concatenate(masterRerampToConcatenate, master_Image, firstBurst, + Con_masterReramp, ram) # ==================================== # @@ -641,7 +654,8 @@ if __name__ == "__main__": # Multilook on coregistred CoRe_ML = os.path.splitext(slave_Image_base)[0] + "_ml" + str(ml_azimut) + str(ml_range) + ".tif" #ml(os.path.join(output_dir, slaveCorRE), os.path.join(output_dir, CoRe_ML)) - diapOTBApp.multilook(os.path.join(output_dir, slaveCorRE), ml_range, ml_azimut, ml_gain, os.path.join(output_dir, CoRe_ML)) + diapOTBApp.multilook(os.path.join(output_dir, slaveCorRE), ml_range, ml_azimut, + ml_gain, os.path.join(output_dir, CoRe_ML), ram) # A === Interferogram @@ -656,7 +670,7 @@ if __name__ == "__main__": 47:54]+"S"+sib[14:23]+"-"+sib[47:53]+"-"+str(relative_orbit)+"_interferogram.tif" Con_Interf = os.path.join(output_dir, Interferogram_Multiband) - diapOTBApp.concatenate(interfToConcatenate, master_Image, firstBurst, Con_Interf) + diapOTBApp.concatenate(interfToConcatenate, master_Image, firstBurst, Con_Interf, ram) # B === Extraction of band 1,2,3 ds = gdal.Open(os.path.join(output_dir, Interferogram_Multiband), gdal.GA_ReadOnly) @@ -673,6 +687,7 @@ if __name__ == "__main__": paramPost['ml_filt_interf_azimut'] = ml_interf_filt_azimut paramPost['filt_alpha'] = interf_filt_alpha paramPost['interf_Name'] = Con_Interf + paramPost['ram'] = ram Post_Processing.filtering(master_Image, master_Image_base, slave_Image, slave_Image_base, Master_temp_dir, temp_dir, paramPost, @@ -687,7 +702,9 @@ if __name__ == "__main__": 47:54]+"S"+sib[14:23]+"-"+sib[47:53]+"-"+str(relative_orbit)+"_Ortho-Interferogram.tif" Ortho_roi = mib[:15]+"M"+mib[14:30]+"-"+mib[ 47:54]+"S"+sib[14:23]+"-"+sib[47:53]+"-"+str(relative_orbit)+"_ROI_Ortho-Interferogram.tif" - diapOTBApp.orthorectification(os.path.join(output_dir, Interferogram_), spacingxy, hgts_path, geoid_path, os.path.join(output_dir, Ortho_)) + diapOTBApp.orthorectification(os.path.join(output_dir, Interferogram_), + spacingxy, hgts_path, geoid_path, + os.path.join(output_dir, Ortho_), ram) if roi: @@ -709,7 +726,8 @@ if __name__ == "__main__": # Multilook on master reramped Reramp_ML = os.path.splitext(master_Image_base)[0] + "_ml" + str(ml_azimut) + str(ml_range) + ".tif" - diapOTBApp.multilook(os.path.join(master_data_dir, masterRerampMl), ml_range, ml_azimut, ml_gain, os.path.join(master_data_dir, Reramp_ML)) + diapOTBApp.multilook(os.path.join(master_data_dir, masterRerampMl), ml_range, ml_azimut, + ml_gain, os.path.join(master_data_dir, Reramp_ML), ram) func_utils.silentremove(master_data_dir, masterRerampMl) func_utils.silentremove(master_data_dir, masterRerampMl.split(".")[0]+".geom") diff --git a/python_src/diapOTB.py b/python_src/diapOTB.py index 4f13ec38fb771db798b0282bd2176f2ed2c81df5..4b325b03884d287dc7018cc4500d18f2277f024a 100644 --- a/python_src/diapOTB.py +++ b/python_src/diapOTB.py @@ -82,6 +82,13 @@ if __name__ == "__main__": output_dir = dict_Global['out']['output_dir'] + ram = str(4000) + if 'parameter' in dict_Global: + if 'optram' in dict_Global['parameter']: + ram = str(dict_Global['parameter']['optram']) + if int(ram) > 4000 : + ram = str(4000) + satellite = "default" mode = "default" @@ -336,7 +343,8 @@ if __name__ == "__main__": 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")) + "extended_master.geom"), + ram=ram) # Assign new geom file with extended filename @@ -362,7 +370,8 @@ if __name__ == "__main__": 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")) + "extended_slave.geom"), + ram=ram) # Assign new geom file with extended filename slave_Image += "?geom=" + os.path.join(extendedGeom_Path, @@ -381,6 +390,7 @@ if __name__ == "__main__": paramPreMaster['ml_azimut'] = ml_azimut paramPreMaster['ml_gain'] = ml_gain paramPreMaster['dop_file'] = dop_file + paramPreMaster['ram'] = ram dop0Master = Pre_Processing.extractToMultilook(master_Image, master_Image_base, paramPreMaster, "Others", output_dir) @@ -393,6 +403,7 @@ if __name__ == "__main__": paramPreSlave['ml_azimut'] = ml_azimut paramPreSlave['ml_gain'] = ml_gain paramPreSlave['dop_file'] = dop_file + paramPreSlave['ram'] = ram dop0Slave = Pre_Processing.extractToMultilook(slave_Image, slave_Image_base, paramPreSlave, "Others", output_dir) @@ -425,7 +436,8 @@ if __name__ == "__main__": paramGroundMaster['nodata'] = -32768 paramGroundMaster['withxyz'] = "true" paramGroundMaster['for_slave_Image'] = False - + paramGroundMaster['ram'] = ram + Ground.demProjectionAndCartesianEstimation(master_Image, master_Image_base, dem, paramGroundMaster, "Others", output_dir) @@ -438,7 +450,8 @@ if __name__ == "__main__": paramGroundSlave['nodata'] = -32768 paramGroundSlave['withxyz'] = "true" paramGroundSlave['for_slave_Image'] = True - + paramGroundSlave['ram'] = ram + Ground.demProjectionAndCartesianEstimation(slave_Image, slave_Image_base, dem, paramGroundSlave, "Others", output_dir) @@ -466,6 +479,7 @@ if __name__ == "__main__": param['doppler0'] = dop0Slave param['gain_interfero'] = gain_interfero param['advantage'] = advantage + param['ram'] = ram DInSar.gridToInterferogram(dem, master_Image, master_Image_base, slave_Image, slave_Image_base, output_dir, output_dir, param, "Others", output_dir) @@ -487,6 +501,7 @@ if __name__ == "__main__": paramPost['geoGrid_gridstep_azimut'] = geoGrid_gridstep_azimut paramPost['ml_filt_interf_gain'] = gain_interfero paramPost['filt_alpha'] = interf_filt_alpha + paramPost['ram'] = ram Post_Processing.filtering(master_Image, master_Image_base, slave_Image, slave_Image_base, output_dir, output_dir, paramPost, "Others", output_dir) diff --git a/python_src/diapOTB_S1IW.py b/python_src/diapOTB_S1IW.py index a0b4d7d0b5359b8aff11111dad810e142bdd92fc..66fc73697b312a681a1743f15133f7cefcc1abb8 100644 --- a/python_src/diapOTB_S1IW.py +++ b/python_src/diapOTB_S1IW.py @@ -81,6 +81,13 @@ if __name__ == "__main__": output_dir = dict_Global['out']['output_dir'] + ram = str(4000) + if 'parameter' in dict_Global: + if 'optram' in dict_Global['parameter']: + ram = str(dict_Global['parameter']['optram']) + if int(ram) > 4000 : + ram = 4000 + # Pre_Processing ml_range = dict_PreProcessing['parameter']['ML_range'] ml_azimut = dict_PreProcessing['parameter']['ML_azimut'] @@ -295,7 +302,8 @@ if __name__ == "__main__": 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")) + "extended_master.geom"), + ram=ram) # Assign new geom file with extended filename @@ -321,7 +329,8 @@ if __name__ == "__main__": 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")) + "extended_slave.geom"), + ram=ram) # Assign new geom file with extended filename slave_Image += "?geom=" + os.path.join(extendedGeom_Path, @@ -341,6 +350,7 @@ if __name__ == "__main__": paramPreMaster['ml_gain'] = ml_gain paramPreMaster['dop_file'] = dop_file paramPreMaster['validBurstMaster'] = validBurstMaster + paramPreMaster['ram'] = ram results_PreProM = Pre_Processing.extractToMultilook(master_Image, master_Image_base, paramPreMaster, "S1_IW", output_dir) @@ -358,6 +368,7 @@ if __name__ == "__main__": paramPreSlave['dop_file'] = dop_file paramPreSlave['validBurstMaster'] = validBurstMaster paramPreSlave['validBurstSlave'] = validBurstSlave + paramPreSlave['ram'] = ram results_PreProS = Pre_Processing.extractToMultilook(slave_Image, slave_Image_base, paramPreSlave, "S1_IW", output_dir) @@ -373,7 +384,8 @@ if __name__ == "__main__": paramGroundMaster['nodata'] = -32768 paramGroundMaster['withxyz'] = "true" paramGroundMaster['validBurstMaster'] = validBurstMaster - + paramGroundMaster['ram'] = ram + Ground.demProjectionAndCartesianEstimation(master_Image, master_Image_base, dem, paramGroundMaster, "S1_IW", output_dir) @@ -387,7 +399,8 @@ if __name__ == "__main__": paramGroundSlave['withxyz'] = "true" paramGroundSlave['validBurstMaster'] = validBurstMaster paramGroundSlave['validBurstSlave'] = validBurstSlave - + paramGroundSlave['ram'] = ram + Ground.demProjectionAndCartesianEstimation(slave_Image, slave_Image_base, dem, paramGroundSlave, "S1_IW", output_dir) @@ -416,6 +429,7 @@ if __name__ == "__main__": param['advantage'] = advantage param['esd_NbIter'] = esd_NbIter param['esd_AutoMode'] = esd_AutoMode + param['ram'] = ram DInSar.gridToInterferogram(dem, master_Image, master_Image_base, slave_Image, slave_Image_base, output_dir, output_dir, param, 'S1_IW', output_dir) @@ -434,6 +448,7 @@ if __name__ == "__main__": paramPost['ml_filt_interf_range'] = ml_interf_filt_range paramPost['ml_filt_interf_azimut'] = ml_interf_filt_azimut paramPost['filt_alpha'] = interf_filt_alpha + paramPost['ram'] = ram Post_Processing.filtering(master_Image, master_Image_base, slave_Image, slave_Image_base, output_dir, output_dir, paramPost, "S1_IW", output_dir) diff --git a/python_src/ex_config/ex_config_MultiSlc_CosmoS1SM.json b/python_src/ex_config/ex_config_MultiSlc_CosmoS1SM.json index 2d6d713282d3e68230b19c108a01037cb27954cc..cf1c662ea8f7e3aa1aefae66a88b37b171ae31ac 100644 --- a/python_src/ex_config/ex_config_MultiSlc_CosmoS1SM.json +++ b/python_src/ex_config/ex_config_MultiSlc_CosmoS1SM.json @@ -16,7 +16,8 @@ }, "parameter": { - "clean" : "true" + "clean" : "true", + "optram" : 256 } }, diff --git a/python_src/ex_config/ex_config_MultiSlc_IW.json b/python_src/ex_config/ex_config_MultiSlc_IW.json index d3b49b9c617936612d094d6f3b5552b7ed443d34..f86a42321d331d92582009480d1ee5dae8df28e8 100644 --- a/python_src/ex_config/ex_config_MultiSlc_IW.json +++ b/python_src/ex_config/ex_config_MultiSlc_IW.json @@ -18,7 +18,7 @@ { "clean" : "true", "burst_index": "0-8", - "optram" : 4000 + "optram" : 256 } }, diff --git a/python_src/ex_config/ex_config_diapOTB_Cosmo.json b/python_src/ex_config/ex_config_diapOTB_Cosmo.json index c269e69b6896466c1bbb1ad4a4794a55a7b7a33d..47f2226446639e6c3827b8c458408b1c9bd7f242 100644 --- a/python_src/ex_config/ex_config_diapOTB_Cosmo.json +++ b/python_src/ex_config/ex_config_diapOTB_Cosmo.json @@ -9,6 +9,10 @@ "out": { "output_dir": "./output_diapOTB" + }, + "parameter": + { + "optram" : 256 } }, diff --git a/python_src/ex_config/ex_config_diapOTB_S1IW.json b/python_src/ex_config/ex_config_diapOTB_S1IW.json index e049d0c4968e67440d69366f3d97bb9775bf320a..fb2b65daafa7ce0a9ecdb268edecba799036468d 100644 --- a/python_src/ex_config/ex_config_diapOTB_S1IW.json +++ b/python_src/ex_config/ex_config_diapOTB_S1IW.json @@ -12,7 +12,8 @@ }, "parameter": { - "burst_index": "0-8" + "burst_index": "0-8", + "optram" : 256 } }, diff --git a/python_src/ex_config/ex_config_diapOTB_S1SM.json b/python_src/ex_config/ex_config_diapOTB_S1SM.json index 6f049d5d5cfabd125b1522fb5543df3ed08638e7..04993f703127edb8ff06c510487c5d6dfb19203a 100644 --- a/python_src/ex_config/ex_config_diapOTB_S1SM.json +++ b/python_src/ex_config/ex_config_diapOTB_S1SM.json @@ -9,7 +9,12 @@ "out": { "output_dir": "./output_diapOTB" + }, + "parameter": + { + "optram" : 256 } + }, "Pre_Processing": { diff --git a/python_src/processings/DInSar.py b/python_src/processings/DInSar.py index a73fc76f5ba7fb5d664460dcdcc25091e995b54e..78a6f21eb60b303052c51bbb997d262786f6fbbe 100644 --- a/python_src/processings/DInSar.py +++ b/python_src/processings/DInSar.py @@ -42,7 +42,9 @@ import otbApplication as otb # Coorection for interferograms thanks to esd shifts -def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_base, slave_Image_base, gridsteprange, gridstepazimut, gain, output_dir, master_dir, doppler0, iter_esd, list_of_Grids, azimut_shift_esd, azimut_shift_esd_global) : +def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_base, slave_Image_base, + gridsteprange, gridstepazimut, gain, output_dir, master_dir, doppler0, + iter_esd, list_of_Grids, azimut_shift_esd, azimut_shift_esd_global, ram) : """ Correct interferograms with esd shifts. @@ -122,7 +124,7 @@ def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_ba appGridOff.SetParameterString("ingrid", list_of_Grids[burstId-firstBurst]) appGridOff.SetParameterFloat("offsetran", 0.) appGridOff.SetParameterFloat("offsetazi", aziShift) - appGridOff.SetParameterString("ram", "4000") + appGridOff.SetParameterString("ram", ram) appGridOff.SetParameterString("out", gridOffset_path) appGridOff.Execute() @@ -143,7 +145,7 @@ def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_ba appCoRegistration.SetParameterInt("sizetiles", 50) appCoRegistration.SetParameterInt("margin", 7) appCoRegistration.SetParameterInt("nbramps", 5121) #256*2*10+1 - appCoRegistration.SetParameterString("ram", "4000") + appCoRegistration.SetParameterString("ram", ram) appCoRegistration.SetParameterString("out", coRe_path) appCoRegistration.Execute() @@ -163,7 +165,7 @@ def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_ba appDerampSlave.SetParameterString("inslave", os.path.join(burst_dir, burstDerampS)) appDerampSlave.SetParameterInt("gridsteprange", gridsteprange) appDerampSlave.SetParameterInt("gridstepazimut", gridstepazimut) - appDerampSlave.SetParameterString("ram", "4000") + appDerampSlave.SetParameterString("ram", ram) appDerampSlave.Execute() @@ -184,7 +186,7 @@ def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_ba appInterferogram.SetParameterInt("gridsteprange", gridsteprange) appInterferogram.SetParameterInt("gridstepazimut", gridstepazimut) appInterferogram.SetParameterFloat("gain", gain) - appInterferogram.SetParameterString("ram", "4000") + appInterferogram.SetParameterString("ram", ram) appInterferogram.SetParameterString("out", interferogram_path) appInterferogram.ExecuteAndWriteOutput() @@ -193,7 +195,8 @@ def esd_correct_interferogram(validBurstMaster, validBurstSlave, master_Image_ba return list_of_Interferograms -def gridToInterferogram(dem, master_Image, master_Image_base, slave_Image, slave_Image_base, master_dir, slave_dir, param, mode, output_dir): +def gridToInterferogram(dem, master_Image, master_Image_base, slave_Image, + slave_Image_base, master_dir, slave_dir, param, mode, output_dir): """ Main function for DInSAR processing @@ -288,21 +291,32 @@ def gridToInterferogram_Others(dem, master_Image, master_Image_base, slave_Image if "with_interferogram" in param : with_interferogram = func_utils.str2bool(param['with_interferogram']) + ram = "4000" + if "ram" in param : + ram = param['ram'] + print("doppler0 = " + str(doppler0)) nbramps = 257 # define applications functions with the previous parameters - fineGridDeformationApp = partial(diapOTBApp.fineGridDeformation, indem=dem, mlran=ml_geoGrid_range, - mlazi=ml_geoGrid_azimut, gridsteprange=geoGrid_gridstep_range, + fineGridDeformationApp = partial(diapOTBApp.fineGridDeformation, indem=dem, + mlran=ml_geoGrid_range, mlazi=ml_geoGrid_azimut, + gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, - threshold=geoGrid_threshold, gap=geoGrid_gap, advantage=advantage) + threshold=geoGrid_threshold, gap=geoGrid_gap, + advantage=advantage, ram=ram) - coRegistrationApp = partial(diapOTBApp.coRegistration, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, nbramps=nbramps) + coRegistrationApp = partial(diapOTBApp.coRegistration, gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, nbramps=nbramps, ram=ram) - derampApp = partial(diapOTBApp.deramp, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, reramp="true", shift="true") + derampApp = partial(diapOTBApp.deramp, gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, reramp="true", shift="true", + ram=ram) - interferogramApp = partial(diapOTBApp.interferogram, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, mlran=ml_interf_range, mlazi=ml_interf_azimut, gain=gain_interfero) + interferogramApp = partial(diapOTBApp.interferogram, gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, mlran=ml_interf_range, + mlazi=ml_interf_azimut, gain=gain_interfero, ram=ram) # Empty list @@ -421,20 +435,32 @@ def gridToInterferogram_S1IW(dem, master_Image, master_Image_base, slave_Image, if "with_concatenate" in param : with_concatenate = func_utils.str2bool(param['with_concatenate']) - + ram = "4000" + if "ram" in param : + ram = param['ram'] + nbramps = 256*2*10+1 # define applications functions with the previous parameters - fineGridDeformationApp = partial(diapOTBApp.fineGridDeformation, indem=dem, mlran=ml_geoGrid_range, mlazi=ml_geoGrid_azimut, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, - threshold=geoGrid_threshold, gap=geoGrid_gap, advantage=advantage) + fineGridDeformationApp = partial(diapOTBApp.fineGridDeformation, indem=dem, + mlran=ml_geoGrid_range, mlazi=ml_geoGrid_azimut, + gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, + threshold=geoGrid_threshold, + gap=geoGrid_gap, advantage=advantage, ram=ram) - coRegistrationApp = partial(diapOTBApp.coRegistration, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, nbramps=nbramps) + coRegistrationApp = partial(diapOTBApp.coRegistration, gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, nbramps=nbramps, ram=ram) - derampApp = partial(diapOTBApp.deramp, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, reramp="true", shift="true") + derampApp = partial(diapOTBApp.deramp, gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, reramp="true", shift="true", + ram=ram) - interferogramApp = partial(diapOTBApp.interferogram, gridsteprange=geoGrid_gridstep_range, gridstepazimut=geoGrid_gridstep_azimut, mlran=1, mlazi=1, gain=gain_interfero) + interferogramApp = partial(diapOTBApp.interferogram, gridsteprange=geoGrid_gridstep_range, + gridstepazimut=geoGrid_gridstep_azimut, mlran=1, mlazi=1, + gain=gain_interfero, ram=ram) - esdApp = partial(diapOTBApp.esd, insar=master_Image) + esdApp = partial(diapOTBApp.esd, insar=master_Image, ram=ram) esdCorrectInterferogram = partial(esd_correct_interferogram, validBurstMaster, validBurstSlave, master_Image_base, slave_Image_base, geoGrid_gridstep_range, geoGrid_gridstep_azimut, gain_interfero, slave_dir, master_dir, doppler0) @@ -576,7 +602,7 @@ def gridToInterferogram_S1IW(dem, master_Image, master_Image_base, slave_Image, # Correction of Interferogram with the esd shift # new reference => new list of interferograms list_of_Interferograms = esdCorrectInterferogram(iter_esd, list_of_Grids, azimut_shift_esd, - azimut_shift_esd_global) + azimut_shift_esd_global, ram) # Check azimuth shift to end esd loop if automatic mode enabled if esd_AutoMode : @@ -590,7 +616,8 @@ def gridToInterferogram_S1IW(dem, master_Image, master_Image_base, slave_Image, if with_interferogram and with_concatenate : print("\n SARConcatenateBursts Application (for interferograms) \n") interferogram_swath = "interferogram_swath.tif" - diapOTBApp.concatenate(list_of_Interferograms, master_Image, firstBurst, os.path.join(output_dir, interferogram_swath)) + diapOTBApp.concatenate(list_of_Interferograms, master_Image, + firstBurst, os.path.join(output_dir, interferogram_swath), ram) # Output lists return list_of_Grids, list_of_Interferograms, list_of_slaveCorReramp, list_of_masterReramp diff --git a/python_src/processings/Ground.py b/python_src/processings/Ground.py index 966699d1e44f4ae5db390b47a42527eeea5123ef..50dd3cbced13b97c2087e846b3e435e06191f705 100644 --- a/python_src/processings/Ground.py +++ b/python_src/processings/Ground.py @@ -93,6 +93,9 @@ def demProjectionAndCartesianEstimation_Others(sar_Image, sar_Image_base, dem, p withxyz = param['withxyz'] for_slave_Image = param['for_slave_Image'] + ram = "4000" + if "ram" in param : + ram = param['ram'] ## SARDEMProjection Application ## print("\n SARDEMProjection Application \n") @@ -102,7 +105,7 @@ def demProjectionAndCartesianEstimation_Others(sar_Image, sar_Image_base, dem, p demProj = "demProj" +extProj - directiontoscandemc, directiontoscandeml, gain = diapOTBApp.demProjection(insar=sar_Image, indem=dem, withxyz=withxyz, outPath=os.path.join(output_dir, demProj), nodata=nodata) + directiontoscandemc, directiontoscandeml, gain = diapOTBApp.demProjection(insar=sar_Image, indem=dem, withxyz=withxyz, outPath=os.path.join(output_dir, demProj), nodata=nodata, ram=ram) if not for_slave_Image : @@ -111,9 +114,11 @@ def demProjectionAndCartesianEstimation_Others(sar_Image, sar_Image_base, dem, p master_cartesian_mean = "CartMeanMaster.tif" diapOTBApp.cartesianMeanEstimation(insar=sar_Image, indem=dem, - indemproj=os.path.join(output_dir, demProj), - indirectiondemc=directiontoscandemc, indirectiondeml=directiontoscandeml, - outPath=os.path.join(output_dir, master_cartesian_mean)) + indemproj=os.path.join(output_dir, demProj), + indirectiondemc=directiontoscandemc, + indirectiondeml=directiontoscandeml, + outPath=os.path.join(output_dir, master_cartesian_mean), + ram=ram) def demProjectionAndCartesianEstimation_S1IW(sar_Image, sar_Image_base, dem, param, output_dir): @@ -146,6 +151,10 @@ def demProjectionAndCartesianEstimation_S1IW(sar_Image, sar_Image_base, dem, par validBurstSlave = param['validBurstSlave'] for_slave_Image = True + ram = "4000" + if "ram" in param : + ram = param['ram'] + # Loop on burst for id_loop in range(0, len(validBurstMaster)): @@ -170,7 +179,7 @@ def demProjectionAndCartesianEstimation_S1IW(sar_Image, sar_Image_base, dem, par demProj = "demProj" + "_burst" + str(burstId) +extProj - directiontoscandemc, directiontoscandeml, gain = diapOTBApp.demProjection(insar=os.path.join(burst_dir, burstDeramp), indem=dem, withxyz=withxyz, outPath=os.path.join(burst_dir, demProj), nodata=nodata) + directiontoscandemc, directiontoscandeml, gain = diapOTBApp.demProjection(insar=os.path.join(burst_dir, burstDeramp), indem=dem, withxyz=withxyz, outPath=os.path.join(burst_dir, demProj), nodata=nodata ,ram=ram) if not for_slave_Image : @@ -181,4 +190,4 @@ def demProjectionAndCartesianEstimation_S1IW(sar_Image, sar_Image_base, dem, par diapOTBApp.cartesianMeanEstimation(insar=os.path.join(burst_dir, burstDeramp), indem=dem, indemproj=os.path.join(burst_dir, demProj), indirectiondemc=directiontoscandemc, indirectiondeml=directiontoscandeml, - outPath=os.path.join(burst_dir, master_cartesian_mean)) + outPath=os.path.join(burst_dir, master_cartesian_mean), ram=ram) diff --git a/python_src/processings/Post_Processing.py b/python_src/processings/Post_Processing.py index 07f62b980e53d9c4f71d5364e12d62d3ac3fca7c..dd854dbfdc7448330b800fdf6e8e653c4f3e0e67 100644 --- a/python_src/processings/Post_Processing.py +++ b/python_src/processings/Post_Processing.py @@ -125,12 +125,15 @@ def filtering_Others(master_Image, master_Image_base, slave_Image, slave_Image_b if "filt_alpha" in param : alpha = param['filt_alpha'] + + ram = "4000" + if "ram" in param : + ram = param['ram'] geoGrid_gridstep_range = param['geoGrid_gridstep_range'] geoGrid_gridstep_azimut = param['geoGrid_gridstep_azimut'] - # Filtering : Pipeline in memory (=> Execute and direct calls to applications) master_cartesian_mean = "CartMeanMaster.tif" fine_grid = "fineDeformationGrid.tif" @@ -151,6 +154,7 @@ def filtering_Others(master_Image, master_Image_base, slave_Image, slave_Image_b appTopoPhase.SetParameterInt("mlazi", 1) appTopoPhase.SetParameterInt("gridsteprange", geoGrid_gridstep_range) appTopoPhase.SetParameterInt("gridstepazimut", geoGrid_gridstep_azimut) + appTopoPhase.SetParameterString("ram", ram) appTopoPhase.SetParameterString("out", os.path.join(filt_dir, topographicPhase)) appTopoPhase.Execute() @@ -169,7 +173,7 @@ def filtering_Others(master_Image, master_Image_base, slave_Image, slave_Image_b appComplex.SetParameterString("insarmaster", master_Image) appComplex.SetParameterInputImage("topographicphase", appTopoPhase.GetParameterOutputImage("out")) - appComplex.SetParameterString("ram", "4000") + appComplex.SetParameterString("ram", ram) appComplex.SetParameterString("out", os.path.join(filt_dir, complexImg)) appComplex.Execute() @@ -184,7 +188,7 @@ def filtering_Others(master_Image, master_Image_base, slave_Image, slave_Image_b appPhaFiltering.SetParameterInt("sizetiles", 64) appPhaFiltering.SetParameterFloat("alpha", alpha) appPhaFiltering.SetParameterString("out", filt_phacoh_path) - appPhaFiltering.SetParameterString("ram", "4000") + appPhaFiltering.SetParameterString("ram", ram) appPhaFiltering.ExecuteAndWriteOutput() @@ -197,7 +201,7 @@ def filtering_Others(master_Image, master_Image_base, slave_Image, slave_Image_b appAddAmp.SetParameterInt("mlazi", ml_filt_interf_azimut) appAddAmp.SetParameterFloat("gain", ml_filt_interf_gain) appAddAmp.SetParameterString("out", os.path.join(output_dir, filt_interferogram)) - appAddAmp.SetParameterString("ram", "4000") + appAddAmp.SetParameterString("ram", ram) appAddAmp.ExecuteAndWriteOutput() @@ -250,14 +254,18 @@ def filtering_S1IW(master_Image, master_Image_base, slave_Image, slave_Image_bas if "filt_alpha" in param : alpha = param['filt_alpha'] + ram = "4000" + if "ram" in param : + ram = param['ram'] + # define partial function with previous parameters phaseFilteringApp = partial(diapOTBApp.phaseFiltering, withComplex="false", mlran=ml_filt_interf_range, mlazi=ml_filt_interf_azimut, step=16, - sizetiles=64, alpha=alpha) + sizetiles=64, alpha=alpha, ram=ram) addAmpApp = partial(diapOTBApp.addAmpInterferogram, withComplex="false", mlran=ml_filt_interf_range, mlazi=ml_filt_interf_azimut, - gain=ml_filt_interf_gain) + gain=ml_filt_interf_gain, ram=ram) filt_dir = os.path.join(output_dir, "filt") diff --git a/python_src/processings/Pre_Processing.py b/python_src/processings/Pre_Processing.py index 3fd1d5b6978d1006f1c3e43a8384efdcb741cc44..636ea1f25060eaa66572f330465c5e21866ae7ca 100644 --- a/python_src/processings/Pre_Processing.py +++ b/python_src/processings/Pre_Processing.py @@ -95,8 +95,13 @@ def extractToMultilook_Others(sar_Image, sar_Image_base, param, output_dir): ml_gain = param['ml_gain'] dop_file = param['dop_file'] + ram = "4000" + if "ram" in param : + ram = param['ram'] + # Define some applications functions with the previous parameters - multilookApp = partial(diapOTBApp.multilook, mlran=ml_range, mlazi=ml_azimut, mlgain=ml_gain) + multilookApp = partial(diapOTBApp.multilook, mlran=ml_range, mlazi=ml_azimut, mlgain=ml_gain, + ram=ram) # Create an empty list dop0 = 0 @@ -104,7 +109,7 @@ def extractToMultilook_Others(sar_Image, sar_Image_base, param, output_dir): ## SARDoppler Application ## print("\n Doppler Application \n") dop0 = diapOTBApp.doppler0(insar=sar_Image, - outPath=os.path.join(output_dir, dop_file)) + outPath=os.path.join(output_dir, dop_file), ram=ram) ## SARMultiLook Application ## print("\n MultiLook Application \n") @@ -152,12 +157,18 @@ def extractToMultilook_S1IW(sar_Image, sar_Image_base, param, output_dir): if "validBurstSlave" in param : validBurstSlave = param['validBurstSlave'] for_slave_Image = True + + ram = "4000" + if "ram" in param : + ram = param['ram'] + # Define some applications functions with the previous parameters - multilookApp = partial(diapOTBApp.multilook, mlran=ml_range, mlazi=ml_azimut, mlgain=ml_gain) + multilookApp = partial(diapOTBApp.multilook, mlran=ml_range, mlazi=ml_azimut, mlgain=ml_gain, + ram=ram) derampApp = partial(diapOTBApp.deramp, reramp="false", shift="false", ingrid="", inslave="", - gridsteprange=0, gridstepazimut=0) + gridsteprange=0, gridstepazimut=0,ram=ram) # Create an empty lists dop0 = [] @@ -181,7 +192,7 @@ def extractToMultilook_S1IW(sar_Image, sar_Image_base, param, output_dir): print("\n Burst Extraction Application \n") burst = os.path.splitext(sar_Image_base)[0] + "_burst" + str(burstId) + ".tif" - diapOTBApp.burstExtraction(sar_Image, burstId, os.path.join(burst_dir, burst)) + diapOTBApp.burstExtraction(sar_Image, burstId, os.path.join(burst_dir, burst), ram=ram) bursts.append(os.path.join(burst_dir, burst)) @@ -195,7 +206,7 @@ def extractToMultilook_S1IW(sar_Image, sar_Image_base, param, output_dir): ## SARDoppler Application ## print("\n Doppler Application \n") dop0.append(diapOTBApp.doppler0(insar=os.path.join(burst_dir, burstDeramp), - outPath=os.path.join(output_dir, dop_file))) + outPath=os.path.join(output_dir, dop_file), ram=ram)) ## SARMultiLook Application ## print("\n MultiLook Application \n") diff --git a/python_src/utils/DiapOTB_applications.py b/python_src/utils/DiapOTB_applications.py index ae7ab0c6400fe933dc1d028b2eb7f649b848c2a7..fbce0de3fc53b5a96a6c773fee4094921ed884fd 100644 --- a/python_src/utils/DiapOTB_applications.py +++ b/python_src/utils/DiapOTB_applications.py @@ -128,7 +128,7 @@ def doppler0(insar, outPath, ram="4000"): appDoppler0 = otb.Registry.CreateApplication("SARDoppler0") appDoppler0.SetParameterString("insar", insar) appDoppler0.SetParameterString("outfile", outPath) - appDoppler0.SetParameterString("ram", "4000") + appDoppler0.SetParameterString("ram", ram) appDoppler0.ExecuteAndWriteOutput() return appDoppler0.GetParameterFloat('doppler0')