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
36f180e4
Commit
36f180e4
authored
4 years ago
by
Gaëlle USSEGLIO
Browse files
Options
Downloads
Patches
Plain Diff
ENH : Add protection on master Image check into SAR_MultiSlc chains
parent
7081dd0e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python_src/SAR_MultiSlc.py
+28
-0
28 additions, 0 deletions
python_src/SAR_MultiSlc.py
python_src/SAR_MultiSlc_IW.py
+15
-0
15 additions, 0 deletions
python_src/SAR_MultiSlc_IW.py
python_src/utils/func_utils.py
+35
-0
35 additions, 0 deletions
python_src/utils/func_utils.py
with
78 additions
and
0 deletions
python_src/SAR_MultiSlc.py
+
28
−
0
View file @
36f180e4
...
@@ -124,13 +124,41 @@ if __name__ == "__main__":
...
@@ -124,13 +124,41 @@ if __name__ == "__main__":
light_version
=
dict_Global
[
'
parameter
'
][
'
clean
'
]
light_version
=
dict_Global
[
'
parameter
'
][
'
clean
'
]
light_version
=
func_utils
.
str2bool
(
light_version
)
light_version
=
func_utils
.
str2bool
(
light_version
)
func_utils
.
check_ifExist
(
dict_Global
[
'
in
'
][
'
Input_Path
'
])
if
master_ext
[
0
]
==
"
h5
"
:
# Cosmo case
if
master_ext
[
0
]
==
"
h5
"
:
# Cosmo case
master_Image
=
func_utils
.
get_imgFromDir
(
dict_Global
[
'
in
'
][
'
Master_Image
'
],
dict_Global
[
'
in
'
][
'
Input_Path
'
])
master_Image
=
func_utils
.
get_imgFromDir
(
dict_Global
[
'
in
'
][
'
Master_Image
'
],
dict_Global
[
'
in
'
][
'
Input_Path
'
])
if
not
master_Image
:
print
(
master_Image_base
+
"
not found into given input path
"
+
\
dict_Global
[
'
in
'
][
'
Input_Path
'
])
print
(
"
Please check your input path
"
)
quit
()
else
:
correct
=
func_utils
.
check_image_pattern
(
master_Image_base
,
mode
=
"
Cosmo
"
)
if
not
correct
:
print
(
"
Master image
"
+
master_Image_base
+
"
does not respect naming conventions for Cosmo
"
)
quit
()
master_date
=
master_Image_base
.
split
(
"
_
"
)[
8
][:
8
]
master_date
=
master_Image_base
.
split
(
"
_
"
)[
8
][:
8
]
pol
=
master_Image_base
.
split
(
"
_
"
)[
5
]
pol
=
master_Image_base
.
split
(
"
_
"
)[
5
]
else
:
#S1 SM case
else
:
#S1 SM case
master_Image
=
func_utils
.
get_imgFromSAFE
(
dict_Global
[
'
in
'
][
'
Master_Image
'
],
dict_Global
[
'
in
'
][
'
Input_Path
'
])
master_Image
=
func_utils
.
get_imgFromSAFE
(
dict_Global
[
'
in
'
][
'
Master_Image
'
],
dict_Global
[
'
in
'
][
'
Input_Path
'
])
if
not
master_Image
:
print
(
master_Image_base
+
"
not found into given input path
"
+
\
dict_Global
[
'
in
'
][
'
Input_Path
'
])
print
(
"
Please check your input path
"
)
quit
()
else
:
correct
=
func_utils
.
check_image_pattern
(
master_Image_base
,
mode
=
"
S1SM
"
)
if
not
correct
:
print
(
"
Master image
"
+
master_Image_base
+
"
does not respect naming conventions for S1SM
"
)
quit
()
master_date
=
master_Image_base
.
split
(
"
-
"
)[
4
].
split
(
"
t
"
)[
0
]
master_date
=
master_Image_base
.
split
(
"
-
"
)[
4
].
split
(
"
t
"
)[
0
]
pol
=
master_Image_base
.
split
(
"
-
"
)[
3
]
pol
=
master_Image_base
.
split
(
"
-
"
)[
3
]
manifest
=
master_Image
.
split
(
"
measurement
"
)[
0
]
+
"
/manifest.safe
"
manifest
=
master_Image
.
split
(
"
measurement
"
)[
0
]
+
"
/manifest.safe
"
...
...
This diff is collapsed.
Click to expand it.
python_src/SAR_MultiSlc_IW.py
+
15
−
0
View file @
36f180e4
...
@@ -112,7 +112,22 @@ if __name__ == "__main__":
...
@@ -112,7 +112,22 @@ if __name__ == "__main__":
start_time
=
int
(
dict_Global
[
'
in
'
][
'
Start_Date
'
])
start_time
=
int
(
dict_Global
[
'
in
'
][
'
Start_Date
'
])
end_time
=
int
(
dict_Global
[
'
in
'
][
'
End_Date
'
])
end_time
=
int
(
dict_Global
[
'
in
'
][
'
End_Date
'
])
master_Image_base
=
dict_Global
[
'
in
'
][
'
Master_Image
'
]
master_Image_base
=
dict_Global
[
'
in
'
][
'
Master_Image
'
]
func_utils
.
check_ifExist
(
dict_Global
[
'
in
'
][
'
Input_Path
'
])
master_Image
=
func_utils
.
get_imgFromSAFE
(
dict_Global
[
'
in
'
][
'
Master_Image
'
],
dict_Global
[
'
in
'
][
'
Input_Path
'
])
master_Image
=
func_utils
.
get_imgFromSAFE
(
dict_Global
[
'
in
'
][
'
Master_Image
'
],
dict_Global
[
'
in
'
][
'
Input_Path
'
])
if
not
master_Image
:
print
(
master_Image_base
+
"
not found into given input path
"
+
\
dict_Global
[
'
in
'
][
'
Input_Path
'
])
print
(
"
Please check your input path
"
)
quit
()
else
:
correct
=
func_utils
.
check_image_pattern
(
master_Image_base
,
mode
=
"
S1IW
"
)
if
not
correct
:
print
(
"
Master image
"
+
master_Image_base
+
"
does not respect naming conventions for S1IW
"
)
quit
()
master_date
=
master_Image_base
.
split
(
"
-
"
)[
4
].
split
(
"
t
"
)[
0
]
master_date
=
master_Image_base
.
split
(
"
-
"
)[
4
].
split
(
"
t
"
)[
0
]
pol
=
master_Image_base
.
split
(
"
-
"
)[
3
]
pol
=
master_Image_base
.
split
(
"
-
"
)[
3
]
iw
=
master_Image_base
.
split
(
"
-
"
)[
1
]
iw
=
master_Image_base
.
split
(
"
-
"
)[
1
]
...
...
This diff is collapsed.
Click to expand it.
python_src/utils/func_utils.py
+
35
−
0
View file @
36f180e4
...
@@ -249,6 +249,41 @@ def get_imgFromDir(arg, searchDir="."):
...
@@ -249,6 +249,41 @@ def get_imgFromDir(arg, searchDir="."):
img
=
str
(
""
.
join
(
img
))
img
=
str
(
""
.
join
(
img
))
return
img
return
img
def
check_image_pattern
(
img
,
mode
=
"
S1SM
"
)
:
"""
Check pattern for current image. Must be cohetrent according to the sensor and mode
"""
correct_pattern
=
False
if
mode
==
"
S1SM
"
:
# Mode S1 SM
pattern
=
""
.
join
([
"
s1.
"
,
"
-
"
,
'
\w{1}
'
,
'
\d
'
,
"
-slc-
"
,
'
\w{2}
'
,
"
-
"
,
'
\d{8}
'
,
"
t
"
,
'
\d{6}
'
,
"
-
"
,
'
\d{8}
'
,
"
t
"
,
'
\d{6}
'
])
if
re
.
match
(
pattern
,
img
)
:
correct_pattern
=
True
elif
mode
==
"
Cosmo
"
:
# Mode Cosmo
pattern
=
""
.
join
([
"
CSKS
"
,
'
\d
'
])
if
re
.
match
(
pattern
,
img
)
:
pattern_dates
=
""
.
join
([
'
\d{14}
'
,
"
_
"
,
'
\d{14}
'
])
dates
=
re
.
findall
(
pattern_dates
,
img
)
if
len
(
dates
)
==
1
:
correct_pattern
=
True
else
:
# Mode S1 IW
pattern
=
""
.
join
([
"
s1.
"
,
"
-
"
,
'
\w{2}
'
,
'
\d
'
,
"
-slc-
"
,
'
\w{2}
'
,
"
-
"
,
'
\d{8}
'
,
"
t
"
,
'
\d{6}
'
,
"
-
"
,
'
\d{8}
'
,
"
t
"
,
'
\d{6}
'
])
if
re
.
match
(
pattern
,
img
)
:
correct_pattern
=
True
return
correct_pattern
def
image_envelope
(
inTIF
,
outSHP
):
def
image_envelope
(
inTIF
,
outSHP
):
"""
"""
...
...
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