logging.debug('method %s qsea and qair cannot be nan | sst:%s, Ta:%s, P:%s, RH:%s',method,np.ma.median(sst),np.ma.median(Ta),np.ma.median(P),np.ma.median(RH))
# first guesses
inan=np.where(np.isnan(spd+T+SST+lat+RH+P))
t10n,q10n=np.copy(Ta),np.copy(qair)
tv10n=t10n*(1+0.61*q10n)
rho=(0.34838*P)/(tv10n)
rhoa=P*100/(287.1*(T+CtoK)*(1+0.61*qair))# difference with rho is that it uses T instead of Ta (which includes lapse rate)
lv=(2.501-0.00237*(SST))*1e6
dt=sst-Ta
dq=qsea-qair
if(method=="COARE3.5"):
cp=1004.67#cpa = 1004.67, cpv = cpa*(1+0.84*Q)
wetc=0.622*lv*qsea/(287.1*sst**2)
ug=0.5*np.ones(np.shape(spd))
wind=np.sqrt(np.copy(spd)**2+ug**2)
dter=0.3*np.ones(np.shape(spd))#cool skin temperature depression
cdn=(0.5+0.091*u10n)*0.001#Smith et al. 1991 #(0.27 + 0.116*u10n)*0.001 Smith et al. 1992
elif(method=="HEXOSwave"):
cdn=cdn_from_roughness(u10n,Ta,Tp,method)
elif(method=="YT96"):
cdn=np.where((u10n<6)&(u10n>=3),(0.29+3.1/u10n+7.7/u10n**2)*0.001,np.where((u10n<=26)&(u10n>=6),(0.60+0.070*u10n)*0.001,(0.61+0.567/u10n)*0.001))# for u<3 same as Smith80