Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
let-it-snow
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
let-it-snow
Commits
c2ee3f81
Commit
c2ee3f81
authored
3 years ago
by
Aurore Dupuis
Browse files
Options
Downloads
Patches
Plain Diff
80 - Synthesis refactoring for hysope2
parent
3a3c29b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!77
Release 1.7.1
,
!73
Dockerfile corrections and optimizations
,
!70
Resolve "[H2] - Code refactoring"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python/s2snow/lis_constant.py
+1
-0
1 addition, 0 deletions
python/s2snow/lis_constant.py
python/s2snow/snow_product.py
+15
-2
15 additions, 2 deletions
python/s2snow/snow_product.py
python/s2snow/snow_synthesis.py
+2
-1
2 additions, 1 deletion
python/s2snow/snow_synthesis.py
with
18 additions
and
3 deletions
python/s2snow/lis_constant.py
+
1
−
0
View file @
c2ee3f81
...
...
@@ -44,6 +44,7 @@ MISSION_T5 = "T5"
# snow product mission name
SENTINEL2
=
"
SENTINEL2
"
LIS
=
"
LIS
"
LANDSAT8_OLITIRS_XS
=
"
LANDSAT8-OLITIRS-XS
"
LANDSAT8
=
"
LANDSAT8
"
N2A
=
"
N2A
"
...
...
This diff is collapsed.
Click to expand it.
python/s2snow/snow_product.py
+
15
−
2
View file @
c2ee3f81
...
...
@@ -26,17 +26,19 @@ import os.path as op
import
zipfile
from
os.path
import
basename
,
dirname
from
s2snow.lis_constant
import
SENTINEL2
,
LANDSAT8_OLITIRS_XS
,
LANDSAT8
,
N2A
from
s2snow.lis_constant
import
SENTINEL2
,
LIS
,
LANDSAT8_OLITIRS_XS
,
LANDSAT8
,
N2A
from
s2snow.lis_exception
import
UnknownPlatform
from
s2snow.utils
import
str_to_datetime
MUSCATE_DATETIME_FORMAT
=
"
%Y%m%d-%H%M%S-%f
"
LIS_DATETIME_FORMAT
=
"
%Y%m%dT%H%M%S
"
class
snow_product
:
def
__init__
(
self
,
absoluteFilename
):
# example 1 "SENTINEL2A_20160912-103551-370_L2B-SNOW_T32TLS_D_V1-0"
# example 2 "LANDSAT8_OLITIRS_XS_20160812_N2A_France-MetropoleD0005H0001"
# exemple 3 : "LIS_S2-SNOW-FSC_T31TCH_20180101T105435_1.7.0_1"
logging
.
debug
(
"
snow_product initialisation
"
)
logging
.
debug
(
"
absoluteFilename :
"
+
absoluteFilename
)
...
...
@@ -50,7 +52,7 @@ class snow_product:
logging
.
debug
(
"
product_path :
"
+
self
.
product_path
)
logging
.
debug
(
"
platform :
"
+
self
.
platform
)
if
SENTINEL2
in
self
.
platform
:
if
SENTINEL2
in
self
.
platform
:
self
.
acquisition_date
=
datetime
.
strptime
(
name_splitted
[
1
],
MUSCATE_DATETIME_FORMAT
)
logging
.
debug
(
"
acquisition_date :
"
+
str
(
self
.
acquisition_date
))
self
.
product_level
=
name_splitted
[
2
]
...
...
@@ -81,6 +83,17 @@ class snow_product:
logging
.
debug
(
"
tile_id :
"
+
self
.
tile_id
)
self
.
flag
=
None
self
.
product_version
=
None
elif
LIS
in
self
.
platform
:
# FSC product
self
.
acquisition_date
=
datetime
.
strptime
(
name_splitted
[
3
],
LIS_DATETIME_FORMAT
)
logging
.
debug
(
"
acquisition_date :
"
+
str
(
self
.
acquisition_date
))
self
.
product_level
=
"
L2B
"
logging
.
debug
(
"
product_level :
"
+
self
.
product_level
)
self
.
tile_id
=
name_splitted
[
2
]
logging
.
debug
(
"
tile_id :
"
+
self
.
tile_id
)
self
.
flag
=
None
self
.
product_version
=
name_splitted
[
4
]
logging
.
debug
(
"
product_version :
"
+
self
.
product_version
)
else
:
msg
=
"
Unknown platform:
"
+
self
.
platform
logging
.
error
(
msg
)
...
...
This diff is collapsed.
Click to expand it.
python/s2snow/snow_synthesis.py
+
2
−
1
View file @
c2ee3f81
...
...
@@ -325,7 +325,8 @@ def convert_snow_masks_into_binary_snow_masks(path_out, ram, product_dict):
logging
.
debug
(
"
ram : %s
"
,
str
(
ram
))
# convert the snow masks into binary snow masks
expression
=
"
(im1b1==
"
+
LABEL_SNOW
+
"
)?1:0
"
#expression = "(im1b1==" + LABEL_SNOW + ")?1:0"
expression
=
"
(im1b1>0 and im1b1<=
"
+
LABEL_SNOW
+
"
)?1:0
"
binary_snow_mask_list
=
convert_mask_list
(
path_out
,
product_dict
,
expression
,
"
snow
"
,
ram
,
mask_format
=
GDAL_OPT
)
logging
.
debug
(
"
Binary snow mask list:
"
)
...
...
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