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

nlcomp for VIIRS

parent 8f26d4f1
No related branches found
No related tags found
No related merge requests found
......@@ -659,7 +659,26 @@ def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain
return grd_dct, ll, cc
def make_for_full_domain_predict_viirs_clavrx(h5f, name_list=None, res_fac=1):
rho_water = 1.
rho_ice = 0.917
def compute_lwc_iwc(iphase, reff, opd):
lwp_dcomp = np.zeros(reff.shape[0])
iwp_dcomp = np.zeros(reff.shape[0])
lwp_dcomp[:] = np.nan
iwp_dcomp[:] = np.nan
ice = iphase == 1
no_ice = iphase != 1
iwp_dcomp[ice] = 0.667 * opd[ice] * rho_ice * reff[ice]
lwp_dcomp[no_ice] = 0.55 * opd[no_ice] * rho_water * reff[no_ice]
return lwp_dcomp, iwp_dcomp
def make_for_full_domain_predict_viirs_clavrx(h5f, name_list=None, res_fac=1, day_night='DAY', lunar=False):
w_x = 16
w_y = 16
i_0 = 0
......@@ -670,11 +689,23 @@ def make_for_full_domain_predict_viirs_clavrx(h5f, name_list=None, res_fac=1):
ylen = h5f['scan_lines_along_track_direction'].shape[0]
xlen = h5f['pixel_elements_along_scan_direction'].shape[0]
use_nl_comp = False
if day_night == 'NIGHT' and lunar:
use_nl_comp = True
grd_dct = {name: None for name in name_list}
cnt_a = 0
for ds_name in name_list:
gvals = get_grid_values(h5f, ds_name, j_0, i_0, None, num_j=ylen, num_i=xlen)
name = ds_name
if use_nl_comp:
if ds_name == 'cld_reff_dcomp':
name = 'cld_reff_nlcomp'
elif ds_name == 'cld_opd_dcomp':
name = 'cld_opd_nlcomp'
gvals = get_grid_values(h5f, name, j_0, i_0, None, num_j=ylen, num_i=xlen)
if gvals is not None:
grd_dct[ds_name] = gvals
cnt_a += 1
......@@ -682,6 +713,14 @@ def make_for_full_domain_predict_viirs_clavrx(h5f, name_list=None, res_fac=1):
if cnt_a > 0 and cnt_a != len(name_list):
raise GenericException('weirdness')
if use_nl_comp:
cld_phase = get_grid_values(h5f, 'cloud_phase', j_0, i_0, None, num_j=ylen, num_i=xlen)
reff = grd_dct['cld_reff_dcomp']
opd = grd_dct['cld_opd_dcomp']
lwc_nlcomp, iwc_nlcomp = compute_lwc_iwc(cld_phase, reff, opd)
grd_dct['iwc_dcomp'] = iwc_nlcomp
grd_dct['lwc_dcomp'] = lwc_nlcomp
grd_dct_n = {name: [] for name in name_list}
n_x = int(xlen/s_x) - 1
......
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