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
cc4263fc
Commit
cc4263fc
authored
1 year ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
fbbbfeac
No related branches found
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
+8
-19
8 additions, 19 deletions
modules/icing/util.py
with
8 additions
and
19 deletions
modules/icing/util.py
+
8
−
19
View file @
cc4263fc
...
...
@@ -1483,19 +1483,11 @@ def run_icing_predict_image_1x1(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou
pirep_file
=
'
/Users/tomrink/data/pirep/pireps_202109200000_202109232359.csv
'
,
obs_lons
=
None
,
obs_lats
=
None
,
obs_times
=
None
,
obs_alt
=
None
,
flight_level
=
None
,
obs_intensity
=
None
):
# import deeplearning.icing_fcn as icing_fcn
# model_module = icing_fcn
#
# if day_model_path is not None:
# day_model = model_module.load_model(day_model_path, day_night='DAY', l1b_andor_l2=l1b_andor_l2,
# use_flight_altitude=use_flight_altitude)
# if night_model_path is not None:
# night_model = model_module.load_model(night_model_path, day_night='NIGHT', l1b_andor_l2=l1b_andor_l2,
# use_flight_altitude=use_flight_altitude)
# load parameter stats and model from disk
stdSclr_day
=
joblib
.
load
(
'
/home/rink/stdSclr_4_day.pkl
'
)
day_model
=
joblib
.
load
(
'
/home/rink/icing_gbm_day.pkl
'
)
stdSclr_nght
=
joblib
.
load
(
'
/home/rink/stdSclr_4_nght.pkl
'
)
nght_model
=
joblib
.
load
(
'
/home/rink/icing_gbm_nght.pkl
'
)
...
...
@@ -1513,8 +1505,8 @@ def run_icing_predict_image_1x1(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou
if
flight_level
is
not
None
:
alt_lo
,
alt_hi
=
flt_level_ranges
[
flight_level
]
#
day_train_params
, _, _ = get_training_parameters(day_night='DAY', l1b_andor_l2=l1b_andor_l2)
#
nght_train_params
, _, _ = get_training_parameters(day_night='NIGHT', l1b_andor_l2=l1b_andor_l2)
day_train_params
=
[
'
cld_temp_acha
'
,
'
supercooled_cloud_fraction
'
,
'
cld_reff_dcomp
'
,
'
cld_opd_dcomp
'
]
nght_train_params
=
[
'
cld_temp_acha
'
,
'
supercooled_cloud_fraction
'
,
'
cld_reff_acha
'
,
'
cld_opd_acha
'
]
#
# if day_night == 'AUTO':
# train_params = list(set(day_train_params + nght_train_params))
...
...
@@ -1522,8 +1514,6 @@ def run_icing_predict_image_1x1(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou
# train_params = day_train_params
# elif day_night == 'NIGHT':
# train_params = nght_train_params
day_train_params
=
[
'
cld_temp_acha
'
,
'
supercooled_cloud_fraction
'
,
'
cld_reff_dcomp
'
,
'
cld_opd_dcomp
'
]
nght_train_params
=
[
'
cld_temp_acha
'
,
'
supercooled_cloud_fraction
'
,
'
cld_reff_acha
'
,
'
cld_opd_acha
'
]
if
satellite
==
'
H08
'
:
clvrx_ds
=
CLAVRx_H08
(
clvrx_dir
)
...
...
@@ -1571,9 +1561,9 @@ def run_icing_predict_image_1x1(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou
num_nght_tiles
=
np
.
sum
(
nght_idxs
)
print
(
'
num nght tiles:
'
,
num_nght_tiles
)
cl
dy
_idxs
=
cldmsk
>=
2
num_cl
dy
_tiles
=
np
.
sum
(
cl
dy
_idxs
)
print
(
'
num cl
oudy
tiles:
'
,
num_cl
dy
_tiles
)
cl
r
_idxs
=
cldmsk
<
2
num_cl
r
_tiles
=
np
.
sum
(
cl
r
_idxs
)
print
(
'
num cl
ear
tiles:
'
,
num_cl
r
_tiles
)
fd_preds
=
np
.
zeros
(
num_lines
*
num_elems
,
dtype
=
np
.
int8
)
fd_probs
=
np
.
zeros
(
num_lines
*
num_elems
,
dtype
=
np
.
float32
)
...
...
@@ -1581,18 +1571,17 @@ def run_icing_predict_image_1x1(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou
fd_probs
[:]
=
-
1.0
if
(
day_night
==
'
AUTO
'
or
day_night
==
'
DAY
'
)
and
num_day_tiles
>
0
:
varX_std
=
stdSclr_day
.
transform
(
varX_day
)
varX_std
=
np
.
where
(
np
.
isnan
(
varX_std
),
0
,
varX_std
)
probs
=
day_model
.
predict_proba
(
varX_std
)[:,
1
]
fd_probs
[
day_idxs
]
=
probs
[
day_idxs
]
if
(
day_night
==
'
AUTO
'
or
day_night
==
'
NIGHT
'
)
and
num_nght_tiles
>
0
:
varX_std
=
stdSclr_nght
.
transform
(
varX_ngth
)
varX_std
=
np
.
where
(
np
.
isnan
(
varX_std
),
0
,
varX_std
)
probs
=
nght_model
.
predict_proba
(
varX_std
)[:,
1
]
fd_probs
[
nght_idxs
]
=
probs
[
nght_idxs
]
fd_probs
[
np
.
invert
(
day_idxs
)]
=
probs
[
np
.
invert
(
day_idxs
)]
fd_probs
[
clr_idxs
]
=
0.0
max_prob
=
fd_probs
.
reshape
((
num_lines
,
num_elems
))
...
...
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