diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index 0f7ffa2f3789f99392a6ac0963e97e3fa669f8b1..037f88f862264874608c4094c7c8834388e3c31b 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -1,8 +1,8 @@ -from deeplearning.icing_fcn import run_evaluate_static_fcn +import deeplearning.icing_fcn as icing_fcn +import deeplearning.icing_cnn as icing_cnn from icing.pireps import pirep_icing import numpy as np import pickle -import matplotlib.pyplot as plt import os from util.util import get_time_tuple_utc, GenericException, add_time_range_to_filename, is_night, is_day, \ check_oblique, get_timestamp, homedir, write_icing_file_nc4, make_for_full_domain_predict, \ @@ -17,7 +17,6 @@ import datetime from datetime import timezone import glob from skyfield import api, almanac -from deeplearning.icing_cnn import run_evaluate_static_avg, run_evaluate_static goes_date_format = '%Y%j%H' goes16_directory = '/arcdata/goes/grb/goes16' # /year/date/abi/L1b/RadC @@ -2215,10 +2214,10 @@ def run_make_images(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ckpt_dir_s_pat keep_lons = None keep_lats = None - ice_lons, ice_lats, preds_2d = run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path=ckpt_dir_s_path, - flight_level=flight_level, prob_thresh=prob_thresh, - satellite=satellite, domain=domain, - use_flight_altitude=use_flight_altitude) + ice_lons, ice_lats, preds_2d = icing_cnn.run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path=ckpt_dir_s_path, + flight_level=flight_level, prob_thresh=prob_thresh, + satellite=satellite, domain=domain, + use_flight_altitude=use_flight_altitude) make_icing_image(h5f, None, ice_lons, ice_lats, clvrx_str_time, satellite, domain, ice_lons_vld=keep_lons, ice_lats_vld=keep_lats, extent=extent) @@ -2317,10 +2316,10 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h 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 = run_evaluate_static(day_grd_dct, num_day_tiles, day_model_path, - day_night='DAY', l1b_or_l2=l1b_andor_l2, prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_day_dct, probs_day_dct = icing_cnn.run_evaluate_static(day_grd_dct, num_day_tiles, day_model_path, + day_night='DAY', l1b_or_l2=l1b_andor_l2, prob_thresh=prob_thresh, + use_flight_altitude=use_flight_altitude, + flight_levels=flight_levels) day_idxs = np.array(day_idxs) for flvl in flight_levels: day_preds = preds_day_dct[flvl] @@ -2340,10 +2339,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 = run_evaluate_static(nght_grd_dct, num_nght_tiles, night_model_path, - day_night='NIGHT', l1b_or_l2=l1b_andor_l2, prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_nght_dct, probs_nght_dct = icing_cnn.run_evaluate_static(nght_grd_dct, num_nght_tiles, night_model_path, + day_night='NIGHT', 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] @@ -2425,11 +2424,11 @@ def run_icing_predict_fcn(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_d if (day_night == 'AUTO' or day_night == 'DAY') and num_day_tiles > 0: - preds_day_dct, probs_day_dct = run_evaluate_static_fcn(data_dct, 1, day_model_path, - day_night='DAY', l1b_or_l2=l1b_andor_l2, - prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_day_dct, probs_day_dct = icing_fcn.run_evaluate_static(data_dct, 1, day_model_path, + day_night='DAY', 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: preds = preds_day_dct[flvl] probs = probs_day_dct[flvl] @@ -2439,11 +2438,11 @@ def run_icing_predict_fcn(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_d fd_probs[day_idxs] = probs[day_idxs] if (day_night == 'AUTO' or day_night == 'NIGHT') and num_nght_tiles > 0: - preds_nght_dct, probs_nght_dct = run_evaluate_static_fcn(data_dct, 1, night_model_path, - day_night='NIGHT', l1b_or_l2=l1b_andor_l2, - prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_nght_dct, probs_nght_dct = icing_fcn.run_evaluate_static_fcn(data_dct, 1, night_model_path, + day_night='NIGHT', 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: preds = preds_nght_dct[flvl] probs = probs_nght_dct[flvl] @@ -2558,10 +2557,10 @@ 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 = run_evaluate_static(day_grd_dct, num_day_tiles, day_model_path, - day_night='DAY', l1b_or_l2=l1b_andor_l2, prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_day_dct, probs_day_dct = icing_cnn.run_evaluate_static(day_grd_dct, num_day_tiles, day_model_path, + day_night='DAY', l1b_or_l2=l1b_andor_l2, prob_thresh=prob_thresh, + use_flight_altitude=use_flight_altitude, + flight_levels=flight_levels) day_idxs = np.array(day_idxs) for flvl in flight_levels: day_preds = preds_day_dct[flvl] @@ -2581,10 +2580,10 @@ 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 = run_evaluate_static(nght_grd_dct, num_nght_tiles, night_model_path, - day_night='NIGHT', l1b_or_l2=l1b_andor_l2, prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_nght_dct, probs_nght_dct = icing_cnn.run_evaluate_static(nght_grd_dct, num_nght_tiles, night_model_path, + day_night='NIGHT', 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] @@ -2718,11 +2717,11 @@ def run_icing_predict_image_fcn(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou if (day_night == 'AUTO' or day_night == 'DAY') and num_day_tiles > 0: - preds_day_dct, probs_day_dct = run_evaluate_static_fcn(data_dct, day_model_path, - day_night='DAY', l1b_or_l2=l1b_andor_l2, - prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_day_dct, probs_day_dct = icing_fcn.run_evaluate_static(data_dct, day_model_path, + day_night='DAY', 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: preds = preds_day_dct[flvl] probs = probs_day_dct[flvl] @@ -2732,11 +2731,11 @@ def run_icing_predict_image_fcn(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ou fd_probs[day_idxs] = probs[day_idxs] if (day_night == 'AUTO' or day_night == 'NIGHT') and num_nght_tiles > 0: - preds_nght_dct, probs_nght_dct = run_evaluate_static_fcn(data_dct, night_model_path, - day_night='NIGHT', l1b_or_l2=l1b_andor_l2, - prob_thresh=prob_thresh, - use_flight_altitude=use_flight_altitude, - flight_levels=flight_levels) + preds_nght_dct, probs_nght_dct = icing_fcn.run_evaluate_static_fcn(data_dct, night_model_path, + day_night='NIGHT', 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: preds = preds_nght_dct[flvl] probs = probs_nght_dct[flvl]