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

snapshot...

parent 9bb783b0
Branches
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ import os, datetime ...@@ -7,6 +7,7 @@ import os, datetime
import numpy as np import numpy as np
import pickle import pickle
import h5py import h5py
from scipy.ndimage import gaussian_filter
# L1B M/I-bands: /apollo/cloud/scratch/cwhite/VIIRS_HRES/2019/2019_01_01/ # L1B M/I-bands: /apollo/cloud/scratch/cwhite/VIIRS_HRES/2019/2019_01_01/
# CLAVRx: /apollo/cloud/scratch/Satellite_Output/VIIRS_HRES/2019/2019_01_01/ # CLAVRx: /apollo/cloud/scratch/Satellite_Output/VIIRS_HRES/2019/2019_01_01/
...@@ -754,6 +755,7 @@ def run_evaluate_static(in_file, out_file, ckpt_dir): ...@@ -754,6 +755,7 @@ def run_evaluate_static(in_file, out_file, ckpt_dir):
# grd_b = normalize(grd_b, 'refl_0_65um_nom', mean_std_dct) # grd_b = normalize(grd_b, 'refl_0_65um_nom', mean_std_dct)
grd_c = get_grid_values_all(h5f, label_param) grd_c = get_grid_values_all(h5f, label_param)
# grd_c = gaussian_filter(grd_c, sigma=1.0)
grd_c = grd_c[y_0:y_0+sub_y, x_0:x_0+sub_x] grd_c = grd_c[y_0:y_0+sub_y, x_0:x_0+sub_x]
hr_grd_c = grd_c.copy() hr_grd_c = grd_c.copy()
hr_grd_c = hr_grd_c[y_128, x_128] hr_grd_c = hr_grd_c[y_128, x_128]
...@@ -777,39 +779,6 @@ def run_evaluate_static(in_file, out_file, ckpt_dir): ...@@ -777,39 +779,6 @@ def run_evaluate_static(in_file, out_file, ckpt_dir):
return out_sr, None, None return out_sr, None, None
def analyze(fpath='/Users/tomrink/clavrx_snpp_viirs.A2019080.0100.001.2019080064252.uwssec_B00038315.level2.h5', param='cloud_probability'):
h5f = h5py.File(fpath, 'r')
grd = get_grid_values_all(h5f, param)
grd = np.where(np.isnan(grd), 0, grd)
bt = get_grid_values_all(h5f, 'temp_11_0um_nom')
refl = get_grid_values_all(h5f, 'refl_0_65um_nom')
grd = grd[2432:4032, 2432:4032]
bt = bt[2432:4032, 2432:4032]
refl = refl[2432:4032, 2432:4032]
print(grd.shape)
grd_lr = grd[::2, ::2]
print(grd_lr.shape)
leny, lenx = grd_lr.shape
rnd = np.random.normal(loc=0, scale=0.001, size=grd_lr.size)
grd_lr = grd_lr + rnd.reshape(grd_lr.shape)
if param == 'cloud_probability':
grd_lr = np.where(grd_lr < 0, 0, grd_lr)
grd_lr = np.where(grd_lr > 1, 1, grd_lr)
x = np.arange(lenx)
y = np.arange(leny)
x_up = np.arange(0, lenx, 0.5)
y_up = np.arange(0, leny, 0.5)
grd_hr = resample_2d_linear_one(x, y, grd_lr, x_up, y_up)
print(grd_hr.shape)
h5f.close()
return grd, grd_lr, grd_hr, bt, refl
if __name__ == "__main__": if __name__ == "__main__":
nn = SRCNN() nn = SRCNN()
nn.run('matchup_filename') nn.run('matchup_filename')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment