Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
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
Tom Rink
python
Commits
2e56935c
Commit
2e56935c
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
fix some cf issues
parent
c40ec28e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/icing/util.py
+64
-31
64 additions, 31 deletions
modules/icing/util.py
with
64 additions
and
31 deletions
modules/icing/util.py
+
64
−
31
View file @
2e56935c
...
@@ -3,7 +3,7 @@ import deeplearning.icing_fcn as icing_fcn
...
@@ -3,7 +3,7 @@ import deeplearning.icing_fcn as icing_fcn
import
deeplearning.icing_cnn
as
icing_cnn
import
deeplearning.icing_cnn
as
icing_cnn
from
icing.pirep_goes
import
setup
,
time_filter_3
from
icing.pirep_goes
import
setup
,
time_filter_3
from
icing.moon_phase
import
moon_phase
from
icing.moon_phase
import
moon_phase
from
util.util
import
get_time_tuple_utc
,
is_day
,
check_oblique
,
get_
average
,
homedir
,
write_icing_file_nc4
,
\
from
util.util
import
get_time_tuple_utc
,
is_day
,
check_oblique
,
get_
median
,
homedir
,
write_icing_file_nc4
,
\
write_icing_file_nc4_viirs
,
\
write_icing_file_nc4_viirs
,
\
make_for_full_domain_predict
,
make_for_full_domain_predict_viirs_clavrx
,
prepare_evaluate
make_for_full_domain_predict
,
make_for_full_domain_predict_viirs_clavrx
,
prepare_evaluate
from
util.plot
import
make_icing_image
from
util.plot
import
make_icing_image
...
@@ -130,7 +130,7 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
...
@@ -130,7 +130,7 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
for
j
in
range
(
num_lines
):
for
j
in
range
(
num_lines
):
for
i
in
range
(
num_elems
):
for
i
in
range
(
num_elems
):
k
=
i
+
j
*
num_elems
k
=
i
+
j
*
num_elems
avg_bt
.
append
(
get_
average
(
bt_10_4
[
k
]))
avg_bt
.
append
(
get_
median
(
bt_10_4
[
k
]))
if
not
check_oblique
(
satzen
[
k
]):
if
not
check_oblique
(
satzen
[
k
]):
continue
continue
...
@@ -155,32 +155,65 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
...
@@ -155,32 +155,65 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
preds_2d_dct
[
flvl
]
=
fd_preds
preds_2d_dct
[
flvl
]
=
fd_preds
probs_2d_dct
[
flvl
]
=
fd_probs
probs_2d_dct
[
flvl
]
=
fd_probs
if
(
day_night
==
'
AUTO
'
or
day_night
==
'
DAY
'
)
and
num_day_tiles
>
0
:
if
day_night
==
'
AUTO
'
or
day_night
==
'
DAY
'
:
if
num_day_tiles
>
0
:
day_data_dct
=
{
name
:
[]
for
name
in
day_train_params
}
day_data_dct
=
{
name
:
[]
for
name
in
day_train_params
}
for
name
in
day_train_params
:
for
name
in
day_train_params
:
for
k
in
day_idxs
:
for
k
in
day_idxs
:
day_data_dct
[
name
].
append
(
data_dct
[
name
][
k
])
day_data_dct
[
name
].
append
(
data_dct
[
name
][
k
])
day_grd_dct
=
{
name
:
None
for
name
in
day_train_params
}
day_grd_dct
=
{
name
:
None
for
name
in
day_train_params
}
for
ds_name
in
day_train_params
:
for
ds_name
in
day_train_params
:
day_grd_dct
[
ds_name
]
=
np
.
stack
(
day_data_dct
[
ds_name
])
day_grd_dct
[
ds_name
]
=
np
.
stack
(
day_data_dct
[
ds_name
])
preds_day_dct
,
probs_day_dct
=
model_module
.
run_evaluate_static
(
day_grd_dct
,
num_day_tiles
,
day_model_path
,
preds_day_dct
,
probs_day_dct
=
model_module
.
run_evaluate_static
(
day_grd_dct
,
num_day_tiles
,
day_model_path
,
day_night
=
'
DAY
'
,
l1b_or_l2
=
l1b_andor_l2
,
day_night
=
'
DAY
'
,
l1b_or_l2
=
l1b_andor_l2
,
prob_thresh
=
prob_thresh
,
prob_thresh
=
prob_thresh
,
use_flight_altitude
=
use_flight_altitude
,
use_flight_altitude
=
use_flight_altitude
,
flight_levels
=
flight_levels
)
flight_levels
=
flight_levels
)
day_idxs
=
np
.
array
(
day_idxs
)
day_idxs
=
np
.
array
(
day_idxs
)
for
flvl
in
flight_levels
:
for
flvl
in
flight_levels
:
day_preds
=
preds_day_dct
[
flvl
]
day_preds
=
preds_day_dct
[
flvl
]
day_probs
=
probs_day_dct
[
flvl
]
day_probs
=
probs_day_dct
[
flvl
]
fd_preds
=
preds_2d_dct
[
flvl
]
fd_preds
=
preds_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
fd_preds
[
day_idxs
]
=
day_preds
[:]
fd_preds
[
day_idxs
]
=
day_preds
[:]
fd_probs
[
day_idxs
]
=
day_probs
[:]
fd_probs
[
day_idxs
]
=
day_probs
[:]
if
(
day_night
==
'
AUTO
'
or
day_night
==
'
NIGHT
'
)
and
num_nght_tiles
>
0
:
if
num_nght_tiles
>
0
:
mode
=
'
NIGHT
'
model_path
=
night_model_path
if
use_dnb
and
lunar_illuminated
:
model_path
=
day_model_path
mode
=
'
DAY
'
nght_train_params
=
train_params_dnb
nght_data_dct
=
{
name
:
[]
for
name
in
nght_train_params
}
for
name
in
nght_train_params
:
for
k
in
nght_idxs
:
nght_data_dct
[
name
].
append
(
data_dct
[
name
][
k
])
nght_grd_dct
=
{
name
:
None
for
name
in
nght_train_params
}
for
ds_name
in
nght_train_params
:
nght_grd_dct
[
ds_name
]
=
np
.
stack
(
nght_data_dct
[
ds_name
])
preds_nght_dct
,
probs_nght_dct
=
model_module
.
run_evaluate_static
(
nght_grd_dct
,
num_nght_tiles
,
model_path
,
day_night
=
mode
,
l1b_or_l2
=
l1b_andor_l2
,
prob_thresh
=
prob_thresh
,
use_flight_altitude
=
use_flight_altitude
,
flight_levels
=
flight_levels
)
nght_idxs
=
np
.
array
(
nght_idxs
)
for
flvl
in
flight_levels
:
nght_preds
=
preds_nght_dct
[
flvl
]
nght_probs
=
probs_nght_dct
[
flvl
]
fd_preds
=
preds_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
fd_preds
[
nght_idxs
]
=
nght_preds
[:]
fd_probs
[
nght_idxs
]
=
nght_probs
[:]
elif
day_night
==
'
NIGHT
'
:
model_path
=
night_model_path
model_path
=
night_model_path
all_idxs
=
np
.
arange
(
num_lines
*
num_elems
)
mode
=
'
NIGHT
'
mode
=
'
NIGHT
'
if
use_dnb
and
lunar_illuminated
:
if
use_dnb
and
lunar_illuminated
:
...
@@ -190,7 +223,7 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
...
@@ -190,7 +223,7 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
nght_data_dct
=
{
name
:
[]
for
name
in
nght_train_params
}
nght_data_dct
=
{
name
:
[]
for
name
in
nght_train_params
}
for
name
in
nght_train_params
:
for
name
in
nght_train_params
:
for
k
in
nght
_idxs
:
for
k
in
all
_idxs
:
nght_data_dct
[
name
].
append
(
data_dct
[
name
][
k
])
nght_data_dct
[
name
].
append
(
data_dct
[
name
][
k
])
nght_grd_dct
=
{
name
:
None
for
name
in
nght_train_params
}
nght_grd_dct
=
{
name
:
None
for
name
in
nght_train_params
}
for
ds_name
in
nght_train_params
:
for
ds_name
in
nght_train_params
:
...
@@ -201,15 +234,15 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
...
@@ -201,15 +234,15 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
prob_thresh
=
prob_thresh
,
prob_thresh
=
prob_thresh
,
use_flight_altitude
=
use_flight_altitude
,
use_flight_altitude
=
use_flight_altitude
,
flight_levels
=
flight_levels
)
flight_levels
=
flight_levels
)
nght_idxs
=
np
.
array
(
nght_idxs
)
for
flvl
in
flight_levels
:
for
flvl
in
flight_levels
:
nght_preds
=
preds_nght_dct
[
flvl
]
nght_preds
=
preds_nght_dct
[
flvl
]
nght_probs
=
probs_nght_dct
[
flvl
]
nght_probs
=
probs_nght_dct
[
flvl
]
fd_preds
=
preds_2d_dct
[
flvl
]
fd_preds
=
preds_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
fd_preds
[
nght
_idxs
]
=
nght_preds
[:]
fd_preds
[
all
_idxs
]
=
nght_preds
[:]
fd_probs
[
nght
_idxs
]
=
nght_probs
[:]
fd_probs
[
all
_idxs
]
=
nght_probs
[:]
# combine day and night into full grid ------------------------------------------
for
flvl
in
flight_levels
:
for
flvl
in
flight_levels
:
fd_preds
=
preds_2d_dct
[
flvl
]
fd_preds
=
preds_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
fd_probs
=
probs_2d_dct
[
flvl
]
...
...
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