From 78aa573f6f8259884b44816f6e6b7ff374ccc83f Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 27 Mar 2023 15:36:57 -0500 Subject: [PATCH] snapshot... --- modules/deeplearning/cloud_fraction_fcn.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/deeplearning/cloud_fraction_fcn.py b/modules/deeplearning/cloud_fraction_fcn.py index 0d02b3e5..24ca2677 100644 --- a/modules/deeplearning/cloud_fraction_fcn.py +++ b/modules/deeplearning/cloud_fraction_fcn.py @@ -8,6 +8,7 @@ import os, datetime import numpy as np import pickle import h5py +import gc LOG_DEVICE_PLACEMENT = False @@ -768,6 +769,7 @@ def run_evaluate_static(in_file, out_file, ckpt_dir): h5f = h5py.File(in_file, 'r') bt = get_grid_values_all(h5f, 'orig/temp_11_0um') + y_len, x_len = bt.shape[0], bt.shape[1] lons = get_grid_values_all(h5f, 'longitude') lats = get_grid_values_all(h5f, 'latitude') bt = np.where(np.isnan(bt), 0, bt) @@ -795,11 +797,17 @@ def run_evaluate_static(in_file, out_file, ckpt_dir): nn = SRCNN() probs = nn.run_evaluate(data, ckpt_dir) cld_frac = probs.argmax(axis=3) + cld_frac = cld_frac.astype(np.int8) + cld_frac_out = np.zeros((y_len, x_len), dtype=np.int8) + cld_frac_out[1:y_len - 1, 1:x_len - 1] = cld_frac[0, :, :] + + bt = denormalize(bt, 'temp_11_0um_nom', mean_std_dct) + refl_avg = denormalize(refl_avg, 'refl_0_65um_nom', mean_std_dct) if out_file is not None: - np.save(out_file, (cld_frac[0, :, :], denormalize(bt, 'temp_11_0um_nom', mean_std_dct), denormalize(refl_avg, 'refl_0_65um_nom', mean_std_dct), cp)) + np.save(out_file, (cld_frac_out, bt, refl_avg, cp)) else: - return cld_frac[0, :, :], denormalize(bt, 'temp_11_0um_nom', mean_std_dct), denormalize(refl_avg, 'refl_0_65um_nom', mean_std_dct), cp + return cld_frac_out, bt, refl_avg, cp def analyze2(nda_m, nda_i): -- GitLab