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
Container Registry
Model registry
Operate
Environments
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
Remote Modules
diapotb
Commits
09810305
Commit
09810305
authored
3 years ago
by
Abdussalam SALEH MGHIR
Browse files
Options
Downloads
Patches
Plain Diff
ENH : Add Deramp/Reramp app inside diapOTB.py for images from TSX sensor
parent
5dfde395
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!52
Merge for v1.1.0
,
!43
Add TSX to SARDeramp
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python_src/diapOTB.py
+13
-3
13 additions, 3 deletions
python_src/diapOTB.py
python_src/processings/DInSar.py
+153
-1
153 additions, 1 deletion
python_src/processings/DInSar.py
python_src/processings/Pre_Processing.py
+61
-0
61 additions, 0 deletions
python_src/processings/Pre_Processing.py
with
227 additions
and
4 deletions
python_src/diapOTB.py
+
13
−
3
View file @
09810305
...
@@ -427,8 +427,13 @@ if __name__ == "__main__":
...
@@ -427,8 +427,13 @@ if __name__ == "__main__":
paramPreMaster
[
'
ml_gain
'
]
=
ml_gain
paramPreMaster
[
'
ml_gain
'
]
=
ml_gain
paramPreMaster
[
'
dop_file
'
]
=
dop_file
paramPreMaster
[
'
dop_file
'
]
=
dop_file
paramPreMaster
[
'
ram
'
]
=
ram
paramPreMaster
[
'
ram
'
]
=
ram
mode
=
''
if
satellite
.
lower
()
==
'
tsx
'
:
mode
=
'
TSX
'
else
:
mode
=
'
Others
'
dop0Master
=
Pre_Processing
.
extractToMultilook
(
master_Image
,
master_Image_base
,
paramPreMaster
,
"
Others
"
,
dop0Master
=
Pre_Processing
.
extractToMultilook
(
master_Image
,
master_Image_base
,
paramPreMaster
,
mode
,
output_dir
)
output_dir
)
# Slave
# Slave
func_utils
.
printOnStd
(
"
\n
Slave Pre_Processing chain
\n
"
)
func_utils
.
printOnStd
(
"
\n
Slave Pre_Processing chain
\n
"
)
...
@@ -441,7 +446,7 @@ if __name__ == "__main__":
...
@@ -441,7 +446,7 @@ if __name__ == "__main__":
paramPreSlave
[
'
dop_file
'
]
=
dop_file
paramPreSlave
[
'
dop_file
'
]
=
dop_file
paramPreSlave
[
'
ram
'
]
=
ram
paramPreSlave
[
'
ram
'
]
=
ram
dop0Slave
=
Pre_Processing
.
extractToMultilook
(
slave_Image
,
slave_Image_base
,
paramPreSlave
,
"
Others
"
,
dop0Slave
=
Pre_Processing
.
extractToMultilook
(
slave_Image
,
slave_Image_base
,
paramPreSlave
,
mode
,
output_dir
)
output_dir
)
...
@@ -516,8 +521,13 @@ if __name__ == "__main__":
...
@@ -516,8 +521,13 @@ if __name__ == "__main__":
param
[
'
gain_interfero
'
]
=
gain_interfero
param
[
'
gain_interfero
'
]
=
gain_interfero
param
[
'
advantage
'
]
=
advantage
param
[
'
advantage
'
]
=
advantage
param
[
'
ram
'
]
=
ram
param
[
'
ram
'
]
=
ram
mode
=
''
if
satellite
.
lower
()
==
'
tsx
'
:
mode
=
'
TSX
'
else
:
mode
=
'
Others
'
DInSar
.
gridToInterferogram
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
output_dir
,
output_dir
,
param
,
"
Others
"
,
output_dir
)
DInSar
.
gridToInterferogram
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
output_dir
,
output_dir
,
param
,
mode
,
output_dir
)
######################## Post_Processing Chain #############################
######################## Post_Processing Chain #############################
...
...
This diff is collapsed.
Click to expand it.
python_src/processings/DInSar.py
+
153
−
1
View file @
09810305
...
@@ -229,6 +229,9 @@ def gridToInterferogram(dem, master_Image, master_Image_base, slave_Image,
...
@@ -229,6 +229,9 @@ def gridToInterferogram(dem, master_Image, master_Image_base, slave_Image,
"""
"""
if
mode
==
'
S1_IW
'
:
if
mode
==
'
S1_IW
'
:
return
gridToInterferogram_S1IW
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
)
return
gridToInterferogram_S1IW
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
)
elif
mode
==
'
TSX
'
:
print
(
"
MODE Interferogram : TSX
"
)
return
gridToInterferogram_TSX
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
)
else
:
else
:
return
gridToInterferogram_Others
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
)
return
gridToInterferogram_Others
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
)
...
@@ -355,7 +358,7 @@ def gridToInterferogram_Others(dem, master_Image, master_Image_base, slave_Image
...
@@ -355,7 +358,7 @@ def gridToInterferogram_Others(dem, master_Image, master_Image_base, slave_Image
slave_Image_CoRe
+=
"
?&gdal:co:TILED=YES
"
slave_Image_CoRe
+=
"
?&gdal:co:TILED=YES
"
coRe_path
=
os
.
path
.
join
(
output_dir
,
slave_Image_CoRe
)
coRe_path
=
os
.
path
.
join
(
output_dir
,
slave_Image_CoRe
)
coRegistrationApp
(
insarmaster
=
master_Image
,
coRegistrationApp
(
insarmaster
=
master_Image
,
insarslave
=
slave_Image
,
insarslave
=
slave_Image
,
ingrid
=
fine_gird_path
,
doppler0
=
doppler0
,
ingrid
=
fine_gird_path
,
doppler0
=
doppler0
,
outPath
=
coRe_path
)
outPath
=
coRe_path
)
...
@@ -380,6 +383,155 @@ def gridToInterferogram_Others(dem, master_Image, master_Image_base, slave_Image
...
@@ -380,6 +383,155 @@ def gridToInterferogram_Others(dem, master_Image, master_Image_base, slave_Image
return
list_of_Grids
,
list_of_Interferograms
return
list_of_Grids
,
list_of_Interferograms
def
gridToInterferogram_TSX
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
):
"""
Main function for DInSAR processing and other than S1IW mode (S1SM and Cosmo)
This function applies several processing to provide the result interferogram
:param dem: Input DEM
:param master_Image: Master image name (with path included)
:param master_Image_base: Master image name
:param slave_Image: Slave image name (with path included)
:param slave_Image_base: Slave image name
:param master_dir: Output directory (to store result on master image only)
:param slave_dir: Output directory (to store result on slave image only)
:param param: Dictionary to retrieve all parameters used into this processing chain
:param output_dir: Output directory
:type dem: string
:type master_Image: string
:type master_Image_base: string
:type slave_Image: string
:type slave_Image_base: string
:type master_dir: string
:type slave_dir: string
:type param: dict
:type output_dir: string
:return: list of grids and interferograms
:rtype: list, list
"""
# Get elements into param dictionnaries
ml_azimut
=
param
[
'
ml_azimut
'
]
ml_range
=
param
[
'
ml_range
'
]
ml_geoGrid_azimut
=
param
[
'
ml_geoGrid_azimut
'
]
ml_geoGrid_range
=
param
[
'
ml_geoGrid_range
'
]
ml_interf_range
=
ml_range
if
"
ml_interf_range
"
in
param
:
ml_interf_range
=
param
[
'
ml_interf_range
'
]
ml_interf_azimut
=
ml_azimut
if
"
ml_interf_azimut
"
in
param
:
ml_interf_azimut
=
param
[
'
ml_interf_azimut
'
]
geoGrid_gridstep_range
=
param
[
'
geoGrid_gridstep_range
'
]
geoGrid_gridstep_azimut
=
param
[
'
geoGrid_gridstep_azimut
'
]
geoGrid_threshold
=
param
[
'
geoGrid_threshold
'
]
geoGrid_gap
=
param
[
'
geoGrid_gap
'
]
doppler0
=
param
[
'
doppler0
'
]
gain_interfero
=
param
[
'
gain_interfero
'
]
advantage
=
param
[
'
advantage
'
]
with_interferogram
=
True
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
,
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
,
ram
=
ram
)
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
,
ram
=
ram
)
# Empty list
list_of_Grids
=
[]
list_of_Interferograms
=
[]
master_Image_ML
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
slave_Image_ML
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
demProj_Master
=
"
demProj_Master.tif
"
demProj_Slave
=
"
demProj_Slave.tif
"
master_cartesian_mean
=
"
CartMeanMaster.tif
"
## SARFineDeformationGrid Application ##
print
(
"
\n
SARFineDeformationGrid Application
\n
"
)
fine_grid
=
"
fineDeformationGrid.tif
"
fine_gird_path
=
os
.
path
.
join
(
output_dir
,
fine_grid
)
fineGridDeformationApp
(
insarmaster
=
master_Image
,
insarslave
=
slave_Image
,
inmlmaster
=
os
.
path
.
join
(
master_dir
,
master_Image_ML
),
inmlslave
=
os
.
path
.
join
(
output_dir
,
slave_Image_ML
),
indemprojmaster
=
os
.
path
.
join
(
master_dir
,
demProj_Master
),
indemprojslave
=
os
.
path
.
join
(
output_dir
,
demProj_Slave
),
outPath
=
fine_gird_path
)
list_of_Grids
.
append
(
fine_gird_path
)
## SARCoRegistration Application (changeo step) ##
print
(
"
\n
SARCoRegistration Application
\n
"
)
slave_Image_CoRe
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_coregistrated.tif
"
if
"
slave_CoRe_Name
"
in
param
:
slave_Image_CoRe
=
param
[
'
slave_CoRe_Name
'
]
slave_Image_CoRe
+=
"
?&gdal:co:TILED=YES
"
coRe_path
=
os
.
path
.
join
(
output_dir
,
slave_Image_CoRe
)
coRegistrationApp
(
insarmaster
=
master_Image
,
insarslave
=
slave_Image
,
ingrid
=
fine_gird_path
,
doppler0
=
doppler0
,
outPath
=
coRe_path
)
## SARDeramp Application (deramp step) ##
print
(
"
\n
SARReramp Application
\n
"
)
deRamp_path
=
os
.
path
.
join
(
output_dir
,
"
deramp.tif
"
)
derampApp
(
inImg
=
coRe_path
,
inslave
=
slave_Image
,
ingrid
=
fine_gird_path
,
outPath
=
deRamp_path
)
## SARRobustInterferogram Application (interf step) ##
if
with_interferogram
:
print
(
"
\n
SARRobustInterferogram Application
\n
"
)
interferogram_path
=
os
.
path
.
join
(
output_dir
,
"
interferogram.tif
"
)
interferogramApp
(
insarmaster
=
master_Image
,
incoregistratedslave
=
deRamp_path
,
insarslave
=
slave_Image
,
ingrid
=
fine_gird_path
,
incartmeanmaster
=
os
.
path
.
join
(
master_dir
,
master_cartesian_mean
),
outPath
=
interferogram_path
)
list_of_Interferograms
.
append
(
interferogram_path
)
# Output lists
return
list_of_Grids
,
list_of_Interferograms
def
gridToInterferogram_S1IW
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
):
def
gridToInterferogram_S1IW
(
dem
,
master_Image
,
master_Image_base
,
slave_Image
,
slave_Image_base
,
master_dir
,
slave_dir
,
param
,
output_dir
):
"""
"""
Main function for DInSAR processing and S1IW mode
Main function for DInSAR processing and S1IW mode
...
...
This diff is collapsed.
Click to expand it.
python_src/processings/Pre_Processing.py
+
61
−
0
View file @
09810305
...
@@ -64,6 +64,9 @@ def extractToMultilook(sar_Image, sar_Image_base, param, mode, output_dir):
...
@@ -64,6 +64,9 @@ def extractToMultilook(sar_Image, sar_Image_base, param, mode, output_dir):
"""
"""
if
mode
==
'
S1_IW
'
:
if
mode
==
'
S1_IW
'
:
return
extractToMultilook_S1IW
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
)
return
extractToMultilook_S1IW
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
)
elif
mode
==
'
TSX
'
:
print
(
"
MODE : TSX
"
)
return
extractToMultilook_TSX
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
)
else
:
else
:
return
extractToMultilook_Others
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
)
return
extractToMultilook_Others
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
)
...
@@ -122,6 +125,64 @@ def extractToMultilook_Others(sar_Image, sar_Image_base, param, output_dir):
...
@@ -122,6 +125,64 @@ def extractToMultilook_Others(sar_Image, sar_Image_base, param, output_dir):
return
dop0
return
dop0
def
extractToMultilook_TSX
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
):
"""
Main function for Pre_Processing chain and other than S1IW mode (S1SM and Cosmo)
This function applies several processing according to the selected mode :
For other mode : Doppler0 estimation + MultiLook processing
:param sar_Image: SAR image name (with path included)
:param sar_Image_base: SAR image name
:param param: Dictionary to retrieve all parameters used into this processing chain
:param output_dir: Output directory
:type sar_Image: string
:type sar_Image_base: string
:type param: dict
:type output_dir: string
:return: Doppler0 value
:rtype: float
"""
# Get elements into param dictionnaries
ml_azimut
=
param
[
'
ml_azimut
'
]
ml_range
=
param
[
'
ml_range
'
]
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
,
ram
=
ram
)
derampApp
=
partial
(
diapOTBApp
.
deramp
,
reramp
=
"
false
"
,
shift
=
"
false
"
,
ingrid
=
""
,
inslave
=
""
,
gridsteprange
=
0
,
gridstepazimut
=
0
,
ram
=
ram
)
# Create an empty list
dop0
=
0
## SARDeramp Application ##
print
(
"
\n
Deramp Application
\n
"
)
deramp_file
=
os
.
path
.
splitext
(
sar_Image_base
)[
0
]
+
"
deramp.tif
"
sar_deramp_Image
=
os
.
path
.
join
(
output_dir
,
deramp_file
)
derampApp
(
inImg
=
sar_Image
,
outPath
=
sar_deramp_Image
)
## SARDoppler Application ##
print
(
"
\n
Doppler Application
\n
"
)
dop0
=
diapOTBApp
.
doppler0
(
insar
=
sar_deramp_Image
,
outPath
=
os
.
path
.
join
(
output_dir
,
dop_file
),
ram
=
ram
)
## SARMultiLook Application ##
print
(
"
\n
MultiLook Application
\n
"
)
sar_Image_ML
=
os
.
path
.
splitext
(
sar_Image_base
)[
0
]
+
"
_ml
"
+
str
(
ml_azimut
)
+
str
(
ml_range
)
+
"
.tif
"
multilookApp
(
inImg
=
sar_deramp_Image
,
outPath
=
os
.
path
.
join
(
output_dir
,
sar_Image_ML
))
# return the value of Doppler0 values
return
dop0
def
extractToMultilook_S1IW
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
):
def
extractToMultilook_S1IW
(
sar_Image
,
sar_Image_base
,
param
,
output_dir
):
"""
"""
...
...
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