Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVCM
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
Paolo Veglio
MVCM
Commits
e3452942
Commit
e3452942
authored
1 month ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
updated fill values for night data
parent
96f0d08d
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
mvcm/constants.py
+17
-0
17 additions, 0 deletions
mvcm/constants.py
mvcm/main_tests_only.py
+6
-2
6 additions, 2 deletions
mvcm/main_tests_only.py
mvcm/utility_functions.py
+3
-2
3 additions, 2 deletions
mvcm/utility_functions.py
with
26 additions
and
4 deletions
mvcm/constants.py
+
17
−
0
View file @
e3452942
...
...
@@ -15,6 +15,7 @@ class ConstantsNamespace:
BAD_DATA
=
-
999.0
FILL_VALUE
=
-
999.9
FILL_VALUE_INT
=
-
9999
FILL_VALUE_ICM
=
-
1
DTR
=
np
.
pi
/
180.0
RTD
=
180.0
/
np
.
pi
...
...
@@ -149,6 +150,22 @@ class SceneConstants:
"
Land_Day_Coast
"
,
)
DAY_ONLY_SCENE_LIST
=
(
"
Ocean_Day
"
,
"
Land_Day
"
,
"
Day_Snow
"
,
"
Land_Day_Desert
"
,
"
Antarctic_Day
"
,
"
Polar_Day_Snow
"
,
"
Polar_Day_Desert
"
,
"
Polar_Day_Ocean
"
,
"
Polar_Day_Desert_Coast
"
,
"
Polar_Day_Coast
"
,
"
Polar_Day_Land
"
,
"
Land_Day_Desert_Coast
"
,
"
Land_Day_Coast
"
,
)
FLAGS
=
(
"
day
"
,
"
night
"
,
...
...
This diff is collapsed.
Click to expand it.
mvcm/main_tests_only.py
+
6
−
2
View file @
e3452942
...
...
@@ -13,7 +13,7 @@ from ruamel.yaml import YAML
import
mvcm.spectral_tests
as
tst
import
mvcm.utility_functions
as
utils
from
mvcm.constants
import
SceneConstants
,
SensorConstants
from
mvcm.constants
import
ConstantsNamespace
,
SceneConstants
,
SensorConstants
from
mvcm.restoral
import
Restoral
from
mvcm.write_output
import
save_output
...
...
@@ -166,7 +166,7 @@ def main(
viirs_data
[
"
high_elevation
"
]
=
pixel_type
.
high_elevation
logger
.
info
(
f
"
Memory usage #5:
{
proc
.
memory_info
().
rss
/
1e6
}
MB
"
)
# scene_types = np.zeros(viirs_data.M11.shape, dtype=np.ubyte)
for
scene_name
in
SceneConstants
.
SCENE_LIST
:
for
scene_name
in
SceneConstants
.
DAY_ONLY_
SCENE_LIST
:
logger
.
info
(
f
"
Processing
{
scene_name
}
"
)
if
np
.
all
(
viirs_data
[
scene_name
].
values
==
0
):
...
...
@@ -204,6 +204,7 @@ def main(
logger
.
info
(
f
"
Memory usage #6:
{
proc
.
memory_info
().
rss
/
1e6
}
MB
"
)
# Group 1
cmin_g1
,
bits
[
"
01
"
]
=
my_scene
.
test_11um
(
m15_name
,
cmin_g1
,
bits
[
"
01
"
])
# this test needs to be implemented properly,
# for now is commented since it's only used for night granules
cmin_g1
,
bits
[
"
02
"
]
=
my_scene
.
surface_temperature_test
(
...
...
@@ -431,9 +432,12 @@ def main(
integer_cloud_mask
[(
csc
<=
0.99
)
&
(
csc
>
0.95
)]
=
2
integer_cloud_mask
[(
csc
<=
0.95
)
&
(
csc
>
0.66
)]
=
1
integer_cloud_mask
[
csc
<=
0.66
]
=
0
integer_cloud_mask
[
pixel_type
.
night
==
1
]
=
ConstantsNamespace
.
FILL_VALUE_ICM
integer_cloud_mask
=
integer_cloud_mask
.
astype
(
np
.
int8
)
spi
=
utils
.
cloud_mask_spi
(
viirs_data
)
csc
[
pixel_type
.
night
==
1
]
=
ConstantsNamespace
.
FILL_VALUE
# logger.debug(f"Memory: {tracemalloc.get_traced_memory()}")
# cloud_mask = np.zeros((6, csc.shape[0], csc.shape[1]), dtype=np.byte)
# quality_assurance = np.zeros((csc.shape[0], csc.shape[1], 10), dtype=np.ubyte)
...
...
This diff is collapsed.
Click to expand it.
mvcm/utility_functions.py
+
3
−
2
View file @
e3452942
...
...
@@ -144,7 +144,8 @@ def combine_indices(index1: tuple, index2: tuple, shape: tuple) -> tuple:
def
set_cm_bytes
(
cloud_mask
:
np
.
ndarray
,
bits
:
dict
,
pixel_type
:
xr
.
Dataset
)
->
np
.
ndarray
:
"""
Compute cloud mask bytes.
"""
cm_flag
=
1
# for now I'm hard setting this to one
# for now this is set as 1 for all daytime pixels regardless of whether the cloud mask ran
cm_flag
=
np
.
where
(
pixel_type
.
night
==
0
,
1
,
0
)
snow_ice
=
np
.
clip
(
pixel_type
.
snow
.
values
+
pixel_type
.
ice
.
values
,
0
,
1
)
snow_ice
=
np
.
clip
(
np
.
abs
(
snow_ice
-
1
),
0
,
1
)
sunglint
=
np
.
clip
(
np
.
abs
(
pixel_type
.
sunglint
.
values
-
1
),
0
,
1
)
...
...
@@ -187,7 +188,7 @@ def set_cm_bytes(cloud_mask: np.ndarray, bits: dict, pixel_type: xr.Dataset) ->
cloud_1_38_test
=
bits
[
"
15
"
]
cloud_3_9_12um_test
=
bits
[
"
16
"
]
cloud_ir_temp_difference
=
bits
[
"
05
"
]
cloud_3_9_11um_test
=
bits
[
"
0
8
"
]
+
bits
[
"
09
"
]
cloud_3_9_11um_test
=
bits
[
"
0
7
"
]
#
+ bits["09"]
cloud_vis_reflectance
=
bits
[
"
10
"
]
+
bits
[
"
13
"
]
cloud_vis_ratio
=
bits
[
"
11
"
]
restoral_ndvi_coast
=
bits
[
"
r03
"
]
+
bits
[
"
r05
"
]
...
...
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