From f4897f7e87843dd7bc511a09472815cbb125d50c Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Sun, 5 Feb 2023 15:27:30 -0600 Subject: [PATCH] snapshot... --- modules/deeplearning/srcnn_cld_frac.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/deeplearning/srcnn_cld_frac.py b/modules/deeplearning/srcnn_cld_frac.py index d57a1720..44291292 100644 --- a/modules/deeplearning/srcnn_cld_frac.py +++ b/modules/deeplearning/srcnn_cld_frac.py @@ -138,6 +138,19 @@ def upsample(tmp): return tmp +def upsample_nearest(grd): + bsize, ylen, xlen = grd.shape + grd = get_grid_cell_mean(grd) + up = np.zeros(bsize, ylen, xlen) + + up[:, ::2, ::2] = grd[:, :, :] + up[:, 1::2, ::1] = grd[:, :, :] + up[:, ::2, 1::1] = grd[:, :, :] + up[:, 1::2, 1::2] = grd[:, :, :] + + return up + + # def get_label_data(grd_k): # grd_k = np.where(np.isnan(grd_k), 0, grd_k) # grd_k = np.where(grd_k < 0.5, 0, 1) -- GitLab