Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Sen2Chain
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
ESPACE-DEV
Sen2Chain
Commits
583f6ed1
Commit
583f6ed1
authored
4 years ago
by
pascal.mouquet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
sen2cor2.8 intro and naming
parent
a9698858
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
sen2chain/products.py
+3
-1
3 additions, 1 deletion
sen2chain/products.py
sen2chain/sen2cor.py
+38
-27
38 additions, 27 deletions
sen2chain/sen2cor.py
with
41 additions
and
28 deletions
sen2chain/products.py
+
3
−
1
View file @
583f6ed1
...
...
@@ -180,6 +180,7 @@ class L1cProduct(Product):
l2a_identifier
=
self
.
identifier
.
replace
(
"
L1C_
"
,
"
L2A_
"
).
replace
(
"
_OPER_
"
,
"
_USER_
"
)
l2a_path
=
self
.
path
.
parent
/
(
l2a_identifier
+
"
.SAFE
"
)
l2a_path_tmp
=
l2a_path
.
parent
/
(
l2a_path
.
stem
+
'
.tmp
'
)
l2a_prod
=
L2aProduct
(
l2a_identifier
,
self
.
tile
,
l2a_path
.
parent
)
if
not
l2a_prod
.
in_library
and
not
l2a_path
.
exists
():
...
...
@@ -200,10 +201,11 @@ class L1cProduct(Product):
process_it
=
True
if
process_it
:
process_sen2cor
(
self
.
path
)
process_sen2cor
(
self
.
path
,
l2a_path_tmp
,
self
.
processing_baseline
)
# sen2cor creates the L2A in the parent folder of the L1C.
# Therefore, if the L1C computed is in the L1C library folder,
# the newly L2A must be moved to his L2A library folder.
sorted
(
l2a_path_tmp
.
glob
(
"
*.SAFE
"
))[
0
].
rename
(
l2a_path
)
if
self
.
_library_product
:
l2a_prod
.
archive
()
L2aProduct
(
l2a_identifier
).
setPermissions
()
...
...
This diff is collapsed.
Click to expand it.
sen2chain/sen2cor.py
+
38
−
27
View file @
583f6ed1
...
...
@@ -18,6 +18,8 @@ logging.basicConfig(level=logging.INFO)
def
process_sen2cor
(
l1c_product_path
:
Union
[
str
,
pathlib
.
PosixPath
],
l2a_product_path
:
Union
[
str
,
pathlib
.
PosixPath
],
pb
:
str
=
'
99.99
'
,
resolution
:
int
=
10
)
->
None
:
"""
Process a L1C SAFE folder using sen2cor thanks to a subprocess call.
...
...
@@ -34,30 +36,39 @@ def process_sen2cor(
sen2cor_bashrc_path
=
Config
().
get
(
"
sen2cor_bashrc_path
"
)
if
resolution
==
10
:
logger
.
info
(
"
sen2cor processing 20 m: {}
"
.
format
(
l1c_product_path
))
command1
=
"
/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --resolution {res} {l1c_folder}
"
.
format
(
sen2cor_bashrc
=
str
(
sen2cor_bashrc_path
),
res
=
20
,
l1c_folder
=
str
(
l1c_product_path
)
)
process1
=
subprocess
.
run
(
command1
.
split
(
"
,
"
))
logger
.
info
(
"
sen2cor processing 10 m: {}
"
.
format
(
l1c_product_path
))
command2
=
"
/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --resolution {res} {l1c_folder}
"
.
format
(
sen2cor_bashrc
=
str
(
sen2cor_bashrc_path
),
res
=
10
,
l1c_folder
=
str
(
l1c_product_path
)
)
process2
=
subprocess
.
run
(
command2
.
split
(
"
,
"
))
else
:
logger
.
debug
(
"
sen2cor processing: {}
"
.
format
(
l1c_product_path
))
command
=
"
/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --resolution {resolution} {l1c_folder}
"
.
format
(
sen2cor_bashrc
=
str
(
sen2cor_bashrc_path
),
resolution
=
resolution
,
l1c_folder
=
str
(
l1c_product_path
)
)
process
=
subprocess
.
run
(
command
.
split
(
"
,
"
))
#~ if resolution == 10:
#~ logger.info("sen2cor processing 20 m: {}".format(l1c_product_path))
#~ command1 = "/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --resolution {res} {l1c_folder}".format(
#~ sen2cor_bashrc=str(sen2cor_bashrc_path),
#~ res=20,
#~ l1c_folder=str(l1c_product_path)
#~ )
#~ process1 = subprocess.run(command1.split(", "))
#~ logger.info("sen2cor processing 10 m: {}".format(l1c_product_path))
#~ command2 = "/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --resolution {res} {l1c_folder}".format(
#~ sen2cor_bashrc=str(sen2cor_bashrc_path),
#~ res=10,
#~ l1c_folder=str(l1c_product_path)
#~ )
#~ process2 = subprocess.run(command2.split(", "))
#~ else:
#~ logger.debug("sen2cor processing: {}".format(l1c_product_path))
#~ command = "/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --resolution {resolution} {l1c_folder}".format(
#~ sen2cor_bashrc=str(sen2cor_bashrc_path),
#~ resolution=resolution,
#~ l1c_folder=str(l1c_product_path)
#~ )
#~ process = subprocess.run(command.split(", "))
logger
.
debug
(
"
sen2cor 2.8 processing: {}
"
.
format
(
l1c_product_path
))
command
=
"
/bin/bash, -i, -c, source {sen2cor_bashrc} && L2A_Process --processing_baseline {processing_baseline} --output_dir {out_dir} {l1c_folder}
"
.
format
(
sen2cor_bashrc
=
str
(
sen2cor_bashrc_path
),
processing_baseline
=
pb
,
out_dir
=
l2a_product_path
,
l1c_folder
=
str
(
l1c_product_path
)
)
process
=
subprocess
.
run
(
command
.
split
(
"
,
"
))
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