diff --git a/modules/deeplearning/srcnn_cld_frac.py b/modules/deeplearning/srcnn_cld_frac.py index d57a17200dafca1e0b83e97e865650b1d5d0f92a..44291292958d02b695b4155a55b01ad1d0f2d399 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)