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

snapshot...

parent f1604b13
Branches
No related tags found
No related merge requests found
...@@ -865,6 +865,44 @@ def run_evaluate_static_full_disk(in_file, out_file, ckpt_dir): ...@@ -865,6 +865,44 @@ def run_evaluate_static_full_disk(in_file, out_file, ckpt_dir):
return [cld_frac_out, bt, refl, cp, lons, lats] return [cld_frac_out, bt, refl, cp, lons, lats]
def run_evaluate_static_valid(in_file, out_file, ckpt_dir):
gc.collect()
h5f = h5py.File(in_file, 'r')
bt = get_grid_values_all(h5f, 'orig/temp_ch38')
y_len, x_len = bt.shape
refl = get_grid_values_all(h5f, 'orig/refl_ch01')
refl_lo = get_grid_values_all(h5f, 'orig/refl_submin_ch01')
refl_hi = get_grid_values_all(h5f, 'orig/refl_submax_ch01')
refl_std = get_grid_values_all(h5f, 'orig/refl_substddev_ch01')
cp = get_grid_values_all(h5f, 'orig/'+label_param)
lons = get_grid_values_all(h5f, 'orig/longitude')
lats = get_grid_values_all(h5f, 'orig/latitude')
h5f.close()
cld_frac = run_evaluate_static_(bt, refl, refl_lo, refl_hi, refl_std, cp, ckpt_dir)
cld_frac_out = np.zeros((y_len, x_len), dtype=np.int8)
border = int((KERNEL_SIZE - 1)/2)
cld_frac_out[border:y_len-border, border:x_len - border] = cld_frac[0, :, :]
var_names = ['cloud_fraction', 'temp_11_0um', 'refl_0_65um']
dims = ['num_params', 'y', 'x']
da = xr.DataArray(np.stack([cld_frac_out, bt, refl], axis=0), dims=dims)
da.assign_coords({
'num_params': var_names,
'lat': (['y', 'x'], lats),
'lon': (['y', 'x'], lons)
})
if out_file is not None:
np.save(out_file, (cld_frac_out, bt, refl, cp, lons, lats))
else:
return [cld_frac_out, bt, refl, cp, lons, lats]
def run_evaluate_static_(bt, refl, refl_lo, refl_hi, refl_std, cp, ckpt_dir): def run_evaluate_static_(bt, refl, refl_lo, refl_hi, refl_std, cp, ckpt_dir):
bt = normalize(bt, 'temp_11_0um_nom', mean_std_dct) bt = normalize(bt, 'temp_11_0um_nom', mean_std_dct)
refl = normalize(refl, 'refl_0_65um_nom', mean_std_dct) refl = normalize(refl, 'refl_0_65um_nom', mean_std_dct)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment