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
79441c85
Commit
79441c85
authored
5 years ago
by
Gaëlle USSEGLIO
Browse files
Options
Downloads
Patches
Plain Diff
ENH : Burst selction for S1 IW mode
parent
02626e44
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_src/diapOTB_S1IW.py
+104
-30
104 additions, 30 deletions
python_src/diapOTB_S1IW.py
with
104 additions
and
30 deletions
python_src/diapOTB_S1IW.py
+
104
−
30
View file @
79441c85
...
...
@@ -54,7 +54,46 @@ def validate_json(json, schema):
# string to bool
def
str2bool
(
v
):
return
v
.
lower
()
in
(
"
yes
"
,
"
true
"
,
"
t
"
,
"
1
"
)
return
v
.
lower
()
in
(
"
yes
"
,
"
true
"
,
"
t
"
,
"
1
"
)
# Bursts selection (according to anx time values)
def
selectBurst
(
dictMaster
,
dictSlave
,
firstBurst
,
lastBurst
,
nbBurstSlave
,
validBurstMaster
,
validBurstSlave
):
key1Burst
=
"
support_data.geom.bursts.burst[
"
# Initialize the output lists (empty lists)
validBurstMaster
.
clear
()
validBurstSlave
.
clear
()
# Loop on Master bursts
for
id_B
in
range
(
firstBurst
,
lastBurst
+
1
):
keyBurstMaster
=
key1Burst
+
str
(
id_B
)
+
"
].azimuth_anx_time
"
# Get the anx time for the current burst (into Master Image)
anxMaster
=
float
(
dictMaster
[
keyBurstMaster
])
# Loop on slave bursts to find the closest anx time
minDiff
=
200
id_B_save
=
id_B
for
id_B_slave
in
range
(
0
,
nbBurstSlave
):
keyBurstSlave
=
key1Burst
+
str
(
id_B_slave
)
+
"
].azimuth_anx_time
"
# Get anx time for slave burst
anxSlave
=
float
(
dictSlave
[
keyBurstSlave
])
# Comparaison between master and slave
diff
=
abs
(
anxMaster
-
anxSlave
)
if
minDiff
>
diff
:
minDiff
=
diff
id_B_save
=
id_B_slave
# Check if difference between the anx time is valid (must be inferior to 1)
if
minDiff
<
1.
:
# Fill lists with master Burst_id and the selected slave burst_id
validBurstMaster
.
append
(
id_B
)
validBurstSlave
.
append
(
id_B_save
)
# Main
...
...
@@ -202,6 +241,9 @@ if __name__ == "__main__":
advantage
=
"
correlation
"
# Correlation if resolution > 40 m
print
(
"
Resolution of the input DEM is inferior to 40 meters : A correlation will be used to correct all deformation grids
"
)
# Selection of bursts
keyBurst
=
"
support_data.geom.bursts.burst[
"
+
str
(
0
)
+
"
].azimuth_anx_time
"
# Check the index of bursts
minNbBurst
=
min
([
int
(
dictKWLMaster
[
'
support_data.geom.bursts.number
'
]),
int
(
dictKWLSlave
[
'
support_data.geom.bursts.number
'
])])
...
...
@@ -226,9 +268,23 @@ if __name__ == "__main__":
if
minNbBurst
<
firstBurst
or
minNbBurst
<
lastBurst
or
lastBurst
<
0
or
firstBurst
<
0
:
print
(
"
Wrong burst index
"
)
quit
()
validBurstMaster
=
[]
validBurstSlave
=
[]
nbBurstSlave
=
int
(
dictKWLSlave
[
'
support_data.geom.bursts.number
'
])
selectBurst
(
dictKWLMaster
,
dictKWLSlave
,
firstBurst
,
lastBurst
,
nbBurstSlave
,
validBurstMaster
,
validBurstSlave
)
if
len
(
validBurstMaster
)
==
0
or
len
(
validBurstSlave
)
==
0
:
print
(
"
Wrong burst index (slave index does not match with master index)
"
)
quit
()
# Update firstBurst and lastBurst with selected Burst for master image
firstBurst
=
validBurstMaster
[
0
]
lastBurst
=
validBurstMaster
[
len
(
validBurstMaster
)
-
1
]
# Create directory for each burst
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
burstId
in
range
(
validBurstMaster
[
0
],
validBurstMaster
[
len
(
validBurstMaster
)
-
1
]
+
1
):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
output_dir
,
"
burst
"
+
str
(
burstId
))):
os
.
makedirs
(
os
.
path
.
join
(
output_dir
,
"
burst
"
+
str
(
burstId
)))
...
...
@@ -242,7 +298,9 @@ if __name__ == "__main__":
dop0Master
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
print
(
"
\n
BurstId =
"
+
str
(
burstId
)
+
"
\n
"
)
...
...
@@ -297,27 +355,30 @@ if __name__ == "__main__":
print
(
"
\n
Slave Pre-Processing
\n
"
)
dop0Slave
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
burstId_slave
=
validBurstSlave
[
id_loop
]
print
(
"
\n
BurstId =
"
+
str
(
burstId
)
+
"
\n
"
)
print
(
"
\n
BurstId =
"
+
str
(
burstId
_slave
)
+
"
\n
"
)
burst_dir
=
os
.
path
.
join
(
output_dir
,
"
burst
"
+
str
(
burstId
))
######## SARBurstExtraction Application #######
print
(
"
\n
Burst Extraction Application
\n
"
)
burstS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
burstS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
.tif
"
appBurstExtractionSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARBurstExtraction
"
)
appBurstExtractionSlave
.
SetParameterString
(
"
in
"
,
slave_Image
)
appBurstExtractionSlave
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
burst_dir
,
burstS
))
appBurstExtractionSlave
.
SetParameterInt
(
"
burstindex
"
,
burstId
)
appBurstExtractionSlave
.
SetParameterInt
(
"
burstindex
"
,
burstId
_slave
)
appBurstExtractionSlave
.
SetParameterString
(
"
allpixels
"
,
"
true
"
)
appBurstExtractionSlave
.
SetParameterString
(
"
ram
"
,
"
4000
"
)
appBurstExtractionSlave
.
ExecuteAndWriteOutput
()
######## SARDeramp Application #######
# print("\n Deramping Application \n")
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_deramp
"
+
"
.tif
"
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_deramp
"
+
"
.tif
"
appDerampSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARDeramp
"
)
appDerampSlave
.
SetParameterString
(
"
in
"
,
os
.
path
.
join
(
burst_dir
,
burstS
))
appDerampSlave
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
burst_dir
,
burstDerampS
))
...
...
@@ -327,7 +388,7 @@ if __name__ == "__main__":
######## SARDoppler Application #######
print
(
"
\n
Doppler Application
\n
"
)
dopFile
=
open
(
os
.
path
.
join
(
output_dir
,
dop_file
),
"
a
"
)
dopFile
.
write
(
"
Doppler for slave image :
"
+
os
.
path
.
basename
(
slave_Image_base
)
+
"
for burst_index =
"
+
str
(
burstId
)
+
"
\n
"
)
dopFile
.
write
(
"
Doppler for slave image :
"
+
os
.
path
.
basename
(
slave_Image_base
)
+
"
for burst_index =
"
+
str
(
burstId
_slave
)
+
"
\n
"
)
dopFile
.
close
()
appDoppler0Slave
=
otb
.
Registry
.
CreateApplication
(
"
SARDoppler0
"
)
appDoppler0Slave
.
SetParameterString
(
"
insar
"
,
os
.
path
.
join
(
burst_dir
,
burstDerampS
))
...
...
@@ -339,7 +400,7 @@ if __name__ == "__main__":
####### SARMultiLook Application #######
print
(
"
\n
MultiLook Application
\n
"
)
slave_Image_ML
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
slave_Image_ML
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
appMultiLookSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARMultiLook
"
)
appMultiLookSlave
.
SetParameterString
(
"
incomplex
"
,
os
.
path
.
join
(
burst_dir
,
burstDerampS
))
appMultiLookSlave
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
burst_dir
,
slave_Image_ML
))
...
...
@@ -357,7 +418,9 @@ if __name__ == "__main__":
gainMaster
=
[]
directionDEMMaster
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
print
(
"
\n
BurstId =
"
+
str
(
burstId
)
+
"
\n
"
)
...
...
@@ -405,15 +468,18 @@ if __name__ == "__main__":
gainSlave
=
[]
directionDEMSlave
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
print
(
"
\n
BurstId =
"
+
str
(
burstId
)
+
"
\n
"
)
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
burstId_slave
=
validBurstSlave
[
id_loop
]
print
(
"
\n
BurstId =
"
+
str
(
burstId_slave
)
+
"
\n
"
)
burst_dir
=
os
.
path
.
join
(
output_dir
,
"
burst
"
+
str
(
burstId
))
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_deramp
"
+
"
.tif
"
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_deramp
"
+
"
.tif
"
demProj_Slave
=
"
demProj
"
+
"
_burst
"
+
str
(
burstId
)
+
"
_Slave.tif
"
demProj_Slave
=
"
demProj
"
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_Slave.tif
"
appDEMProjectionSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARDEMProjection
"
)
appDEMProjectionSlave
.
SetParameterString
(
"
insar
"
,
os
.
path
.
join
(
burst_dir
,
burstDerampS
))
appDEMProjectionSlave
.
SetParameterString
(
"
indem
"
,
dem
)
...
...
@@ -431,24 +497,27 @@ if __name__ == "__main__":
list_of_Interferograms
=
[]
list_of_Grids
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
burstId_slave
=
validBurstSlave
[
id_loop
]
print
(
"
\n
BurstId =
"
+
str
(
burstId
)
+
"
\n
"
)
burst_dir
=
os
.
path
.
join
(
output_dir
,
"
burst
"
+
str
(
burstId
))
burstM
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
burstS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
burstS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
.tif
"
burstDerampM
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_deramp
"
+
"
.tif
"
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_deramp
"
+
"
.tif
"
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_deramp
"
+
"
.tif
"
master_Image_ML
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
slave_Image_ML
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
slave_Image_ML
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
demProj_Master
=
"
demProj
"
+
"
_burst
"
+
str
(
burstId
)
+
"
_Master.tif
"
demProj_Slave
=
"
demProj
"
+
"
_burst
"
+
str
(
burstId
)
+
"
_Slave.tif
"
demProj_Slave
=
"
demProj
"
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_Slave.tif
"
master_cartesian_mean
=
"
CartMeanMaster
"
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
...
...
@@ -560,9 +629,11 @@ if __name__ == "__main__":
# Clear all azimut shifts
azimut_shift_esd
[:]
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
print
(
"
\n
BurstId =
"
+
str
(
burstId
)
+
"
\n
"
)
# Paths
...
...
@@ -589,8 +660,11 @@ if __name__ == "__main__":
# Clear our list of interferograms
list_of_Interferograms
[:]
=
[]
for
burstId
in
range
(
firstBurst
,
lastBurst
+
1
):
for
id_loop
in
range
(
0
,
len
(
validBurstMaster
)):
#burstId = id_loop + firstBurst
burstId
=
validBurstMaster
[
id_loop
]
burstId_slave
=
validBurstSlave
[
id_loop
]
# Paths
burst_dir
=
os
.
path
.
join
(
output_dir
,
"
burst
"
+
str
(
burstId
))
...
...
@@ -598,9 +672,9 @@ if __name__ == "__main__":
gridOffset_path
=
os
.
path
.
join
(
esd_dir
,
"
gridOffOut
"
+
"
_burst
"
+
str
(
burstId
)
+
"
_iter
"
+
str
(
0
)
+
"
.tif
"
)
burstM
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
burstS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
burstS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
.tif
"
burstDerampM
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_deramp
"
+
"
.tif
"
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
)
+
"
_deramp
"
+
"
.tif
"
burstDerampS
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_burst
"
+
str
(
burstId
_slave
)
+
"
_deramp
"
+
"
.tif
"
master_cartesian_mean
=
"
CartMeanMaster
"
+
"
_burst
"
+
str
(
burstId
)
+
"
.tif
"
# Adjust azimut shift according to the burstId
...
...
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