Commit 0909754b authored by sbiri's avatar sbiri
Browse files

change name convention LY04 to NCAR

parent c164b7c0
This diff is collapsed.
...@@ -58,7 +58,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10, ...@@ -58,7 +58,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
default for UA, ecmwf [1, 1, 1000] default for UA, ecmwf [1, 1, 1000]
default else [1, 1.2, 800] default else [1, 1.2, 800]
meth : str meth : str
"S80", "S88", "LP82", "YT96", "UA", "LY04", "C30", "C35", "S80", "S88", "LP82", "YT96", "UA", "NCAR", "C30", "C35",
"ecmwf", "Beljaars" "ecmwf", "Beljaars"
qmeth : str qmeth : str
is the saturation evaporation method to use amongst is the saturation evaporation method to use amongst
...@@ -80,7 +80,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10, ...@@ -80,7 +80,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
set 1 to keep points set 1 to keep points
L : str L : str
Monin-Obukhov length definition options Monin-Obukhov length definition options
"tsrv" : default for "S80", "S88", "LP82", "YT96", "UA", "LY04", "tsrv" : default for "S80", "S88", "LP82", "YT96", "UA", "NCAR",
"C30", "C35" "C30", "C35"
"Rb" : following ecmwf (IFS Documentation cy46r1), default for "Rb" : following ecmwf (IFS Documentation cy46r1), default for
"ecmwf", "Beljaars" "ecmwf", "Beljaars"
...@@ -155,10 +155,10 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10, ...@@ -155,10 +155,10 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
h_in = get_heights(hin, len(spd)) # heights of input measurements/fields h_in = get_heights(hin, len(spd)) # heights of input measurements/fields
h_out = get_heights(hout, 1) # desired height of output variables h_out = get_heights(hout, 1) # desired height of output variables
logging.info('method %s, inputs: lat: %s | P: %s | Rl: %s |' logging.info('method %s, inputs: lat: %s | P: %s | Rl: %s |'
' Rs: %s | gust: %s | cskin: %s | L : %s', meth, ' Rs: %s | gust: %s | cskin: %s | L : %s', meth,
np.nanmedian(lat), np.round(np.nanmedian(P), 2), np.nanmedian(lat), np.round(np.nanmedian(P), 2),
np.round(np.nanmedian(Rl),2 ), np.round(np.nanmedian(Rs), 2), np.round(np.nanmedian(Rl),2 ), np.round(np.nanmedian(Rs), 2),
gust, cskin, L) gust, cskin, L)
# set up/calculate temperatures and specific humidities # set up/calculate temperatures and specific humidities
th = np.where(T < 200, (np.copy(T)+CtoK) * th = np.where(T < 200, (np.copy(T)+CtoK) *
np.power(1000/P,287.1/1004.67), np.power(1000/P,287.1/1004.67),
...@@ -291,7 +291,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10, ...@@ -291,7 +291,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
ct[ind], cq[ind] = ctcq_calc(cd10n[ind], cd[ind], ct10n[ind], cq10n[ind], ct[ind], cq[ind] = ctcq_calc(cd10n[ind], cd[ind], ct10n[ind], cq10n[ind],
h_in[:, ind], [ref_ht, ref_ht, ref_ht], h_in[:, ind], [ref_ht, ref_ht, ref_ht],
psit[ind], psiq[ind]) psit[ind], psiq[ind])
if (meth == "LY04"): if (meth == "NCAR"):
cd = np.maximum(np.copy(cd), 1e-4) cd = np.maximum(np.copy(cd), 1e-4)
ct = np.maximum(np.copy(ct), 1e-4) ct = np.maximum(np.copy(ct), 1e-4)
cq = np.maximum(np.copy(cq), 1e-4) cq = np.maximum(np.copy(cq), 1e-4)
...@@ -525,7 +525,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10, ...@@ -525,7 +525,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
(np.char.find(flag.astype(str), 'u') == -1) & (np.char.find(flag.astype(str), 'u') == -1) &
(np.char.find(flag.astype(str), 'q') == -1)), (np.char.find(flag.astype(str), 'q') == -1)),
flag+[","]+["o"], flag)) flag+[","]+["o"], flag))
elif (meth == "LY04"): elif (meth == "NCAR"):
flag = np.where((utmp < 0.5) & (flag == "n"), "o", flag = np.where((utmp < 0.5) & (flag == "n"), "o",
np.where((utmp < 0.5) & np.where((utmp < 0.5) &
((flag != "n") & ((flag != "n") &
......
...@@ -36,7 +36,7 @@ def cdn_calc(u10n, usr, Ta, lat, meth="S80"): ...@@ -36,7 +36,7 @@ def cdn_calc(u10n, usr, Ta, lat, meth="S80"):
# convert usr in eq. 21 to cdn to expand for low wind speeds # convert usr in eq. 21 to cdn to expand for low wind speeds
cdn = np.power((0.10038+u10n*2.17e-3+np.power(u10n, 2)*2.78e-3 - cdn = np.power((0.10038+u10n*2.17e-3+np.power(u10n, 2)*2.78e-3 -
np.power(u10n, 3)*4.4e-5)/u10n, 2) np.power(u10n, 3)*4.4e-5)/u10n, 2)
elif (meth == "LY04"): elif (meth == "NCAR"):
cdn = np.where(u10n > 0.5, (0.142+2.7/u10n+u10n/13.09 - cdn = np.where(u10n > 0.5, (0.142+2.7/u10n+u10n/13.09 -
3.14807e-10*np.power(u10n, 6))*1e-3, 3.14807e-10*np.power(u10n, 6))*1e-3,
(0.142+2.7/0.5+0.5/13.09 - (0.142+2.7/0.5+0.5/13.09 -
...@@ -156,7 +156,7 @@ def ctcqn_calc(zol, cdn, usr, zo, Ta, meth="S80"): ...@@ -156,7 +156,7 @@ def ctcqn_calc(zol, cdn, usr, zo, Ta, meth="S80"):
elif (meth == "LP82"): elif (meth == "LP82"):
cqn = np.where((zol <= 0), 1.15*0.001, 1*0.001) cqn = np.where((zol <= 0), 1.15*0.001, 1*0.001)
ctn = np.where((zol <= 0), 1.13*0.001, 0.66*0.001) ctn = np.where((zol <= 0), 1.13*0.001, 0.66*0.001)
elif (meth == "LY04"): elif (meth == "NCAR"):
cqn = np.maximum(34.6*0.001*np.sqrt(cdn), 0.1e-3) cqn = np.maximum(34.6*0.001*np.sqrt(cdn), 0.1e-3)
ctn = np.maximum(np.where(zol <= 0, 32.7*0.001*np.sqrt(cdn), ctn = np.maximum(np.where(zol <= 0, 32.7*0.001*np.sqrt(cdn),
18*0.001*np.sqrt(cdn)), 0.1e-3) 18*0.001*np.sqrt(cdn)), 0.1e-3)
...@@ -242,7 +242,7 @@ def get_stabco(meth="S80"): ...@@ -242,7 +242,7 @@ def get_stabco(meth="S80"):
coeffs : float coeffs : float
""" """
alpha, beta, gamma = 0, 0, 0 alpha, beta, gamma = 0, 0, 0
if (meth == "S80" or meth == "S88" or meth == "LY04" or if (meth == "S80" or meth == "S88" or meth == "NCAR" or
meth == "UA" or meth == "ecmwf" or meth == "C30" or meth == "UA" or meth == "ecmwf" or meth == "C30" or
meth == "C35" or meth == "Beljaars"): meth == "C35" or meth == "Beljaars"):
alpha, beta, gamma = 16, 0.25, 5 # Smith 1980, from Dyer (1974) alpha, beta, gamma = 16, 0.25, 5 # Smith 1980, from Dyer (1974)
...@@ -883,7 +883,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, zo, ...@@ -883,7 +883,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, zo,
---------- ----------
L : str L : str
Monin-Obukhov length definition options Monin-Obukhov length definition options
"tsrv" : default for S80, S88, LP82, YT96, UA, C30, C35 and LY04 "tsrv" : default for S80, S88, LP82, YT96, UA, C30, C35 and NCAR
"Rb" : following ecmwf (IFS Documentation cy46r1), default for ecmwf "Rb" : following ecmwf (IFS Documentation cy46r1), default for ecmwf
and Beljaars and Beljaars
lat : float lat : float
...@@ -916,7 +916,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, zo, ...@@ -916,7 +916,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, zo,
momentum stability function momentum stability function
meth : str meth : str
bulk parameterisation method option: "S80", "S88", "LP82", "YT96", bulk parameterisation method option: "S80", "S88", "LP82", "YT96",
"UA", "LY04", "C30", "C35", "ecmwf", "Beljaars" "UA", "NCAR", "C30", "C35", "ecmwf", "Beljaars"
Returns Returns
------- -------
...@@ -997,7 +997,7 @@ def get_strs(hin, monob, wind, zo, zot, zoq, dt, dq, dter, dqer, dtwl, ct, cq, ...@@ -997,7 +997,7 @@ def get_strs(hin, monob, wind, zo, zot, zoq, dt, dq, dter, dqer, dtwl, ct, cq,
warm layer correction switch warm layer correction switch
meth : str meth : str
bulk parameterisation method option: "S80", "S88", "LP82", "YT96", "UA", bulk parameterisation method option: "S80", "S88", "LP82", "YT96", "UA",
"LY04", "C30", "C35", "ecmwf", "Beljaars" "NCAR", "C30", "C35", "ecmwf", "Beljaars"
Returns Returns
------- -------
......
...@@ -49,7 +49,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, ...@@ -49,7 +49,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol,
n : int n : int
number of iterations number of iterations
meth : str meth : str
"S80","S88","LP82","YT96","UA","LY04","C30","C35","ecmwf", "S80","S88","LP82","YT96","UA","NCAR","C30","C35","ecmwf",
"Beljaars" "Beljaars"
qmeth : str qmeth : str
is the saturation evaporation method to use amongst is the saturation evaporation method to use amongst
...@@ -93,7 +93,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, ...@@ -93,7 +93,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol,
(SST.dtype not in ['float64', 'float32'])): (SST.dtype not in ['float64', 'float32'])):
sys.exit("input dtype of spd, T and SST should be float") sys.exit("input dtype of spd, T and SST should be float")
# if input values are nan break # if input values are nan break
if meth not in ["S80", "S88", "LP82", "YT96", "UA", "LY04", "C30", "C35", if meth not in ["S80", "S88", "LP82", "YT96", "UA", "NCAR", "C30", "C35",
"ecmwf", "Beljaars"]: "ecmwf", "Beljaars"]:
sys.exit("unknown method") sys.exit("unknown method")
if qmeth not in ["HylandWexler", "Hardy", "Preining", "Wexler", if qmeth not in ["HylandWexler", "Hardy", "Preining", "Wexler",
...@@ -117,7 +117,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, ...@@ -117,7 +117,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol,
P = np.ones(spd.shape)*np.copy(P) P = np.ones(spd.shape)*np.copy(P)
if ((cskin == None) and (meth == "S80" or meth == "S88" or meth == "LP82" if ((cskin == None) and (meth == "S80" or meth == "S88" or meth == "LP82"
or meth == "YT96" or meth == "UA" or or meth == "YT96" or meth == "UA" or
meth == "LY04")): meth == "NCAR")):
cskin = 0 cskin = 0
elif ((cskin == None) and (meth == "C30" or meth == "C35" elif ((cskin == None) and (meth == "C30" or meth == "C35"
or meth == "ecmwf" or meth == "Beljaars")): or meth == "ecmwf" or meth == "Beljaars")):
......
...@@ -507,7 +507,7 @@ start_time = time.perf_counter() ...@@ -507,7 +507,7 @@ start_time = time.perf_counter()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
inF = input("Give input file name (data_all.csv or era5_r360x180.nc): \n") inF = input("Give input file name (data_all.csv or era5_r360x180.nc): \n")
meth = input("Give prefered method: \n") meth = input("Give prefered method: \n")
while meth not in ["S80", "S88", "LP82", "YT96", "UA", "LY04", "C30", "C35", while meth not in ["S80", "S88", "LP82", "YT96", "UA", "NCAR", "C30", "C35",
"ecmwf","Beljaars"]: "ecmwf","Beljaars"]:
print("method unknown") print("method unknown")
meth = input("Give prefered method: \n") meth = input("Give prefered method: \n")
...@@ -545,7 +545,7 @@ if (cskinIn == ''): ...@@ -545,7 +545,7 @@ if (cskinIn == ''):
cskinIn = None cskinIn = None
if ((cskinIn == None) and (meth == "S80" or meth == "S88" or meth == "LP82" if ((cskinIn == None) and (meth == "S80" or meth == "S88" or meth == "LP82"
or meth == "YT96" or meth == "UA" or meth == "YT96" or meth == "UA"
or meth == "LY04")): or meth == "NCAR")):
cskinIn = 0 cskinIn = 0
ext = ext+'noskin_' ext = ext+'noskin_'
elif ((cskinIn == None) and (meth == "C30" or meth == "C35" elif ((cskinIn == None) and (meth == "C30" or meth == "C35"
...@@ -641,7 +641,7 @@ print("run_ASFC.py took ", np.round((time.perf_counter()-start_time)/60, 2), ...@@ -641,7 +641,7 @@ print("run_ASFC.py took ", np.round((time.perf_counter()-start_time)/60, 2),
#%% generate txt file with statistics #%% generate txt file with statistics
if ((cskinIn == None) and (meth == "S80" or meth == "S88" or meth == "LP82" if ((cskinIn == None) and (meth == "S80" or meth == "S88" or meth == "LP82"
or meth == "YT96" or meth == "UA" or or meth == "YT96" or meth == "UA" or
meth == "LY04")): meth == "NCAR")):
cskinIn = 0 cskinIn = 0
elif ((cskinIn == None) and (meth == "C30" or meth == "C35" elif ((cskinIn == None) and (meth == "C30" or meth == "C35"
or meth == "ecmwf" or meth == "Beljaars")): or meth == "ecmwf" or meth == "Beljaars")):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment