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
28ccf362
Commit
28ccf362
authored
5 years ago
by
pascal.mouquet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
new l2a_archive tile function to archive l2a products in corresponding folder
parent
607557fc
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/config.py
+1
-0
1 addition, 0 deletions
sen2chain/config.py
sen2chain/tiles.py
+39
-2
39 additions, 2 deletions
sen2chain/tiles.py
with
40 additions
and
2 deletions
sen2chain/config.py
+
1
−
0
View file @
28ccf362
...
...
@@ -44,6 +44,7 @@ class Config:
"
l1c_path
"
:
""
,
"
l1c_archive_path
"
:
"
/ARCHIVE_SENTINEL-PROD/S2_L1C_ARCHIVE
"
,
"
l2a_path
"
:
""
,
"
l2a_archive_path
"
:
"
/ARCHIVE_SENTINEL-PROD/S2_L2A_ARCHIVE
"
,
"
indices_path
"
:
""
,
"
time_series_path
"
:
""
,
"
monthly_summaries_path
"
:
""
}
...
...
This diff is collapsed.
Click to expand it.
sen2chain/tiles.py
+
39
−
2
View file @
28ccf362
...
...
@@ -333,11 +333,19 @@ class Tile:
#~ logger.info("Product: local / archived / total".format(human_size(getFolderSize(str(self.paths['l1c'])))))
local
=
getFolderSize
(
str
(
self
.
paths
[
"
l1c
"
]))
total
=
getFolderSize
(
str
(
self
.
paths
[
"
l1c
"
]),
True
)
logger
.
info
(
"
l1c: {} (l: {} / a: {})
"
.
format
(
human_size
(
total
),
logger
.
info
(
"
l1c: {} (l
ocal
: {} / a
rchived
: {})
"
.
format
(
human_size
(
total
),
human_size
(
local
),
human_size
(
total
-
local
),
))
logger
.
info
(
"
l2a: {}
"
.
format
(
human_size
(
getFolderSize
(
str
(
self
.
paths
[
"
l2a
"
]),
True
))))
#~ logger.info("l2a: {}".format(human_size(getFolderSize(str(self.paths["l2a"]), True))))
local
=
getFolderSize
(
str
(
self
.
paths
[
"
l2a
"
]))
total
=
getFolderSize
(
str
(
self
.
paths
[
"
l2a
"
]),
True
)
logger
.
info
(
"
l2a: {} (local: {} / archived: {})
"
.
format
(
human_size
(
total
),
human_size
(
local
),
human_size
(
total
-
local
),
))
for
indice
,
path
in
self
.
_paths
[
"
indices
"
].
items
():
logger
.
info
(
"
{}: {}
"
.
format
(
indice
,
human_size
(
getFolderSize
(
str
(
path
),
True
))))
...
...
@@ -516,4 +524,33 @@ class Tile:
if
not
count
:
logger
.
info
(
"
No L1C products to archive
"
)
def
archive_l2a
(
self
):
"""
Check and move l1c products to archive folder
"""
if
(
self
.
clean_lib
()[
'
identified_problems
'
]
-
self
.
clean_lib
()[
'
removed_problems
'
])
==
0
:
logger
.
info
(
"
No tile error processing l2a archive
"
)
l2a_archive_path
=
Path
(
Config
().
get
(
"
l2a_archive_path
"
))
prod_list
=
self
.
l2a
if
prod_list
:
count
=
0
for
prod
in
prod_list
:
l2a
=
L2aProduct
(
prod
.
identifier
)
if
not
l2a
.
path
.
is_symlink
():
count
+=
1
move_path
=
l2a_archive_path
/
l2a
.
tile
/
l2a
.
path
.
name
logger
.
info
(
"
archiving {}
"
.
format
(
l2a
.
identifier
))
move_path
.
parent
.
mkdir
(
exist_ok
=
True
)
shutil
.
move
(
str
(
l2a
.
path
),
str
(
move_path
.
parent
))
l2a
.
path
.
symlink_to
(
move_path
,
target_is_directory
=
True
)
logger
.
info
(
"
{} products archived
"
.
format
(
count
))
else
:
logger
.
info
(
"
No L2A products, nothing to archive
"
)
else
:
logger
.
info
(
"
Error(s) in l2a product(s) please correct them running clean_lib(remove=True) before archiving
"
)
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