Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVCM
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
9a7a98e8
Commit
9a7a98e8
authored
3 months ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
added SPI_Cloud_Mask to output
parent
a354f5fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
mvcm/main_tests_only.py
+2
-0
2 additions, 0 deletions
mvcm/main_tests_only.py
mvcm/spectral_tests.py
+4
-2
4 additions, 2 deletions
mvcm/spectral_tests.py
mvcm/utility_functions.py
+10
-0
10 additions, 0 deletions
mvcm/utility_functions.py
mvcm/write_output.py
+11
-0
11 additions, 0 deletions
mvcm/write_output.py
with
27 additions
and
2 deletions
mvcm/main_tests_only.py
+
2
−
0
View file @
9a7a98e8
...
...
@@ -431,6 +431,7 @@ def main(
integer_cloud_mask
[(
csc
<=
0.95
)
&
(
csc
>
0.66
)]
=
1
integer_cloud_mask
[
csc
<=
0.66
]
=
0
integer_cloud_mask
=
integer_cloud_mask
.
astype
(
np
.
int8
)
spi
=
utils
.
cloud_mask_spi
(
viirs_data
)
# logger.debug(f"Memory: {tracemalloc.get_traced_memory()}")
cloud_mask
=
np
.
zeros
((
6
,
csc
.
shape
[
0
],
csc
.
shape
[
1
]),
dtype
=
np
.
byte
)
...
...
@@ -448,6 +449,7 @@ def main(
"
cloud_mask
"
:
{
"
dims
"
:
(
"
bits
"
,
"
x
"
,
"
y
"
),
"
data
"
:
cloud_mask
},
"
quality_assurance
"
:
{
"
dims
"
:
(
"
x
"
,
"
y
"
,
"
qa
"
),
"
data
"
:
quality_assurance
},
"
integer_cloud_mask
"
:
{
"
dims
"
:
(
"
x
"
,
"
y
"
),
"
data
"
:
integer_cloud_mask
},
"
spi
"
:
{
"
dims
"
:
(
"
x1
"
,
"
y1
"
),
"
data
"
:
spi
.
values
},
}
old_debug_data
=
{
...
...
This diff is collapsed.
Click to expand it.
mvcm/spectral_tests.py
+
4
−
2
View file @
9a7a98e8
...
...
@@ -776,16 +776,18 @@ class CloudTests:
sunglint
=
scene_for_sunglint
.
find_sunglint
(
self
.
thresholds
[
"
Sun_Glint
"
][
"
bounds
"
][
3
],
day_flag
).
values
# sunglint = scn.find_scene(self.data, self.thresholds["Sun_Glint"]["bounds"][3])[
# "sunglint"
# ]
idx
=
np
.
nonzero
((
solar_zenith
<=
85
)
&
(
sunglint
==
1
))
#
idx = np.nonzero((solar_zenith <= 85) & (sunglint == 1))
thr_no_sunglint
=
np
.
array
([
threshold
[
"
thr
"
][
i
]
for
i
in
range
(
8
)])
thr_sunglint
=
np
.
array
([
self
.
thresholds
[
"
Sun_Glint
"
][
"
snglnt
"
][
i
]
for
i
in
range
(
8
)])
temp_conf
[
sunglint
==
0
]
=
conf
.
conf_test_dble
(
rad
[
sunglint
==
0
],
thr_no_sunglint
)
temp_conf
[
idx
]
=
conf
.
conf_test_dble
(
rad
[
idx
],
thr_sunglint
)
temp_conf
[
sunglint
==
1
]
=
conf
.
conf_test_dble
(
rad
[
sunglint
==
1
],
thr_sunglint
)
kwargs
[
"
confidence
"
][
self
.
scene_idx
]
=
temp_conf
[
self
.
scene_idx
]
idx
=
np
.
nonzero
(
...
...
This diff is collapsed.
Click to expand it.
mvcm/utility_functions.py
+
10
−
0
View file @
9a7a98e8
...
...
@@ -3,9 +3,19 @@
from
typing
import
Dict
import
numpy
as
np
import
xarray
as
xr
from
numpy.lib.stride_tricks
import
sliding_window_view
def
cloud_mask_spi
(
data
:
xr
.
Dataset
):
temp_da
=
xr
.
DataArray
(
data
.
M05
.
values
,
dims
=
(
"
number_of_lines
"
,
"
number_of_pixels
"
))
spi
=
100
*
(
temp_da
.
coarsen
(
number_of_lines
=
2
,
number_of_pixels
=
2
).
std
()
/
temp_da
.
coarsen
(
number_of_lines
=
2
,
number_of_pixels
=
2
).
mean
()
)
return
spi
def
local_nxn_mean
(
arr
:
np
.
ndarray
,
x
:
int
=
3
,
y
:
int
=
3
)
->
np
.
ndarray
:
"""
Return the mean value of each NxM (default 3) pixel region for a given array.
"""
local_mean
=
(
...
...
This diff is collapsed.
Click to expand it.
mvcm/write_output.py
+
11
−
0
View file @
9a7a98e8
...
...
@@ -181,6 +181,17 @@ def save_output(
"
valid_max
"
:
3
,
},
},
"
SPI
"
:
{
"
dims
"
:
(
"
number_of_lines
"
,
"
number_of_pixels
"
),
"
data
"
:
data
.
spi
.
values
,
"
attrs
"
:
{
"
units
"
:
"
none
"
,
"
long_name
"
:
"
VIIRS SPI
"
,
"
_FillValue
"
:
-
999.9
,
"
valid_min
"
:
0.0
,
"
valid_max
"
:
100.0
,
},
},
}
if
debug
is
True
:
...
...
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