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
ef2c805f
Commit
ef2c805f
authored
2 years ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
7.3-11um Test implemented. Polar Night Snow and Night Snow still require work
parent
92f45896
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
preprocess_thresholds.py
+88
-0
88 additions, 0 deletions
preprocess_thresholds.py
read_data.py
+2
-0
2 additions, 0 deletions
read_data.py
tests.py
+11
-3
11 additions, 3 deletions
tests.py
thresholds.mvcm.snpp.v0.0.1.yaml
+51
-26
51 additions, 26 deletions
thresholds.mvcm.snpp.v0.0.1.yaml
with
152 additions
and
29 deletions
preprocess_thresholds.py
+
88
−
0
View file @
ef2c805f
...
...
@@ -263,6 +263,94 @@ def get_b1_thresholds(data, thresholds):
return
locut
,
midpt
,
hicut
def
get_pn_thresholds
(
data
,
thresholds
,
scene
,
test_name
):
thresholds
=
thresholds
[
scene
]
if
((
test_name
==
'
4-12um_BTD_Thin_Cirrus_Test
'
)
and
(
scene
in
[
'
Land_Night
'
,
'
Night_Snow
'
])
or
(
test_name
==
'
7.3-11um_BTD_Mid_Level_Cloud_Test
'
)
and
(
scene
==
'
Land_Night
'
)):
locut
=
thresholds
[
test_name
][
'
thr
'
][
0
]
*
np
.
ones
(
data
.
M15
.
shape
)
midpt
=
thresholds
[
test_name
][
'
thr
'
][
1
]
*
np
.
ones
(
data
.
M15
.
shape
)
hicut
=
thresholds
[
test_name
][
'
thr
'
][
2
]
*
np
.
ones
(
data
.
M15
.
shape
)
power
=
thresholds
[
test_name
][
'
thr
'
][
3
]
*
np
.
ones
(
data
.
M15
.
shape
)
out_thr
=
xr
.
DataArray
(
data
=
np
.
dstack
((
locut
,
midpt
,
hicut
,
np
.
ones
(
data
.
ndvi
.
shape
),
power
)),
dims
=
(
'
number_of_lines
'
,
'
number_of_pixels
'
,
'
z
'
))
return
out_thr
rad
=
data
.
M15
.
values
.
reshape
(
data
.
M15
.
shape
[
0
]
*
data
.
M15
.
shape
[
1
])
bt_bounds
=
thresholds
[
test_name
][
'
bt11_bounds
'
]
locut
,
midpt
=
np
.
empty
(
rad
.
shape
),
np
.
empty
(
rad
.
shape
)
hicut
,
power
=
np
.
empty
(
rad
.
shape
),
np
.
empty
(
rad
.
shape
)
lo
,
hi
=
np
.
empty
(
rad
.
shape
),
np
.
empty
(
rad
.
shape
)
lo_thr
,
hi_thr
=
np
.
empty
(
rad
.
shape
),
np
.
empty
(
rad
.
shape
)
conf_range
=
np
.
empty
(
rad
.
shape
)
idx
=
np
.
nonzero
(
rad
<
bt_bounds
[
0
])
locut
[
idx
]
=
thresholds
[
test_name
][
'
low
'
][
0
]
midpt
[
idx
]
=
thresholds
[
test_name
][
'
low
'
][
1
]
hicut
[
idx
]
=
thresholds
[
test_name
][
'
low
'
][
2
]
power
[
idx
]
=
thresholds
[
test_name
][
'
low
'
][
3
]
idx
=
np
.
nonzero
(
rad
>
bt_bounds
[
3
])
locut
[
idx
]
=
thresholds
[
test_name
][
'
high
'
][
0
]
midpt
[
idx
]
=
thresholds
[
test_name
][
'
high
'
][
1
]
hicut
[
idx
]
=
thresholds
[
test_name
][
'
high
'
][
2
]
power
[
idx
]
=
thresholds
[
test_name
][
'
high
'
][
3
]
# # # # #
idx
=
np
.
nonzero
((
rad
>=
bt_bounds
[
0
])
&
(
rad
<=
bt_bounds
[
3
])
&
(
bt_bounds
[
1
]
==
0
)
&
(
bt_bounds
[
2
]
==
0
))
lo
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
0
]
hi
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
3
]
lo_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
0
]
hi_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
1
]
power
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
3
]
conf_range
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
2
]
idx
=
np
.
nonzero
((
rad
>=
bt_bounds
[
0
])
&
(
rad
<
bt_bounds
[
1
]))
lo
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
0
]
hi
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
1
]
lo_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
0
]
hi_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
1
]
power
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
3
]
conf_range
[
idx
]
=
thresholds
[
test_name
][
'
mid1
'
][
2
]
idx
=
np
.
nonzero
((
rad
>=
bt_bounds
[
1
])
&
(
rad
<
bt_bounds
[
2
]))
lo
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
1
]
hi
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
2
]
lo_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid2
'
][
0
]
hi_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid2
'
][
1
]
power
[
idx
]
=
thresholds
[
test_name
][
'
mid2
'
][
3
]
conf_range
[
idx
]
=
thresholds
[
test_name
][
'
mid2
'
][
2
]
idx
=
np
.
nonzero
((
rad
>=
bt_bounds
[
2
])
&
(
rad
<
bt_bounds
[
3
]))
lo
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
2
]
hi
[
idx
]
=
thresholds
[
test_name
][
'
bt11_bounds
'
][
3
]
lo_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid3
'
][
0
]
hi_thr
[
idx
]
=
thresholds
[
test_name
][
'
mid3
'
][
1
]
power
[
idx
]
=
thresholds
[
test_name
][
'
mid3
'
][
3
]
conf_range
[
idx
]
=
thresholds
[
test_name
][
'
mid3
'
][
2
]
idx
=
np
.
nonzero
(((
rad
>=
bt_bounds
[
0
])
&
(
rad
<
bt_bounds
[
3
]))
|
(
bt_bounds
[
1
]
==
0.0
)
|
(
bt_bounds
[
2
]
==
0
))
a
=
(
rad
[
idx
]
-
lo
[
idx
])
/
(
hi
[
idx
]
-
lo
[
idx
])
midpt
[
idx
]
=
lo_thr
[
idx
]
+
(
a
*
(
hi_thr
[
idx
]
-
lo_thr
[
idx
]))
hicut
[
idx
]
=
midpt
[
idx
]
-
conf_range
[
idx
]
locut
[
idx
]
=
midpt
[
idx
]
+
conf_range
[
idx
]
locut
=
locut
.
reshape
(
data
.
M15
.
shape
)
midpt
=
midpt
.
reshape
(
data
.
M15
.
shape
)
hicut
=
hicut
.
reshape
(
data
.
M15
.
shape
)
power
=
power
.
reshape
(
data
.
M15
.
shape
)
out_thr
=
xr
.
DataArray
(
data
=
np
.
dstack
((
locut
,
midpt
,
hicut
,
np
.
ones
(
data
.
ndvi
.
shape
),
power
)),
dims
=
(
'
number_of_lines
'
,
'
number_of_pixels
'
,
'
z
'
))
return
out_thr
def
vis_refl_thresholds
(
data
,
thresholds
,
scene
):
locut
,
midpt
,
hicut
=
get_b1_thresholds
(
data
,
thresholds
)
...
...
This diff is collapsed.
Click to expand it.
read_data.py
+
2
−
0
View file @
ef2c805f
...
...
@@ -143,6 +143,8 @@ def get_data(file_names, sunglint_angle):
viirs_data
.
M15
.
values
-
viirs_data
.
M16
.
values
)
viirs_data
[
'
M15-M13
'
]
=
((
'
number_of_lines
'
,
'
number_of_pixels
'
),
viirs_data
.
M15
.
values
-
viirs_data
.
M13
.
values
)
viirs_data
[
'
M13-M16
'
]
=
((
'
number_of_lines
'
,
'
number_of_pixels
'
),
viirs_data
.
M13
.
values
-
viirs_data
.
M16
.
values
)
scene_flags
=
scn
.
find_scene
(
viirs_data
,
sunglint_angle
)
scene
=
scn
.
scene_id
(
scene_flags
)
...
...
This diff is collapsed.
Click to expand it.
tests.py
+
11
−
3
View file @
ef2c805f
...
...
@@ -271,12 +271,16 @@ class CloudTests:
thr_xr
[
'
threshold
'
]
=
pt
.
preproc
(
self
.
data
,
self
.
thresholds
[
self
.
scene_name
],
self
.
scene_name
)
thr
=
np
.
ones
((
5
,))
# This is only temporary to force the logic of the code
# I need to find a better solution at some point
elif
test_name
==
'
Surface_Temperature_Test
'
:
thr_xr
[
'
threshold
'
]
=
pt
.
preproc_surf_temp
(
self
.
data
,
self
.
thresholds
[
self
.
scene_name
])
thr
=
np
.
ones
((
5
,))
elif
test_name
==
'
SST_Test
'
:
thr_xr
[
'
threshold
'
]
=
((
'
number_of_lines
'
,
'
number_of_pixels
'
,
'
z
'
),
np
.
ones
((
self
.
data
[
band
].
shape
[
0
],
self
.
data
[
band
].
shape
[
1
],
5
))
*
thr
)
elif
test_name
==
'
7.3-11um_BTD_Mid_Level_Cloud_Test
'
:
thr_xr
[
'
threshold
'
]
=
pt
.
get_pn_thresholds
(
self
.
data
,
self
.
thresholds
,
self
.
scene_name
,
'
7.3-11um_BTD_Mid_Level_Cloud_Test
'
)
thr
=
np
.
ones
((
5
,))
elif
test_name
==
'
Surface_Temperature_Test
'
:
thr_xr
[
'
threshold
'
]
=
pt
.
preproc_surf_temp
(
self
.
data
,
self
.
thresholds
[
self
.
scene_name
])
thr
=
np
.
ones
((
5
,))
elif
test_name
==
'
NIR_Reflectance_Test
'
:
corr_thr
=
pt
.
preproc_nir
(
self
.
data
,
self
.
thresholds
,
self
.
scene_name
)
thr_xr
[
'
threshold
'
]
=
((
'
number_of_lines
'
,
'
number_of_pixels
'
,
'
z
'
),
corr_thr
)
...
...
@@ -284,6 +288,10 @@ class CloudTests:
thr_xr
[
'
threshold
'
],
self
.
data
[
'
M128
'
]
=
pt
.
vis_refl_thresholds
(
self
.
data
,
self
.
thresholds
,
self
.
scene_name
)
elif
test_name
==
'
4-12um_BTD_Thin_Cirrus_Test
'
:
thr_xr
[
'
threshold
'
]
=
pt
.
get_pn_thresholds
(
self
.
data
,
self
.
thresholds
,
self
.
scene_name
,
'
4-12um_BTD_Thin_Cirrus_Test
'
)
thr
=
np
.
ones
((
5
,))
else
:
thr_xr
[
'
threshold
'
]
=
((
'
number_of_lines
'
,
'
number_of_pixels
'
,
'
z
'
),
np
.
ones
((
self
.
data
[
band
].
shape
[
0
],
self
.
data
[
band
].
shape
[
1
],
5
))
*
thr
)
...
...
This diff is collapsed.
Click to expand it.
thresholds.mvcm.snpp.v0.0.1.yaml
+
51
−
26
View file @
ef2c805f
...
...
@@ -27,10 +27,12 @@ Land_Night:
adj
:
0
bt1
:
270.0
# WILL FIND A BETTER NAME AT SOME POINT, MAYBE
lat
:
30.0
nl4_12hi
:
[
15.0
,
10.0
,
5.00
,
1.0
,
1.0
]
4-12um_BTD_Thin_Cirrus_Test
:
thr
:
[
15.0
,
10.0
,
5.00
,
1.0
,
1.0
]
CO2_High_Clouds_Test
:
[
222.0
,
224.0
,
226.0
,
1.0
,
1.0
]
Water_Vapor_High_Clouds_Test
:
[
215.0
,
220.0
,
225.0
,
1.0
,
1.0
]
nl7_11s
:
[
-8.0
,
-10.0
,
-11.0
,
1.0
,
1.0
]
7.3-11um_BTD_Mid_Level_Cloud_Test
:
thr
:
[
-8.0
,
-10.0
,
-11.0
,
1.0
,
1.0
]
# nl7_11s
nl_11_4l
:
[
0.0
,
-0.5
,
-1.0
,
1.0
]
nl_11_4h
:
[
6.5
,
6.0
,
5.5
,
1.0
]
nl_11_4m
:
[
-0.5
,
6.0
,
0.5
,
1.0
]
...
...
@@ -203,12 +205,20 @@ Polar_Night_Land:
pnl_11_4_pfm
:
1.0
pnl_7_11_pfm
:
1.0
pnl_4_12_pfm
:
1.0
pnl_11_4l
:
[
2.00
,
1.70
,
1.40
,
1.0
]
pnl_11_4h
:
[
1.00
,
0.70
,
0.40
,
1.0
]
pnl_11_4m1
:
[
1.70
,
0.70
,
0.300
,
1.0
]
pnl_11_4m2
:
[
0.00
,
0.00
,
0.00
,
0.0
]
pnl_11_4m3
:
[
0.00
,
0.00
,
0.00
,
0.0
]
pnl_11_bounds
:
[
235.0
,
000.0
,
000.0
,
265.0
]
7.3-11um_BTD_Mid_Level_Cloud_Test
:
low
:
[
-1.00
,
0.00
,
1.00
,
1.0
,
1.0
]
# pn_7_11l
mid1
:
[
0.00
,
-4.50
,
-1.00
,
1.0
]
# pn_7_11m1
mid2
:
[
-4.50
,
-10.50
,
-1.00
,
1.0
]
# pn_7_11m2
mid3
:
[
-10.50
,
-20.0
,
-1.00
,
1.0
]
# pn_7_11m3
high
:
[
-21.0
,
-20.0
,
-19.0
,
1.0
]
# pn_7_11h
bt11_bounds
:
[
220.0
,
245.0
,
255.0
,
265.0
]
# bt11_bnds2
4-12um_BTD_Thin_Cirrus_Test
:
low
:
[
2.00
,
1.70
,
1.40
,
1.0
]
mid1
:
[
1.70
,
0.70
,
0.300
,
1.0
]
mid2
:
[
0.00
,
0.00
,
0.00
,
0.0
]
mid3
:
[
0.00
,
0.00
,
0.00
,
0.0
]
high
:
[
1.00
,
0.70
,
0.40
,
1.0
]
bt11_bounds
:
[
235.0
,
000.0
,
000.0
,
265.0
]
Polar_Day_Coast
:
11-12um_Cirrus_Test
:
...
...
@@ -282,22 +292,26 @@ Polar_Night_Snow:
cmult
:
0
adj
:
0
# I NEED TO WORK ON THIS
bt1
:
270.0
pn_4_12l
:
[
4.50
,
4.00
,
3.50
,
1.0
]
pn_4_12h
:
[
2.50
,
2.00
,
1.50
,
1.0
]
pn_4_12m1
:
[
4.00
,
2.00
,
0.500
,
1.0
]
pn_4_12m2
:
[
0.00
,
0.00
,
0.00
,
0.0
]
pn_4_12m3
:
[
0.00
,
0.00
,
0.00
,
0.0
]
4-12um_BTD_Thin_Cirrus_Test
:
low
:
[
4.50
,
4.00
,
3.50
,
1.0
]
# pn_4_12l
mid1
:
[
4.00
,
2.00
,
0.500
,
1.0
]
# pn_4_12m1
mid2
:
[
0.00
,
0.00
,
0.00
,
0.0
]
# pn_4_12m2
mid3
:
[
0.00
,
0.00
,
0.00
,
0.0
]
# pn_4_12m3
high
:
[
2.50
,
2.00
,
1.50
,
1.0
]
# pn_4_12h
bt11_bounds
:
[
235.0
,
0.0
,
0.0
,
265.0
]
# bt_11_bounds
pns_4_12_pfm
:
1.0
pn_7_11l
:
[
-1.00
,
0.00
,
1.00
,
1.0
,
1.0
]
pn_7_11h
:
[
-21.0
,
-20.0
,
-19.0
,
1.0
]
pn_7_11m1
:
[
0.00
,
-4.50
,
-1.00
,
1.0
]
pn_7_11m2
:
[
-4.50
,
-10.50
,
-1.00
,
1.0
]
pn_7_11m3
:
[
-10.50
,
-20.0
,
-1.00
,
1.0
]
pn_7_11lw
:
[
0.00
,
1.00
,
2.00
,
1.0
]
pn_7_11hw
:
[
-21.0 -20.0
,
-19.0
,
1.0
]
pn_7_11m1w
:
[
1.00
,
-7.00
,
-1.00
,
1.0
]
pn_7_11m2w
:
[
-7.00
,
-16.50
,
-1.00
,
1.0
]
pn_7_11m3w
:
[
-16.50
,
-20.0
,
-1.00
,
1.0
]
7.3-11um_BTD_Mid_Level_Cloud_Test
:
low
:
[
-1.00
,
0.00
,
1.00
,
1.0
,
1.0
]
# pn_7_11l
mid1
:
[
0.00
,
-4.50
,
-1.00
,
1.0
]
# pn_7_11m1
mid2
:
[
-4.50
,
-10.50
,
-1.00
,
1.0
]
# pn_7_11m2
mid3
:
[
-10.50
,
-20.0
,
-1.00
,
1.0
]
# pn_7_11m3
high
:
[
-21.0
,
-20.0
,
-19.0
,
1.0
]
# pn_7_11h
low_ice
:
[
0.00
,
1.00
,
2.00
,
1.0
]
# pn_7_11lw
mid1_ice
:
[
1.00
,
-7.00
,
-1.00
,
1.0
]
# pn_7_11m1w
mid2_ice
:
[
-7.00
,
-16.50
,
-1.00
,
1.0
]
# pn_7_11m2w
mid3_ice
:
[
-16.50
,
-20.0
,
-1.00
,
1.0
]
# pn_7_11m3w
high_ice
:
[
-21.0 -20.0
,
-19.0
,
1.0
]
# pn_7_11hw
bt11_bounds
:
[
220.0
,
245.0
,
255.0
,
265.0
]
# bt11_bnds2
Water_Vapor_High_Clouds_Test
:
[
215.0
,
220.0
,
225.0
,
1.0
,
1.0
]
pn_11_4l
:
[
2.00
,
1.70
,
1.40
,
1.0
]
pn_11_4h
:
[
0.60
,
0.30
,
0.00
,
1.0
]
...
...
@@ -305,8 +319,6 @@ Polar_Night_Snow:
pn_11_4m2
:
[
0.00
,
0.00
,
0.00
,
0.0
]
pn_11_4m3
:
[
0.00
,
0.00
,
0.00
,
0.0
]
pns_11_4_pfm
:
1.0
bt_11_bounds
:
[
235.0
,
000.0
,
000.0
,
265.0
]
bt_11_bnds2
:
[
220.0
,
245.0
,
255.0
,
265.0
]
pn_11_4bl
:
[
-3.00
,
-2.50
,
-2.00
,
1.0
]
pn_11_4bh
:
[
-3.00
,
-2.50
,
-2.00
,
1.0
]
pn_11_4bm1
:
[
-2.50
,
-2.50
,
-0.50
,
1.0
]
...
...
@@ -389,7 +401,20 @@ Night_Snow:
nsbt2
:
270.0
nsbt3
:
230.0
ns11_4lo
:
[
0.70
,
0.60
,
0.50
,
1.0
,
1.0
]
ns4_12hi
:
[
4.50
,
4.00
,
3.50
,
1.0
,
1.0
]
4-12um_BTD_Thin_Cirrus_Test
:
thr
:
[
4.50
,
4.00
,
3.50
,
1.0
,
1.0
]
7.3-11um_BTD_Mid_Level_Cloud_Test
:
low
:
[
-1.00
,
0.00
,
1.00
,
1.0
,
1.0
]
# pn_7_11l
mid1
:
[
0.00
,
-4.50
,
-1.00
,
1.0
]
# pn_7_11m1
mid2
:
[
-4.50
,
-10.50
,
-1.00
,
1.0
]
# pn_7_11m2
mid3
:
[
-10.50
,
-20.0
,
-1.00
,
1.0
]
# pn_7_11m3
high
:
[
-21.0
,
-20.0
,
-19.0
,
1.0
]
# pn_7_11h
low_ice
:
[
0.00
,
1.00
,
2.00
,
1.0
]
# pn_7_11lw
mid1_ice
:
[
1.00
,
-7.00
,
-1.00
,
1.0
]
# pn_7_11m1w
mid2_ice
:
[
-7.00
,
-16.50
,
-1.00
,
1.0
]
# pn_7_11m2w
mid3_ice
:
[
-16.50
,
-20.0
,
-1.00
,
1.0
]
# pn_7_11m3w
high_ice
:
[
-21.0 -20.0
,
-19.0
,
1.0
]
# pn_7_11hw
bt11_bounds
:
[
220.0
,
245.0
,
255.0
,
265.0
]
# bt11_bnds2
CO2_High_Clouds_Test
:
[
222.0
,
224.0
,
226.0
,
1.0
,
1.0
]
Water_Vapor_High_Clouds_Test
:
[
215.0
,
220.0
,
225.0
,
1.0
,
1.0
]
ns11_12adj
:
0.8
...
...
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