def func_solv(albedo): return toa_cor_o3 - sl.alb2rtoa(albedo, t1, t2, r0, ak1, ak2, ratm, r)
def func_solv(albedo): return toa_cor_o3 - sl.alb2rtoa(albedo, tau, g, p, amf, am1, am2, r0, ak1, ak2)
area[D < D_thresh] = np.nan al[D < D_thresh] = np.nan r0[D < D_thresh] = np.nan bal[D < D_thresh] = np.nan cos_sza[D < D_thresh] = np.nan cos_vza[D < D_thresh] = np.nan #D[D<D_thresh] = np.nan # =========== clean snow ==================================== # for that we calculate the theoretical reflectance at band 1 of a surface with: # r0 = 1, a (albedo) = 1, ak1 = 1, ak2 = 1 # t1 and t2 are the backscattering fraction t1, t2, ratm, r, astra, rms = sl.prepare_coef(tau, g, p, cos_sza, cos_vza, inv_cos_za, gaer, taumol, tauaer) rs_1 = sl.alb2rtoa(1, t1[0, :, :], t2[0, :, :], np.ones_like(r0), np.ones_like(ak1), np.ones_like(ak2), ratm[0, :, :], r[0, :, :]) # we then compare it to the observed toa[0] value ind_clean = toa_cor_o3[0, :, :] >= rs_1 isnow[ind_clean] = 0 # STEP 4a: clean snow retrieval # the spherical albedo derivation: alb_sph def mult_channel(c, A): tmp = A.T * c return tmp.T alb_sph = np.exp(-np.sqrt(1000. * 4. * np.pi *
isnow[D < D_thresh] = 104 for i in range(21): toa_cor_o3[i, D < D_thresh] = np.nan area[D < D_thresh] = np.nan al[D < D_thresh] = np.nan r0[D < D_thresh] = np.nan bal[D < D_thresh] = np.nan am1[D < D_thresh] = np.nan am2[D < D_thresh] = np.nan D[D < D_thresh] = np.nan # =========== clean snow ==================================== # for that we calculate the theoretical reflectance at band 1 of a surface with: # r0 = 1, a (albedo) = 1, ak1 = 1, ak2 = 1 rs_1 = sl.alb2rtoa(1, tau[0, :, :], g[0, :, :], p[0, :, :], amf, am1, am2, 1, 1, 1) # we then compare it to the observed toa[0] value ind_clean = toa_cor_o3[0, :, :] >= rs_1 isnow[ind_clean] = 0 # STEP 4a: clean snow retrieval alpha = 4. * np.pi * bai / w absor = g * np.nan # the spherical albedo derivation: alb_sph al_clean = al al_clean[isnow != 0] = np.nan for i_channel in range(21): absor[i_channel, :, :] = 1000. * alpha[i_channel] * al_clean alb_sph[i_channel, :, :] = np.exp(-np.sqrt(absor[i_channel, :, :]))