Skip to content
Snippets Groups Projects
Commit 2e56935c authored by tomrink's avatar tomrink
Browse files

fix some cf issues

parent c40ec28e
Branches
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ import deeplearning.icing_fcn as icing_fcn
import deeplearning.icing_cnn as icing_cnn
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_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,\
make_for_full_domain_predict, make_for_full_domain_predict_viirs_clavrx, prepare_evaluate
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
for j in range(num_lines):
for i in range(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]):
continue
......@@ -155,8 +155,8 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
preds_2d_dct[flvl] = fd_preds
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}
for name in day_train_params:
for k in day_idxs:
......@@ -179,10 +179,9 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
fd_preds[day_idxs] = day_preds[:]
fd_probs[day_idxs] = day_probs[:]
if (day_night == 'AUTO' or day_night == 'NIGHT') and num_nght_tiles > 0:
model_path = night_model_path
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'
......@@ -196,8 +195,10 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
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,
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)
......@@ -210,6 +211,38 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
fd_preds[nght_idxs] = nght_preds[:]
fd_probs[nght_idxs] = nght_probs[:]
elif day_night == 'NIGHT':
model_path = night_model_path
all_idxs = np.arange(num_lines * num_elems)
mode = 'NIGHT'
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 all_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)
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[all_idxs] = nght_preds[:]
fd_probs[all_idxs] = nght_probs[:]
# combine day and night into full grid ------------------------------------------
for flvl in flight_levels:
fd_preds = preds_2d_dct[flvl]
fd_probs = probs_2d_dct[flvl]
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment