def Wavebreaking_modulation(kr, K, theta, azimuth, u_10, fetch, wind_dir, tsc, polarization): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ if polarization == 'VH': print('no modulation cross-pol') return nphi = theta.shape[0] ind = np.where(np.degrees(azimuth) == wind_dir)[0] # divergence of the sea surface current divergence = np.gradient(tsc[:, :, 0], 1e3, axis=1) + np.gradient( tsc[:, :, 1], 1e3, axis=0) # NRCS of plumes wb0 = np.exp(-np.tan(theta)**2 / const.Swb) / ( np.cos(theta)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta[1] - theta[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function # in radians azimuth of breaking surface area: -pi/2,pi/2 # phi1 = np.linspace(-np.pi/2, np.pi/2, nphi) phi1 = np.linspace(-np.pi, np.pi, nphi) nk = 1024 q = np.zeros([tsc.shape[0], tsc.shape[1]]) WB = np.zeros([tsc.shape[0], tsc.shape[1]]) for ii in np.arange(tsc.shape[0]): for jj in np.arange(tsc.shape[1]): KK = np.linspace(10 * spec_peak(u_10[ii, jj], fetch), knb, nk) T = Trans_func(KK, K[ii, jj], u_10[ii, jj], fetch, azimuth, divergence[ii, jj]) Bkdir = kudryavtsev05(KK.reshape(nk, 1), u_10[ii, jj], fetch, phi1) * (1 + abs(T.reshape(nk, 1))) n, alpha = param(KK, u_10[ii, jj], fetch) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * KK.reshape(nk, 1) ) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, KK, axis=0) lamda_k = np.trapz(lamda_k, KK) q[ii, jj] = const.cq * lamda_k Awb = np.trapz(np.cos(phi1 - azimuth[ind]) * lamda, phi1) / lamda_k WB[ii, jj] = wb0[jj] * (1 + Mwb[jj] * const.theta_wb * Awb) return WB, q
def eq_wb(kr, theta_eq, eq_azi, u_10, fetch, spec_name, polarization): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ nphi = theta_eq.shape[0] # Spectral model # Omni directional spectrum model name specf = spec.models[spec_name] # NRCS of plumes wb0 = np.exp(-np.tan(theta_eq)**2 / const.Swb) / ( np.cos(theta_eq)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta_eq[1] - theta_eq[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function # in radians azimuth of breaking surface area: -pi/2,pi/2 # phi1 = np.linspace(-np.pi / 2, np.pi / 2, nphi) phi1 = np.linspace(-np.pi, np.pi, nphi) nk = 1024 K = np.linspace(10 * spec_peak(u_10, fetch), knb, nk) # K = np.linspace(spec_peak(u_10, fetch), knb, nk) if spec_name == 'elfouhaily': # Directional spectrum model name spreadf = spread.models[spec_name] Bkdir = specf(K.reshape(nk, 1), u_10, fetch) * spreadf( K.reshape(nk, 1), phi1, u_10, fetch) * K.reshape(nk, 1)**3 else: Bkdir = specf(K.reshape(nk, 1), u_10, fetch, phi1) n, alpha = param(K, u_10, fetch) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * K.reshape(nk, 1)) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, K, axis=0) lamda_k = np.trapz(lamda_k, K) q = const.cq * lamda_k if polarization == 'VH': WB = CP_breaking(theta_eq)[:, 0] else: Awb = np.trapz(np.cos(phi1 - eq_azi.reshape(nphi, 1)) * lamda, phi1, axis=1) / lamda_k WB = wb0 * (1 + Mwb * const.theta_wb * Awb) return WB, q
def eq_wb_mo(kr, K, theta_eq, eq_azi, u_10, fetch, div): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ # NRCS of plumes wb0 = np.exp(-np.tan(theta_eq)**2 / const.Swb) / ( np.cos(theta_eq)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta_eq[1] - theta_eq[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function phi1 = np.linspace(-np.pi, np.pi, 37) nk = 1024 q = np.zeros([div.shape[0], div.shape[1]]) WB = np.zeros([div.shape[0], div.shape[1]]) for ii in np.arange(div.shape[0]): for jj in np.arange(div.shape[1]): KK = np.linspace(10 * spec_peak(u_10[ii, jj], fetch), knb, nk) T = Trans_func(KK, K[ii, jj], u_10[ii, jj], fetch, phi1, div[ii, jj]) Bkdir = kudryavtsev05(KK.reshape(nk, 1), u_10[ii, jj], fetch, phi1) * (1 + abs(T.reshape(nk, 1))) n, alpha = param(KK, u_10[ii, jj], fetch) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * KK.reshape(nk, 1) ) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, KK, axis=0) lamda_k = np.trapz(lamda_k, KK) q[ii, jj] = const.cq * lamda_k Awb = np.trapz(np.cos(phi1 - eq_azi[jj]) * lamda, phi1) / lamda_k WB[ii, jj] = wb0[jj] * (1 + Mwb[jj] * const.theta_wb * Awb) return WB, q
def mono(u_10, pol): """ :param kr: Radar wave number :param theta: Normal incidence angle vector :param azimuth: radar look angle relative to wind direction vector :param pol: Polarization ('vv', 'hh') :param u_10: Wind speed (U_10) :param fetch: Wind fetch :param spec_name: spectrum function """ kr = 2 * np.pi / 5.6e-2 spec_name = 'kudryavtsev05' fetch = 500e+3 k_min = spec_peak(u_10, fetch) nk = 1024 k = np.linspace(10 * k_min, const.ky, nk) nphi = 28 theta = np.radians(np.linspace(20, 47, nphi)) # 28 nazi = 37 azimuth = np.radians(np.linspace(-180, 180, nazi)) # 37 wb, q = Wave_breaking(kr, theta, azimuth, u_10, fetch, spec_name, pol) br = Bragg_scattering(k, kr, theta, azimuth, u_10, fetch, spec_name, pol) nrcs = br * (1 - q) + wb * q return nrcs # u_10 = np.linspace(3, 15, 13) # pol=['VV','HH', 'VH'] # nphi = 28 # theta = np.radians(np.linspace(20, 47, nphi)) # 28 # nazi = 37 # azimuth = np.radians(np.linspace(-180, 180, nazi)) # 37 # nrcsmn = np.zeros([nazi, nphi, u_10.shape[0], len(pol)]) # for mm in np.arange(len(pol)): # for nn in np.arange(u_10.shape[0]): # nrcsmn[:, :, nn, mm] = mono(u_10[nn], pol[mm]) # # MN = xr.DataArray(nrcsmn, coords=[azimuth, theta, u_10, pol], dims=['azi','theta','u_10','pol']) # path = 'd:/TU Delft/Msc Thesis/LUT/mono.nc' # MN.to_netcdf(path) # obj = xr.open_dataarray(path)
def bi(kr, theta_i, theta_s, theta_eq, bist_ang_az, fetch, spec_name, u_10, azi, inc_polar, re_polar, sat): """ :param kr: Radar wave number :param theta: Normal incidence angle vector :param azimuth: radar look angle relative to wind direction vector :param u_10: Wind speed (U_10) """ k_min = spec_peak(u_10, fetch) nk = 1024 k = np.linspace(10 * k_min, const.ky, nk) # azimuth angle with respect to the wind direction if sat == 'A': azimuth = azi - bist_ang_az / 2 else: azimuth = azi + bist_ang_az / 2 pol = 'VV' if inc_polar == 'V': pol = 'VV' else: pol = 'HH' if re_polar == 'Bragg': wb, q = Wb_bi(kr, theta_i, theta_s, theta_eq, bist_ang_az, azimuth, u_10, fetch, spec_name, pol, inc_polar, re_polar, sat) br = Br_bi(k, kr, theta_i, theta_s, theta_eq, bist_ang_az, azimuth, u_10, fetch, spec_name, pol, inc_polar, sat) return br * (1 - q) + wb * q else: wb, q = Wb_bi(kr, theta_i, theta_s, theta_eq, bist_ang_az, azimuth, u_10, fetch, spec_name, pol, inc_polar, re_polar, sat) wb_vh, q_vh = Wb_bi(kr, theta_i, theta_s, theta_eq, bist_ang_az, azimuth, u_10, fetch, spec_name, 'VH', inc_polar, re_polar, sat) br = Br_bi(k, kr, theta_i, theta_s, theta_eq, bist_ang_az, azimuth, u_10, fetch, spec_name, 'VH', inc_polar, sat) return br * (1 - q_vh) + wb * q + wb_vh * q_vh
def Wave_breaking_new(K, kr, theta, azimuth, u_10, fetch, spec_name, tsc): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ nphi = theta.shape[0] divergence = np.gradient(tsc[:, :, 0], 1e3, axis=1) + np.gradient( tsc[:, :, 1], 1e3, axis=0) # Spectral model # Omni directional spectrum model name specf = spec.models[spec_name] # NRCS of plumes wb0 = np.exp(-np.tan(theta)**2 / const.Swb) / ( np.cos(theta)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta[1] - theta[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function phi1 = (np.arange(nphi) * np.pi / nphi).reshape( 1, nphi ) - np.pi / 2 # in radians azimuth of breaking surface area: -pi/2,pi/2 nk = 1024 nazi = azimuth.shape[0] q = np.zeros([u_10.shape[0], u_10.shape[1]]) WB = np.zeros([u_10.shape[0], u_10.shape[1], nazi, nphi]) for ii in np.arange(u_10.shape[0]): for jj in np.arange(u_10.shape[1]): KK = np.linspace(10 * spec_peak(u_10[ii, jj], fetch), knb, nk) T = Trans_single(KK.reshape(nk, 1), K[ii, jj], u_10[ii, jj], fetch, azimuth, spec_name, divergence[ii, jj]) if spec_name == 'elfouhaily': spreadf = spread.models[spec_name] Bkdir = specf(KK.reshape(nk, 1), u_10[ii, jj], fetch) * (1 + np.abs(T)) * spreadf( KK.reshape(nk, 1), phi1, u_10[ii, jj], fetch) * KK.reshape(nk, 1)**3 else: Bkdir = specf(KK.reshape(nk, 1), u_10[ii, jj], fetch, phi1) * (1 + np.abs(T)) n, alpha = param(KK, u_10[ii, jj]) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * KK.reshape(nk, 1) ) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, KK, axis=0) lamda_k = np.trapz(lamda_k, KK) q[ii, jj] = const.cq * lamda_k Awb = np.trapz(np.cos(phi1 - azimuth.reshape(nazi, 1)) * lamda, phi1, axis=1) / lamda_k Awb = Awb.reshape(nazi, 1) WB[ii, jj, :, :] = wb0.reshape( 1, nphi) * (1 + Mwb.reshape(1, nphi) * const.theta_wb * Awb) return WB, q
def MSS(kbr, u_10, fetch): # Kudryavtsev, 2019a alpha = u_10 * np.sqrt(spec_peak(u_10, fetch) / const.g) kd = kbr / 4 return 4.5 * 10**(-3) * np.log(alpha**(-2) * kd * u_10**2 / const.g) / 2