diff --git a/AirSeaFluxCode.py b/AirSeaFluxCode.py index 835127c84989066af3776bcf3a679ab1ef53f0d8..377ad34fc96f3f6d6ff4ed42770c7921e64c3986 100644 --- a/AirSeaFluxCode.py +++ b/AirSeaFluxCode.py @@ -136,14 +136,15 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10, format='%(asctime)s %(message)s',level=logging.INFO) logging.captureWarnings(True) # check input values and set defaults where appropriate - lat, P, Rl, Rs, cskin, skin, wl, gust, tol, L = get_init(spd, T, SST, lat, - P, Rl, Rs, cskin, - skin, wl, gust, L, - tol, meth, qmeth) + lat, hum, P, Rl, Rs, cskin, skin, wl, gust, tol, L = get_init(spd, T, SST, + lat, hum, P, + Rl, Rs, + cskin, skin, + wl, gust, L, + tol, meth, + qmeth) flag = np.ones(spd.shape, dtype="object")*"n" - flag = np.where(np.isnan(spd+T+SST+lat+hum[1]+P+Rs) & (flag == "n"), - "m", np.where(np.isnan(spd+T+SST+lat+hum[1]+P+Rs) & - (flag != "n"), flag+[","]+["m"], flag)) + flag = np.where(np.isnan(spd+T+SST+lat+hum[1]+P+Rs), "m", flag) ref_ht = 10 # reference height h_in = get_heights(hin, len(spd)) # heights of input measurements/fields h_out = get_heights(hout, 1) # desired height of output variables diff --git a/get_init.py b/get_init.py index 47ddf53902c50ba7ffae513e565c9dde3a275ea4..8f2b49fc40de6ffc8c8ed75c418afc23a3ebcb16 100644 --- a/get_init.py +++ b/get_init.py @@ -1,7 +1,7 @@ import numpy as np import sys -def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth, +def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth, qmeth): """ Checks initial input values and sets defaults if needed @@ -17,6 +17,8 @@ def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth, sea surface temperature in K lat : float latitude (deg), default 45deg + hum : float + relative humidity, if None is set to 80% P : float air pressure (hPa), default 1013hPa Rl : float @@ -100,6 +102,11 @@ def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth, lat = 45*np.ones(spd.shape) elif ((np.all(lat != None)) and (np.size(lat) == 1)): lat = np.ones(spd.shape)*np.copy(lat) + if (hum == None): + RH = np.ones(SST.shape)*80 + hum = ['rh', RH] + else: + hum = hum if ((np.all(P == None)) or np.all(np.isnan(P))): P = np.ones(spd.shape)*1013 elif (((np.all(P != None)) or np.all(~np.isnan(P))) and np.size(P) == 1): @@ -149,4 +156,4 @@ def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth, tol = ['flux', 1e-3, 0.1, 0.1] elif (tol[0] not in ['flux', 'ref', 'all']): sys.exit("unknown tolerance input") - return lat, P, Rl, Rs, cskin, skin, wl, gust, tol, L + return lat, hum, P, Rl, Rs, cskin, skin, wl, gust, tol, L diff --git a/hum_subs.py b/hum_subs.py index 385b786ebcd4b3139bafa19044d78fb0fbfabe77..98591c1bcf83830cb504d8a6f46bc410fce0cd59 100644 --- a/hum_subs.py +++ b/hum_subs.py @@ -372,11 +372,7 @@ def get_hum(hum, T, sst, P, qmeth): specific humidity over sea surface """ - if (hum == None): - RH = np.ones(sst.shape)*80 - qsea = qsat_sea(sst, P, qmeth)/1000 # surface water q (kg/kg) - qair = qsat_air(T, P, RH, qmeth)/1000 # q of air (kg/kg) - elif (hum[0] not in ['rh', 'q', 'Td']): + if (hum[0] not in ['rh', 'q', 'Td']): sys.exit("unknown humidity input") qair, qsea = np.nan, np.nan elif (hum[0] == 'rh'):