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
fe8da3e1
Commit
fe8da3e1
authored
1 year ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
dd7aa101
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
+33
-2
33 additions, 2 deletions
modules/icing/util.py
with
33 additions
and
2 deletions
modules/icing/util.py
+
33
−
2
View file @
fe8da3e1
import
numpy
as
np
import
deeplearning.icing_fcn
as
icing_fcn
import
deeplearning.icing_cnn
as
icing_cnn
from
deeplearning.icing_fcn
import
IcingIntensityFCN
from
icing.pirep_goes
import
setup
,
time_filter_3
from
icing.moon_phase
import
moon_phase
from
util.util
import
get_time_tuple_utc
,
is_day
,
check_oblique
,
get_median
,
homedir
,
write_icing_file_nc4
,
\
...
...
@@ -12,6 +13,8 @@ from util.setup import model_path_day, model_path_night
from
aeolus.datasource
import
CLAVRx
,
CLAVRx_VIIRS
,
CLAVRx_H08
,
CLAVRx_H09
import
h5py
import
datetime
import
tensorflow
as
tf
import
os
# from scipy.signal import medfilt2d
...
...
@@ -353,6 +356,34 @@ def run_icing_predict_image(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output
elif
model_type
==
'
FCN
'
:
model_module
=
icing_fcn
if
day_model_path
is
not
None
:
ckpt_dir_s
=
os
.
listdir
(
day_model_path
)
ckpt_dir
=
day_model_path
+
ckpt_dir_s
[
0
]
day_model
=
IcingIntensityFCN
(
day_night
=
day_night
,
l1b_or_l2
=
l1b_andor_l2
,
satellite
=
satellite
,
use_flight_altitude
=
use_flight_altitude
)
day_model
.
num_data_samples
=
10000
day_model
.
build_model
()
day_model
.
build_training
()
day_model
.
build_evaluation
()
ckpt
=
tf
.
train
.
Checkpoint
(
step
=
tf
.
Variable
(
1
),
model
=
day_model
.
model
)
ckpt_manager
=
tf
.
train
.
CheckpointManager
(
ckpt
,
ckpt_dir
,
max_to_keep
=
3
)
ckpt
.
restore
(
ckpt_manager
.
latest_checkpoint
)
if
night_model_path
is
not
None
:
ckpt_dir_s
=
os
.
listdir
(
night_model_path
)
ckpt_dir
=
night_model_path
+
ckpt_dir_s
[
0
]
night_model
=
IcingIntensityFCN
(
day_night
=
day_night
,
l1b_or_l2
=
l1b_andor_l2
,
satellite
=
satellite
,
use_flight_altitude
=
use_flight_altitude
)
night_model
.
num_data_samples
=
10000
night_model
.
build_model
()
night_model
.
build_training
()
night_model
.
build_evaluation
()
ckpt
=
tf
.
train
.
Checkpoint
(
step
=
tf
.
Variable
(
1
),
model
=
night_model
.
model
)
ckpt_manager
=
tf
.
train
.
CheckpointManager
(
ckpt
,
ckpt_dir
,
max_to_keep
=
3
)
ckpt
.
restore
(
ckpt_manager
.
latest_checkpoint
)
alt_lo
,
alt_hi
=
0.0
,
15000.0
if
use_flight_altitude
is
True
:
flight_levels
=
flight_levels
...
...
@@ -440,7 +471,7 @@ def run_icing_predict_image(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output
for
ds_name
in
day_train_params
:
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
_2
(
day_model
,
day_grd_dct
,
num_day_tiles
,
day_night
=
'
DAY
'
,
l1b_or_l2
=
l1b_andor_l2
,
prob_thresh
=
prob_thresh
,
use_flight_altitude
=
use_flight_altitude
,
...
...
@@ -465,7 +496,7 @@ def run_icing_predict_image(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output
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
,
night_model_path
,
preds_nght_dct
,
probs_nght_dct
=
model_module
.
run_evaluate_static
_2
(
night_model
,
nght_grd_dct
,
num_nght_tiles
,
day_night
=
'
NIGHT
'
,
l1b_or_l2
=
l1b_andor_l2
,
prob_thresh
=
prob_thresh
,
use_flight_altitude
=
use_flight_altitude
,
...
...
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