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

snapshot...

parent 26f3d35f
No related branches found
No related tags found
No related merge requests found
import tensorflow as tf
from util.setup import logdir, modeldir, cachepath, now, ancillary_path
from util.util import EarlyStop, normalize, make_for_full_domain_predict
from util.geos_nav import get_navigation
from util.geos_nav import get_navigation, get_lon_lat_2d_mesh
import os, datetime
import numpy as np
......@@ -1034,8 +1034,7 @@ def run_restore_static(filename_l1b, filename_l2, ckpt_dir_s_path):
return labels, prob_avg, cm_avg
def run_evaluate_static(h5f, ckpt_dir_s_path, flight_level=4, prob_thresh=0.5, satellite='GOES16', domain='FD'):
data_dct, ll, cc = make_for_full_domain_predict(h5f, name_list=train_params, domain=domain)
def run_evaluate_static(data_dct, ll, cc, ckpt_dir_s_path, flight_level=4, prob_thresh=0.5, satellite='GOES16', domain='FD'):
num_elems = len(cc)
num_lines = len(ll)
......@@ -1068,18 +1067,7 @@ def run_evaluate_static(h5f, ckpt_dir_s_path, flight_level=4, prob_thresh=0.5, s
preds = np.where(probs > prob_thresh, 1, 0)
else:
preds = np.argmax(probs, axis=1)
preds_2d = preds.reshape((len(ll), len(cc)))
cc = np.array(cc)
ll = np.array(ll)
x_rad = cc * nav.CFAC + nav.COFF
y_rad = ll * nav.LFAC + nav.LOFF
ll, cc = np.meshgrid(ll, cc, indexing='ij')
cc = cc.flatten()
ll = ll.flatten()
lon_s, lat_s = nav.lc_to_earth(cc, ll)
lons_2d = lon_s.reshape((num_lines, num_elems))
lats_2d = lat_s.reshape((num_lines, num_elems))
preds_2d = preds.reshape((num_lines, num_elems))
ice_mask = preds == 1
ice_cc = cc[ice_mask]
......@@ -1087,7 +1075,7 @@ def run_evaluate_static(h5f, ckpt_dir_s_path, flight_level=4, prob_thresh=0.5, s
ice_lons, ice_lats = nav.lc_to_earth(ice_cc, ice_ll)
return ice_lons, ice_lats, preds_2d, lons_2d, lats_2d, x_rad, y_rad
return ice_lons, ice_lats, preds_2d
def run_evaluate_static_new(data_dct, num_lines, num_elems, ckpt_dir_s_path, day_night='DAY', flight_levels=[0, 1, 2, 3, 4], prob_thresh=0.5):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment