Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diapotb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luc Hermitte
diapotb
Commits
e43984e7
Commit
e43984e7
authored
6 years ago
by
Gaëlle USSEGLIO
Browse files
Options
Downloads
Patches
Plain Diff
UPDATE : DIn_SAR Chain into DiapOTB.py
parent
bd240955
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python_src/diapOTB.py
+141
-13
141 additions, 13 deletions
python_src/diapOTB.py
python_src/ex_config.ini
+8
-1
8 additions, 1 deletion
python_src/ex_config.ini
with
149 additions
and
14 deletions
python_src/diapOTB.py
+
141
−
13
View file @
e43984e7
...
...
@@ -64,12 +64,13 @@ def ConfigSectionMap(config, section):
def
ConfigCheck
(
config
):
configOk
=
True
# List for configuration
listOfSections
=
[
"
Global
"
,
"
Pre_Processing
"
,
"
Calibration
"
]
listOfSections
=
[
"
Global
"
,
"
Pre_Processing
"
,
"
Calibration
"
,
"
DIn_SAR
"
]
globalList
=
[
"
Master_Image_Path
"
,
"
Slave_Image_Path
"
,
"
DEM_Path
"
,
"
output_dir
"
]
preProcessingList
=
[
"
ML_range
"
,
"
ML_azimut
"
,
"
ML_gain
"
,
"
doppler_file
"
]
calibrationList
=
[
"
activate
"
,
"
GridStep_range
"
,
"
GridStep_azimut
"
,
"
fine_metadata_file
"
]
dInSARList
=
[
"
GridStep_range
"
,
"
GridStep_azimut
"
,
"
Grid_Threshold
"
,
"
Grid_Gap
"
,
"
Interferogram_gain
"
]
dictOfSections
=
{
'
Global
'
:
globalList
,
'
Pre_Processing
'
:
preProcessingList
,
'
Calibration
'
:
calibrationList
}
dictOfSections
=
{
'
Global
'
:
globalList
,
'
Pre_Processing
'
:
preProcessingList
,
'
Calibration
'
:
calibrationList
,
'
DIn_SAR
'
:
dInSARList
}
# For each elt of listOfSections
for
section
in
listOfSections
:
...
...
@@ -134,7 +135,18 @@ if __name__ == "__main__":
correlSimu_gridstep_range
=
int
(
ConfigSectionMap
(
Config
,
"
Calibration
"
)[
'
gridstep_range
'
])
correlSimu_gridstep_azimut
=
int
(
ConfigSectionMap
(
Config
,
"
Calibration
"
)[
'
gridstep_azimut
'
])
fine_metadata_file
=
ConfigSectionMap
(
Config
,
"
Calibration
"
)[
'
fine_metadata_file
'
]
# DIn_SAR
geoGrid_gridstep_range
=
int
(
ConfigSectionMap
(
Config
,
"
DIn_SAR
"
)[
'
gridstep_range
'
])
geoGrid_gridstep_azimut
=
int
(
ConfigSectionMap
(
Config
,
"
DIn_SAR
"
)[
'
gridstep_azimut
'
])
geoGrid_threshold
=
float
(
ConfigSectionMap
(
Config
,
"
DIn_SAR
"
)[
'
grid_threshold
'
])
geoGrid_gap
=
float
(
ConfigSectionMap
(
Config
,
"
DIn_SAR
"
)[
'
grid_gap
'
])
ml_geoGrid_range
=
ml_range
ml_geoGrid_azimut
=
ml_azimut
gain_interfero
=
float
(
ConfigSectionMap
(
Config
,
"
DIn_SAR
"
)[
'
interferogram_gain
'
])
if
(
geoGrid_threshold
<
0
)
or
(
geoGrid_threshold
>
1
)
:
print
(
"
Wrong Threshold for fine deformation grid
"
)
# Check if images exist
if
not
os
.
path
.
exists
(
master_Image
)
:
...
...
@@ -167,7 +179,7 @@ if __name__ == "__main__":
appDoppler0Master
=
otb
.
Registry
.
CreateApplication
(
"
SARDoppler0
"
)
appDoppler0Master
.
SetParameterString
(
"
insar
"
,
master_Image
)
appDoppler0Master
.
SetParameterString
(
"
outfile
"
,
os
.
path
.
join
(
output_dir
,
dop_file
))
appDoppler0Master
.
SetParameter
Int
(
"
ram
"
,
4000
)
appDoppler0Master
.
SetParameter
String
(
"
ram
"
,
"
4000
"
)
appDoppler0Master
.
ExecuteAndWriteOutput
()
# Slave
...
...
@@ -177,9 +189,10 @@ if __name__ == "__main__":
appDoppler0Slave
=
otb
.
Registry
.
CreateApplication
(
"
SARDoppler0
"
)
appDoppler0Slave
.
SetParameterString
(
"
insar
"
,
slave_Image
)
appDoppler0Slave
.
SetParameterString
(
"
outfile
"
,
os
.
path
.
join
(
output_dir
,
dop_file
))
appDoppler0Slave
.
SetParameter
Int
(
"
ram
"
,
4000
)
appDoppler0Slave
.
SetParameter
String
(
"
ram
"
,
"
4000
"
)
appDoppler0Slave
.
ExecuteAndWriteOutput
()
####### SARMultiLook Application #######
# Master
master_Image_ML
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
...
...
@@ -189,7 +202,7 @@ if __name__ == "__main__":
appMultiLookMaster
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appMultiLookMaster
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appMultiLookMaster
.
SetParameterFloat
(
"
mlgain
"
,
ml_gain
)
appMultiLookMaster
.
SetParameter
Int
(
"
ram
"
,
4000
)
appMultiLookMaster
.
SetParameter
String
(
"
ram
"
,
"
4000
"
)
appMultiLookMaster
.
ExecuteAndWriteOutput
()
# Slave
...
...
@@ -200,15 +213,14 @@ if __name__ == "__main__":
appMultiLookSlave
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appMultiLookSlave
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appMultiLookSlave
.
SetParameterFloat
(
"
mlgain
"
,
ml_gain
)
appMultiLookSlave
.
SetParameter
Int
(
"
ram
"
,
4000
)
appMultiLookSlave
.
SetParameter
String
(
"
ram
"
,
"
4000
"
)
appMultiLookSlave
.
ExecuteAndWriteOutput
()
######################## Calibration Chain #############################
if
activateCalibration
:
# ######################## Calibration Chain #############################
if
activateCalibration
:
######## SARDEMToAmplitude Application (Simu_SAR step) #######
amplitude_simu_image
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_simuSAR
"
+
"
_ml
"
+
str
(
ml_simu_azimut
)
+
str
(
ml_simu_range
)
+
"
.tif
"
appDEMToAmplitude
=
otb
.
Registry
.
CreateApplication
(
"
SARDEMToAmplitude
"
)
...
...
@@ -218,10 +230,11 @@ if __name__ == "__main__":
appDEMToAmplitude
.
SetParameterInt
(
"
mlran
"
,
ml_simu_range
)
appDEMToAmplitude
.
SetParameterInt
(
"
mlazi
"
,
ml_simu_azimut
)
appDEMToAmplitude
.
SetParameterFloat
(
"
mlgain
"
,
ml_simu_gain
)
appDEMToAmplitude
.
SetParameter
Int
(
"
ram
"
,
4000
)
appDEMToAmplitude
.
SetParameter
String
(
"
ram
"
,
"
4000
"
)
#appDEMToAmplitude.Execute()
appDEMToAmplitude
.
ExecuteAndWriteOutput
()
######## SARCorrelationGrid Application (Correl step) #######
correl_grid
=
"
correl_simu
"
+
"
_gridstep
"
+
str
(
correlSimu_gridstep_azimut
)
+
str
(
correlSimu_gridstep_range
)
+
"
.tif
"
appCorGrid
=
otb
.
Registry
.
CreateApplication
(
"
SARCorrelationGrid
"
)
...
...
@@ -233,10 +246,11 @@ if __name__ == "__main__":
appCorGrid
.
SetParameterInt
(
"
mlazi
"
,
ml_correlSimu_azimut
)
appCorGrid
.
SetParameterInt
(
"
gridsteprange
"
,
correlSimu_gridstep_range
)
appCorGrid
.
SetParameterInt
(
"
gridstepazimut
"
,
correlSimu_gridstep_azimut
)
appCorGrid
.
SetParameter
Int
(
"
ram
"
,
4000
)
appCorGrid
.
SetParameter
String
(
"
ram
"
,
"
4000
"
)
#appCorGrid.Execute()
appCorGrid
.
ExecuteAndWriteOutput
()
######## SARFineMetadata Application (Correct_snrt step) #######
appFineMetadata
=
otb
.
Registry
.
CreateApplication
(
"
SARFineMetadata
"
)
appFineMetadata
.
SetParameterString
(
"
insar
"
,
master_Image
)
...
...
@@ -246,4 +260,118 @@ if __name__ == "__main__":
appFineMetadata
.
ExecuteAndWriteOutput
()
######################## DIn_SAR Chain #############################
######## SARDEMProjection Application #######
# Master
demProj_Master
=
"
demProj_Master.tif
"
appDEMProjectionMaster
=
otb
.
Registry
.
CreateApplication
(
"
SARDEMProjection
"
)
appDEMProjectionMaster
.
SetParameterString
(
"
insar
"
,
master_Image
)
appDEMProjectionMaster
.
SetParameterString
(
"
indem
"
,
dem
)
if
activateCalibration
:
appDEMProjectionMaster
.
SetParameterString
(
"
infilemetadata
"
,
os
.
path
.
join
(
output_dir
,
fine_metadata_file
))
appDEMProjectionMaster
.
SetParameterEmpty
(
"
withxyz
"
,
True
);
appDEMProjectionMaster
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
demProj_Master
))
appDEMProjectionMaster
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appDEMProjectionMaster
.
ExecuteAndWriteOutput
()
# Slave
demProj_Slave
=
"
demProj_Slave.tif
"
appDEMProjectionSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARDEMProjection
"
)
appDEMProjectionSlave
.
SetParameterString
(
"
insar
"
,
slave_Image
)
appDEMProjectionSlave
.
SetParameterString
(
"
indem
"
,
dem
)
appDEMProjectionSlave
.
SetParameterEmpty
(
"
withxyz
"
,
True
);
appDEMProjectionSlave
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
demProj_Slave
))
appDEMProjectionSlave
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appDEMProjectionSlave
.
ExecuteAndWriteOutput
()
######## SARFineDeformationGrid Application (geo_grid step) #######
fine_grid
=
"
fineDeformationGrid.tif
"
appFineDeformationGrid
=
otb
.
Registry
.
CreateApplication
(
"
SARFineDeformationGrid
"
)
appFineDeformationGrid
.
SetParameterString
(
"
indem
"
,
dem
)
appFineDeformationGrid
.
SetParameterString
(
"
insarmaster
"
,
master_Image
)
appFineDeformationGrid
.
SetParameterString
(
"
insarslave
"
,
slave_Image
)
appFineDeformationGrid
.
SetParameterString
(
"
inmlmaster
"
,
os
.
path
.
join
(
output_dir
,
master_Image_ML
))
appFineDeformationGrid
.
SetParameterString
(
"
inmlslave
"
,
os
.
path
.
join
(
output_dir
,
slave_Image_ML
))
appFineDeformationGrid
.
SetParameterString
(
"
indemprojmaster
"
,
os
.
path
.
join
(
output_dir
,
demProj_Master
))
appFineDeformationGrid
.
SetParameterString
(
"
indemprojslave
"
,
os
.
path
.
join
(
output_dir
,
demProj_Slave
))
appFineDeformationGrid
.
SetParameterInt
(
"
mlran
"
,
ml_geoGrid_range
)
appFineDeformationGrid
.
SetParameterInt
(
"
mlazi
"
,
ml_geoGrid_azimut
)
appFineDeformationGrid
.
SetParameterInt
(
"
gridsteprange
"
,
geoGrid_gridstep_range
)
appFineDeformationGrid
.
SetParameterInt
(
"
gridstepazimut
"
,
geoGrid_gridstep_azimut
)
appFineDeformationGrid
.
SetParameterFloat
(
"
threshold
"
,
geoGrid_threshold
)
appFineDeformationGrid
.
SetParameterFloat
(
"
gap
"
,
geoGrid_gap
)
appFineDeformationGrid
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
fine_grid
))
appFineDeformationGrid
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appFineDeformationGrid
.
ExecuteAndWriteOutput
()
######## SARCoRegistration Application (changeo step) #######
slave_Image_CoRe
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_coregistrated.tif
"
appCoRegistration
=
otb
.
Registry
.
CreateApplication
(
"
SARCoRegistration
"
)
appCoRegistration
.
SetParameterString
(
"
insarmaster
"
,
master_Image
)
appCoRegistration
.
SetParameterString
(
"
insarslave
"
,
slave_Image
)
appCoRegistration
.
SetParameterString
(
"
ingrid
"
,
os
.
path
.
join
(
output_dir
,
fine_grid
))
appCoRegistration
.
SetParameterInt
(
"
gridsteprange
"
,
geoGrid_gridstep_range
)
appCoRegistration
.
SetParameterInt
(
"
gridstepazimut
"
,
geoGrid_gridstep_azimut
)
appCoRegistration
.
SetParameterFloat
(
"
doppler0
"
,
appDoppler0Slave
.
GetParameterFloat
(
"
doppler0
"
))
appCoRegistration
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appCoRegistration
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
slave_Image_CoRe
))
appCoRegistration
.
ExecuteAndWriteOutput
()
######## SARCartesianMeanEstimation Application #######
# Master
master_cartesian_mean
=
"
CartMeanMaster.tif
"
master_cartesianperline_mean
=
"
CartMeanPerLineMaster.tif
"
appCartMeanMaster
=
otb
.
Registry
.
CreateApplication
(
"
SARCartesianMeanWithMeanPerLineEstimation
"
)
appCartMeanMaster
.
SetParameterString
(
"
insar
"
,
master_Image
)
appCartMeanMaster
.
SetParameterString
(
"
indem
"
,
dem
)
appCartMeanMaster
.
SetParameterString
(
"
indemproj
"
,
os
.
path
.
join
(
output_dir
,
demProj_Master
))
appCartMeanMaster
.
SetParameterInt
(
"
indirectiondemc
"
,
appDEMProjectionMaster
.
GetParameterInt
(
"
directiontoscandemc
"
))
appCartMeanMaster
.
SetParameterInt
(
"
indirectiondeml
"
,
appDEMProjectionMaster
.
GetParameterInt
(
"
directiontoscandeml
"
))
appCartMeanMaster
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appCartMeanMaster
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appCartMeanMaster
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appCartMeanMaster
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
master_cartesian_mean
))
appCartMeanMaster
.
SetParameterString
(
"
outopt
"
,
os
.
path
.
join
(
output_dir
,
master_cartesianperline_mean
))
appCartMeanMaster
.
ExecuteAndWriteOutput
()
# Slave
slave_cartesian_mean
=
"
CartMeanSlave.tif
"
slave_cartesianperline_mean
=
"
CartMeanPerLineSlave.tif
"
appCartMeanSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARCartesianMeanWithMeanPerLineEstimation
"
)
appCartMeanSlave
.
SetParameterString
(
"
insar
"
,
slave_Image
)
appCartMeanSlave
.
SetParameterString
(
"
indem
"
,
dem
)
appCartMeanSlave
.
SetParameterString
(
"
indemproj
"
,
os
.
path
.
join
(
output_dir
,
demProj_Slave
))
appCartMeanSlave
.
SetParameterInt
(
"
indirectiondemc
"
,
appDEMProjectionSlave
.
GetParameterInt
(
"
directiontoscandemc
"
))
appCartMeanSlave
.
SetParameterInt
(
"
indirectiondeml
"
,
appDEMProjectionSlave
.
GetParameterInt
(
"
directiontoscandeml
"
))
appCartMeanSlave
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appCartMeanSlave
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appCartMeanSlave
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appCartMeanSlave
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
slave_cartesian_mean
))
appCartMeanSlave
.
SetParameterString
(
"
outopt
"
,
os
.
path
.
join
(
output_dir
,
slave_cartesianperline_mean
))
appCartMeanSlave
.
ExecuteAndWriteOutput
()
######## SARRobustInterferogram Application (interf step) #######
interferogram
=
"
interferogram.tif
"
appInterferogram
=
otb
.
Registry
.
CreateApplication
(
"
SARRobustInterferogram
"
)
appInterferogram
.
SetParameterString
(
"
insarmaster
"
,
master_Image
)
appInterferogram
.
SetParameterString
(
"
insarslave
"
,
os
.
path
.
join
(
output_dir
,
slave_Image_CoRe
))
appInterferogram
.
SetParameterString
(
"
ingrid
"
,
os
.
path
.
join
(
output_dir
,
fine_grid
))
appInterferogram
.
SetParameterString
(
"
incartmeanmaster
"
,
os
.
path
.
join
(
output_dir
,
master_cartesian_mean
))
appInterferogram
.
SetParameterString
(
"
incartmeanperlinemaster
"
,
os
.
path
.
join
(
output_dir
,
master_cartesianperline_mean
))
appInterferogram
.
SetParameterString
(
"
incartmeanslave
"
,
os
.
path
.
join
(
output_dir
,
slave_cartesian_mean
))
appInterferogram
.
SetParameterString
(
"
incartmeanperlineslave
"
,
os
.
path
.
join
(
output_dir
,
slave_cartesianperline_mean
))
appInterferogram
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appInterferogram
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appInterferogram
.
SetParameterInt
(
"
gridsteprange
"
,
geoGrid_gridstep_range
)
appInterferogram
.
SetParameterInt
(
"
gridstepazimut
"
,
geoGrid_gridstep_azimut
)
appInterferogram
.
SetParameterFloat
(
"
gain
"
,
gain_interfero
)
appInterferogram
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appInterferogram
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
interferogram
))
appInterferogram
.
ExecuteAndWriteOutput
()
This diff is collapsed.
Click to expand it.
python_src/ex_config.ini
+
8
−
1
View file @
e43984e7
...
...
@@ -14,4 +14,11 @@ doppler_file = dop0.txt
activate
=
yes
GridStep_range
=
150
GridStep_azimut
=
150
fine_metadata_file
=
fine_metadata.txt
\ No newline at end of file
fine_metadata_file
=
fine_metadata.txt
[DIn_SAR]
GridStep_range
=
150
GridStep_azimut
=
150
Grid_Threshold
=
0.3
Grid_Gap
=
0.7
Interferogram_gain
=
0.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment