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

snapshot...

parent 6b5275d6
No related branches found
No related tags found
No related merge requests found
...@@ -776,6 +776,44 @@ def run_evaluate_static(in_file, out_file, ckpt_dir): ...@@ -776,6 +776,44 @@ def run_evaluate_static(in_file, out_file, ckpt_dir):
h5f = h5py.File(in_file, 'r') h5f = h5py.File(in_file, 'r')
bt = get_grid_values_all(h5f, 'temp_11_0um_nom')
y_len, x_len = bt.shape
refl = get_grid_values_all(h5f, 'refl_0_65um_nom')
refl_lo = get_grid_values_all(h5f, 'refl_0_65um_nom_min_sub')
refl_hi = get_grid_values_all(h5f, 'refl_0_65um_nom_max_sub')
refl_std = get_grid_values_all(h5f, 'refl_0_65um_nom_stddev_sub')
cp = get_grid_values_all(h5f, label_param)
lons = get_grid_values_all(h5f, 'longitude')
lats = get_grid_values_all(h5f, '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_full_disk(in_file, out_file, ckpt_dir):
gc.collect()
h5f = h5py.File(in_file, 'r')
bt = get_grid_values_all(h5f, 'temp_11_0um_nom') bt = get_grid_values_all(h5f, 'temp_11_0um_nom')
y_len, x_len = bt.shape y_len, x_len = bt.shape
h_y_len = int(y_len/2) h_y_len = int(y_len/2)
...@@ -812,9 +850,6 @@ def run_evaluate_static(in_file, out_file, ckpt_dir): ...@@ -812,9 +850,6 @@ def run_evaluate_static(in_file, out_file, ckpt_dir):
cld_frac_out[border:h_y_len, border:x_len - border] = cld_frac_nh[0, :, :] cld_frac_out[border:h_y_len, border:x_len - border] = cld_frac_nh[0, :, :]
cld_frac_out[h_y_len:y_len - border, border:x_len - border] = cld_frac_sh[0, :, :] cld_frac_out[h_y_len:y_len - border, border:x_len - border] = cld_frac_sh[0, :, :]
bt = denormalize(bt, 'temp_11_0um_nom', mean_std_dct)
refl = denormalize(refl, 'refl_0_65um_nom', mean_std_dct)
var_names = ['cloud_fraction', 'temp_11_0um', 'refl_0_65um'] var_names = ['cloud_fraction', 'temp_11_0um', 'refl_0_65um']
dims = ['num_params', 'y', 'x'] dims = ['num_params', 'y', 'x']
da = xr.DataArray(np.stack([cld_frac_out, bt, refl], axis=0), dims=dims) da = xr.DataArray(np.stack([cld_frac_out, bt, refl], axis=0), dims=dims)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment