AirSeaFluxCode.py is a Python 3.6+ module designed to process data (input as numpy ndarray float number type) to calculate surface turbulent fluxes, flux product estimates and to provide height adjusted values for wind speed, air temperature and specific humidity of air at a user defined reference height from a minimum number of meteorological parameters (wind speed, air temperature, and sea surface temperature) and for a variety of different bulk algorithms (at the time of the release amount to ten).
Several optional parameters can be input such as: an estimate of humidity (relative humidity, specific humidity or dew point temperature) is required in the case an output of latent heat flux is requested; atmospheric pressure. If cool skin/warm layer adjustments are switched on then shortwave/longwave radiations should be provided as input. Other options the user can define on input are the height on to which the output parameters would be adjusted, the function of the cool skin adjustment provided that the option for applying the adjustment is switched on, the option to consider the effect of convective gustiness. The user can: choose from a wide variety of saturation vapour pressure function in order to compute specific humidity from relative humidity or dew point temperature, provide user defined tolerance limits, user define the maximum number of iterations.
%For the original publication of this package see: \href{https://}{link to the paper}.
%
For recommendations or bug reports, please visit \url{https://git.noc.ac.uk/NOCSurfaceProcesses/AirSeaFluxCode}
A suite of data is provided for testing, containing values for air temperature, sea surface temperature, wind speed, air pressure, relative humidity, shortwave radiation, longitude and latitude.\\
The first test data set (data\_all.csv) is developed as daily averages from minute data provided by the Shipboard Automated Meteorological and Oceanographic System \cite[SAMOS,][]{Smith_etal_2019a, Smith_etal_2018} ; it contains a synthesis of various conditions from meteorological and surface oceanographic data from research vessels and three that increase the accuracy of the flux estimate (atmospheric pressure, relative humidity, shortwave radiation). We use quality control level three (research level quality), and we only keep variables flagged as Z (good data) \citep[for details on flag definitions see][]{Smith_etal_2018}. The input sensors' heights vary by ship and sometimes by cruise. The data contain wind speeds ranging between 0.015 and 18.5ms$^{-1}$, air temperatures ranging from -3 to 9.7$^{\circ}$C and air-sea temperature differences (T-T\textsubscript{0}, hereafter $\Delta$T) from around -3 to 3$^{\circ}$C. A sample output file is given (data\_all\_out.csv and its statistics in data\_all\_stats.txt) run with default options (see data\_all\_stats.txt for the input summary); note that deviations from the output values might occur due to floating point errors. \\
The second test data set contained in era5\_r360x180.nc contains ERA5 \citep{Hersbach_etal_2018, era5_doc} hourly data for one sample day (15/07/2019) remapped to 1$^{\circ}$\,$\times$\,1$^{\circ}$ regular grid resolution using cdo \citep{schulzweida_uwe_2019_3539275}. In this case all essential and optional input SSVs are available. For the calculation of TSFs we only consider values over the ice-free ocean by applying the available land mask and sea-ice concentration (equal to zero) and setting values over land or ice to missing (flag=``m''). The data contain wind speeds ranging from 0.01 to 24.9 ms$^{-1}$, air temperatures ranging from -17.2 to 35.4 $^{\circ}$C and $\Delta$T from around -16.2 to 8$^{\circ}$C.
\section{Description of sample code}
In the AirSeaFluxCode repository \url{AirSeaFluxCode} we provide two types of sample routines to aid the user running the code. The first is the routine toy\_ASFC.py which is an example of running AirSeaFluxCode either with one-dimensional data sets (like a subset of R/V data) loading the necessary parameters from the test data (data\_all.csv) or gridded 3D data sampled in era5\_r360x180.nc.\\
The routine first loads the data in the appropriate format (numpy.ndarray, type float), then calls AirSeaFluxCode loads the data as input, and finally saves the output as text or as a NetCDF file and at the same time generates a table of statistics for all the output parameters and figures of the mean values of the turbulent surface fluxes.
Second a jupyter notebook (ASFC\_notebook.ipynb) is provided as a step by step guide on how to run AirSeaFluxCode, starting from the libraries the user would need to import. It also provides an example on how to run AirSeaFluxCode with the research vessel data as input and generate basic plots of momentum and (sensible and latent) heat fluxes. The user can launch the \href{https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what\_is\_jupyter.html}{Jupyter Notebook App} by clicking on \textit{Jupyter Notebook} icon in Anaconda start menu, this will launch a new browser window in your browser of choice (more details can be found \href{https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html}{here}).
\chapter{Users guide}
\label{\detokenize{index:users-guide}}
\section{Introduction}
\label{\detokenize{index:introduction}}
The flux calculation code was implemented in order to provide a useful, easy to use and straightforward ~\lq\lq\,roadmap\,\rq\rq~ of when and why to use different bulk formulae for the calculation of surface turbulent fluxes.
Differences in the calculations between different methods can be found in:
\begin{itemize}
\item the way they compute specific humidity from relative humidity, temperature and pressure
\item the way they parameterise the exchange coefficients
\item the inclusion of heat and moisture roughness lengths
\item the inclusion of cool skin/warm layer correction instead of the bulk sea surface temperature, and
\item the inclusion of gustiness in the wind speed
\item the momentum, heat and moisture stability functions definitions
\end{itemize}
The available parameterizations in AirSeaFluxCode provided in order to calculate the momentum, sensible heat and latent heat fluxes are implemented following:
\begin{itemize}
\item\cite{Smith_1980} as S80: the surface drag coefficient is related to 10\,m wind speed (u\textsubscript{10}), surface heat and moisture exchange coefficients are constant. The stability parameterizations are based on the Monin-Obukhov similarity theory for stable and unstable condition which modify the wind, temperature and humidity profiles and derives surface turbulent fluxes in open ocean conditions (valid for wind speeds from 6 to 22\,ms$^{-1}$).
\item\cite{Smith_1988} as S88: is an improvement of the S80 parameterization in the sense that it provides the surface drag coefficient in relation to surface roughness over smooth and viscous surface and otherwise derives surface turbulent fluxes in open ocean conditions as described for S80.
\item\cite{Large_Pond_1981,Large_Pond_1982} as LP82: the surface drag coefficient is computed in relation to u\textsubscript{10} and has different parameterization for different ranges of wind speed. The heat and moisture exchange coefficients are constant for wind speeds \textless\,11ms$^{-1}$ and a function of u\textsubscript{10} for wind speeds between 11 and 25ms$^{-1}$. The stability parameterizations are based on the Monin-Obukhov similarity theory for stable and unstable condition.
\item\cite{Yelland_Taylor_1996, Yelland_etal_1998} as YT96: the surface drag coefficient is a function of u\textsubscript{$\ast$}. The heat and moisture exchange coefficients are considered constant as in the cases of S80 and S88.
\item\cite{Zeng_etal_1998} as UA: the drag coefficient is given as a function of roughness length over smooth and viscous surface. The parameterization includes the effect of gustiness. The heat and moisture exchange coefficients are a function of heat and moisture roughness lengths and are valid in the range of 0.5 and 18\,ms$^{-1}$.
\item\cite{Large_Yeager_2004, Large_Yeager_2009} as NCAR: the surface drag coefficient is computed in relation to wind speed for u\textsubscript{10}\,\textgreater{}0.5\,ms$^{-1}$. The heat exchange coefficient is given as a function of the drag coefficient (one for stable and one for unstable conditions) and the moisture exchange coefficient is also a function of the drag coefficient.
\item\cite{Fairall_etal_1996a, Fairall_etal_2003, Edson_etal_2013} as C30, and C35: is based on data collected from four expeditions in order to improve the drag and exchange coefficients parameterizations relative to surface roughness. It includes the effects of ~\lq\lq\,cool skin\,\rq\rq~, and gustiness. The effects of waves and sea state are neglected in order to keep the software as simple as possible, without compromising the integrity of the outputs though.
\item\cite{era5_2019} as ecmwf: the drag, heat and moisture coefficients parameterizations are computed relative to surface roughness estimates. It includes gustiness in the computation of wind speed.
\item\cite{Beljaars_1995a, Beljaars_1995b, Zeng_Beljaars_2005} as Beljaars: the drag, heat and moisture coefficients parameterizations are computed relative to surface roughness estimates. It includes gustiness in the computation of wind speed.
In AirSeaFluxCode we use a consistent calculation approach across all algorithms; where this requires changes from published descriptions the effect of those changes are quantified and shown to be small compared to the significance levels we set in table\,\ref{tab:tol}. The AirSeaFluxCode software calculates air-sea flux of momentum, sensible heat and latent heat fluxes from bulk meteorological variables (wind speed (spd), air temperature (T), and relative humidity (RH)) provided at a certain height (hin) above the surface and sea surface temperature (SST) and height adjusted values for wind speed, air temperature and specific humidity of air at a user specified reference height (default is 10\,m). \\
Additionally, non essential parameters can be given as inputs, such as: downward long/shortwave radiation (Rl, Rs), latitude (lat), reference output height (hout), cool skin (cskin), cool skin correction method (skin, following either \cite{Fairall_etal_1996b} (default for C30, and C35), \cite{Zeng_Beljaars_2005} (default for Beljaars), \cite{era5_2019} (default for ecmwf)), warm layer correction (wl), gustiness (gust) and boundary layer height (zi), choice of bulk algorithm method (meth), the choice of saturation vapour pressure function (qmeth), tolerance limits (tol), choice of Monin-Obukhov length function (L), and the maximum number of iterations (maxiter). Note that all input variables need to be loaded as numpy.ndarray.
The air and sea surface specific humidity are calculated using the functions qsat\_air(T, P, RH, qmeth) and qsat\_sea(SST, P, qmeth) , which call functions contained in VaporPressure.py to calculate saturation vapour pressure following a chosen method (default is \cite{Buck_2012}).
\item The air temperature is converted to air temperature for adiabatic expansion following: Ta = T + 273.16 +$\Gamma$\,$\cdot$\,hin
\item The density of air is defined as $\rho$ = (0.34838\,$\cdot$\,P)/T$_\text{v10n}$
\item The specific heat at constant pressure is defined as c$_\text{p}$ = 1004.67\,$\cdot$\,(1 + 0.00084\,$\cdot$\,q$_\text{sea}$)
\item The latent heat of vapourization is defined as L$_\text{v}$ = (2.501-0.00237\,$\cdot$\,SST)\,$\cdot$\,10$^\text{6}$ (SST in $^{\circ}$C)
\end{itemize}
Initial values for the exchange coefficients and friction velocity are calculated assuming neutral stability. The program iterates to calculate the temperature and humidity fluxes and the virtual temperature as T$_{\text{v}}$=T$_{\text{a}}$(1+0.61q$_{\text{air}}$) , then the stability parameter z/L either as,
or as a function of the Richardson number as described by \cite{era5_2019}[their equations 3.23--3.25]; hence a new value for u$_{\text{10n}}$, hence new transfer coefficients, hence new flux values until convergence is obtained (Table \ref{tab:tol}). At every iteration step if there are points where the neutral 10\,m wind speed (u$_{\text{10n}}$) becomes negative the wind speed value at these points is set to NaN.
The values for air density, specific heat at constant volume, and the latent heat of vaporisation are used in converting the scaled fluxes u$_{\text{$\ast$}}$, T$_{\text{$\ast$}}$, and q$_{\text{$\ast$}}$ (eq.\,\ref{eq:strs}, for UA we retain their equations 7-14) to flux values in Nm$^{-2}$ and Wm$^{-2}$, respectively.
AirSeaFluxCode is set up to test for convergence between the i$^{th}$ and (i-1)$^{th}$ iteration according to the tolerance limits shown in Table\,\ref{tab:tol} for six variables in total, of which three are relative to the height adjustment (u$_{10}$, t$_{10}$, q$_{10}$) and three to the flux calculation ($\tau$, shf, lhf) respectively. The tolerance limits are set according to the maximum accuracy that can be feasible for each variable. The user can choose to allow for convergence either only for the fluxes (default), or only for height adjustment or for both (all six variables). Values that have not converged are by default set to missing, but the number of iterations until convergence is provided as an output (this number is set to -1 for non convergent points).
A set of flags are provided as an output that signify: ``m'' where input values are missing; ``o'' where the wind speed for this point is outside the nominal range for the used parameterization; ``u'' or ``q'' for points that produce unphysical values for u\textsubscript{10n} or q\textsubscript{10n} respectively during the iteration loop; ``r'' where relative humidity is greater than 100\%; ``l'' where the bulk Richardson number is below -0.5 or above 0.2 or z/L is greater than 1000; ``i'' where the value failed to converge after n number of iterations, if the points converged normally they are flagged with ``n''. The user should expect NaN values if out is set to zero (namely output only values that have converged) for values that have not converged after the set number of iterations (default is ten) or if they produced unphysical values for u\textsubscript{10n} or q\textsubscript{10n}.
Calculates momentum and heat fluxes using different parameterizations
inputs should be numpy.ndarray float type.
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{spd} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- relative wind speed in ms$^{-1}$ (is assumed as magnitude difference
between wind and surface current vectors for C30, C35)
\item{}
\sphinxstyleliteralstrong{T} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature in K (will convert if in $^\circ$\,C)
\item{}
\sphinxstyleliteralstrong{SST} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature in K (will convert if in $^\circ$\,C)
\item{}
\sphinxstyleliteralstrong{SST\_fl} (\href{https://docs.python.org/3/library/functions.html\#str}{\sphinxstyleliteralemphasis{str}}) -- sea surface temperature type ``bulk'' or ``skin''
\sphinxstyleliteralstrong{lat} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latitude (deg), default is 45$^\circ$
\item{}
\sphinxstyleliteralstrong{hum} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- humidity input is an array of the form [x, values] where: \\
x="rh" for relative humidity (\%)--default, \\
x="q" for specific humidity (g\slash\,kg) and \\
x="Td" for dew point temperature (K).
\item{}
\sphinxstyleliteralstrong{P} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air pressure in hPa, in the input is empty it is set to 1013hPa
\item{}
\sphinxstyleliteralstrong{hin} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sensor heights in m (array 3x1 or 3xn)
\item{}
\sphinxstyleliteralstrong{hout} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- output height, default is 10\,m
\sphinxstyleliteralstrong{cskin} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- 0 (default) no cool skin adjustment, otherwise is set to 1;
\sphinxstyleliteralstrong{wl} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- warm layer correction switched off by default (wl=0), to switch on set to 1
\item{}
\sphinxstyleliteralstrong{gust} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- 4x1 [x, beta, zi, ugmin] x=0 gustiness is OFF, x=1-5 gustiness is ON
and use gustiness factor: 1. \cite{Fairall_etal_2003}, 2. GF is removed from TSFs u\textsubscript{10n}, u\textsubscript{ref}, 3. GF=1, 4. following ECMWF, 5. following \cite{Zeng_etal_1998},
5. following C35 matlab code; beta gustiness parameter, default is 1.2, zi PBL height (m) default is 600, ugmin is the minimum value for gust speed, default is 0.01ms$^{-1}$
\item{}
\sphinxstyleliteralstrong{qmeth} (\href{https://docs.python.org/3/library/stdtypes.html\#str}{\sphinxstyleliteralemphasis{str}}) -- is the saturation evaporation function to use amongst ``HylandWexler", ``Hardy", ``Preining", ``Wexler", ``GoffGratch", ``MagnusTetens", ``Buck", ``Buck2", ``WMO", ``WMO2018", ``Sonntag", ``Bolton", ``IAPWS", ``MurphyKoop"
\item{}
\sphinxstyleliteralstrong{tol} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- tolerance limits are set as a 4x1 or 7x1 array of the type [option, tol$_{u_{10n}}$, tol$_{t_{10n}}$, tol$_{q_{10n}}$, tol$_{tau}$, tol$_{shf}$, tol$_{lhf}$]. option can be 'flux' to set tolerance limits for the flux calculation only e.g. tol = ['flux', 0.01, 1, 1], 'ref' to set tolerance limits for height adjustment to hout e.g. tol = ['ref', 0.01, 0.01, 5$\cdot$\,10$^{-5}$] or 'all' to set tolerance limits for both air-sea fluxes and height adjustment e.g. ['all', 0.01, 0.01, 1$\cdot$\,10$^{-5}$, 0.01, 1, 1]. Default is tol = ['all', 0.01, 0.01, 1$\cdot$\,10$^{-5}$, 0.01, 1, 1]
\item{}
\sphinxstyleliteralstrong{maxiter} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- number of iterations, default is 10; note that the number of iterations should not be less than 5.
\item{}
\sphinxstyleliteralstrong{out} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- 0 to set points that have not converged to missing, otherwise set to 1
\item{}
\sphinxstyleliteralstrong{out\_var} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{str}}) -- optional. user can define pandas array of variables to be output.
\sphinxstyleliteralstrong{Ta} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
\sphinxstyleliteralstrong{Ta} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
Calculate neutral heat and moisture exchange coefficients
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{corq} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{str}}) -- flag to select ``ct'' or ``cq''
\item{}
\sphinxstyleliteralstrong{zol} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- height over MO length
\sphinxstyleliteralstrong{Ta} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\sphinxstylestrong{ctn or cqn} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- neutral heat or moisture exchange coefficient
\item{}
\sphinxstylestrong{zot or zoq} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- roughness length for heat or moisture
\sphinxstyleliteralstrong{psit} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- heat or moisture stability function
\end{itemize}
\item[{Returns}]\leavevmode
\begin{itemize}
\item{}
\sphinxstylestrong{ctq} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- heat or moisture exchange coefficient
The stratification functions $\Psi_{i}$ are the integrals of the dimensionless profiles $\Phi_{i}$, which are determined experimentally, and are applied as stability corrections to the wind speed, temperature and humidity profiles. They are a function of the stability parameter z\slash\,L, where L is the Monin-Obhukov length.
\phantomsection\label{\detokenize{index:module-flux_subs}}\index{flux\_subs (module)}\index{psim\_calc() (in module flux\_subs)}
Calculate heat/moisture stability function for unstable conditions
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{zol} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- height over MO length
Calculate heat/moisture stability function for stable conditions
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{zol} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- height over MO length
Compute the velocity structure function in COARE 3.0 or 3.5
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{zol} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- height over MO length
\item{}
\sphinxstyleliteralstrong{meth} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{str}}) -- method (C30 or C35)
Compute the thickness (m) of the viscous skin layer. Based on \citet{Fairall_etal_1996b} and cited in \citet{era5_2019} eq. 8.155 p. 164
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{aw} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- thermal expansion coefficient of sea-water (K$^{-1}$)
\item{}
\sphinxstyleliteralstrong{Q} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) --part of the net heat flux actually absorbed in the warm layer (W\,m$^{-2}$)
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
\end{itemize}
\item[{Returns}]\leavevmode
\begin{itemize}
\item{}
\sphinxstylestrong{delta} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- the thickness (m) of the viscous skin layer
Compute cool skin following the methodology described in COARE3.5 \citep{Fairall_etal_1996b, Edson_etal_2013}
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{rho} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- density of air (kgm$^{-3}$)
\sphinxstyleliteralstrong{Rnl} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- downward net longwave radiation (Wm$^{-2}$)
\item{}
\sphinxstyleliteralstrong{cp} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific heat of air at constant pressure (J/K/kg)
\item{}
\sphinxstyleliteralstrong{lv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latent heat of vaporization (J/kg)
\sphinxstyleliteralstrong{tsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star humidity (g/kg)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
\end{itemize}
\item[{Returns}]\leavevmode
\begin{itemize}
\item{}
\sphinxstylestrong{dter} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- cool-skin temperature depression (K)
cool skin adjustment based on IFS Documentation cy46r1 \citep{era5_2019}
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{rho} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- density of air (kg\,m$^{-3}$)
\sphinxstyleliteralstrong{Rnl} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- downward net longwave radiation (W/m$^2$)
\item{}
\sphinxstyleliteralstrong{cp} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific heat of air at constant pressure (J/K/kg)
\item{}
\sphinxstyleliteralstrong{lv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latent heat of vaporization (J/kg)
\sphinxstyleliteralstrong{tsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star humidity (g/kg)
\item{}
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
\end{itemize}
\item[{Returns}]\leavevmode
\begin{itemize}
\item{}
\sphinxstylestrong{dtc} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- cool-skin temperature depression (K)
cool skin adjustment based on Beljaars (1997): air-sea interaction in the ECMWF model
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{rho} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- density of air (kg\,m$^{-3}$)
\sphinxstyleliteralstrong{Rnl} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- downward net longwave radiation (W/m$^2$)
\item{}
\sphinxstyleliteralstrong{cp} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific heat of air at constant pressure (J/K/kg)
\item{}
\sphinxstyleliteralstrong{lv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latent heat of vaporization (J/kg)
\sphinxstyleliteralstrong{tsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star humidity (g/kg)
\item{}
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
\item{}
\sphinxstyleliteralstrong{Qs} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- radiation balance from previous step (W\,m$^{-2}$)
warm layer correction following IFS Documentation cy46r1 \citep{era5_2019} and aerobulk \citep{Brodeau_etal_2017}
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{rho} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- density of air (kg\,m$^{-3}$)
\sphinxstyleliteralstrong{Rnl} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- downward net longwave radiation (W/m$^2$)
\item{}
\sphinxstyleliteralstrong{cp} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific heat of air at constant pressure (J/K/kg)
\item{}
\sphinxstyleliteralstrong{lv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latent heat of vaporization (J/kg)
\sphinxstyleliteralstrong{tsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star humidity (g/kg)
\item{}
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{skt} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- skin temperature from previous step(K)
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{qsea} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific humidity over sea (g/kg)
\item{}
\sphinxstyleliteralstrong{lv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latent heat of vaporization (J/kg)
\sphinxstyleliteralstrong{Ta} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\sphinxstyleliteralstrong{tsrv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star virtual temperature of air (K)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
There are different ways to remove the effect of gustiness according to the user's choice.
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{gust} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- first instance from get\_gust
option on how to apply gustiness
0: gustiness is switched OFF \\
1: gustiness is switched ON following \cite{Fairall_etal_2003}
2: gustiness is switched ON and GF is removed from TSFs u10n, uref
3: gustiness is switched ON and GF=1
4: gustiness is switched ON following ECMWF
5: gustiness is switched ON following \cite{Zeng_etal_1998}
6: gustiness is switched ON following C35 matlab code
\sphinxstyleliteralstrong{wind} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- wind speed including gust wind (ms$^{-1}$)
\item{}
\sphinxstyleliteralstrong{step} (\href{https://docs.python.org/3/library/functions.html\#str}{\sphinxstyleliteralemphasis{str}}) -- step during AirSeaFluxCode the GF is applied: "u", "TSF"
\sphinxstyleliteralstrong{dt}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- temperature difference (K)
\item{}
\sphinxstyleliteralstrong{dq}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific humidity difference (g/kg)
\sphinxstyleliteralstrong{tsr}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star specific humidity (g\slash\,kg)
\sphinxstyleliteralstrong{tsr}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- star specific humidity (g\slash\,kg)
\item{}
\sphinxstyleliteralstrong{Ta}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\item{}
\sphinxstyleliteralstrong{qsr}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air specific humidity (g\slash\,kg)
\end{itemize}
\item[{Returns}]\leavevmode
\begin{itemize}
\item{}
\sphinxstyleliteralstrong{tsrv}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- virtual star temperature (K)
\sphinxstyleliteralstrong{tv}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- virtual temperature (K)
\item{}
\sphinxstyleliteralstrong{dtv}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- virtual temperature difference, air and sea (K)
Calculate Monin-Obukhov length from virtual star temperature
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode
\begin{itemize}
\item{}
\sphinxstyleliteralstrong{tsrv} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- virtual star temperature (K)
\item{}
\sphinxstyleliteralstrong{grav} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- acceleration of gravity (ms$^{-2}$)
\item{}
\sphinxstyleliteralstrong{tv}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- virtual temperature (K)
Calculate Monin-Obukhov length following \cite{era5_2019}
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode
\begin{itemize}
\item{}
\sphinxstyleliteralstrong{Rb} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- Richardson number
\item{}
\sphinxstyleliteralstrong{hin\_t} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- temperature measurement height (m)
\item{}
\sphinxstyleliteralstrong{monob}(\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- Monin-Obukhov length from previous iteration step (m)
Compute acceleration of gravity relative to latitude
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{lat} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- latitude ($^\circ$)
Computes the kinematic viscosity of dry air as a function of air temp.
following Andreas (1989), CRREL Report 89-11.
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode
\sphinxstyleliteralstrong{T} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature ($^\circ$\,C)
\sphinxstyleliteralstrong{u10n} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- wind speed at 10\,m neutral stability (ms$^{-1}$)
\item{}
\sphinxstyleliteralstrong{q10n} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific humidity at 10\,m neutral stability (kg/kg)
\item{}
\sphinxstyleliteralstrong{Rb} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- bulk Richardson number
\sphinxstyleliteralstrong{out} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- output option for non converged points. The default is 0
\sphinxstyleliteralstrong{out\_var} (\href{https://docs.python.org/3/library/functions.html\#str}{\sphinxstyleliteralemphasis{str}}) -- list of variables we want to output
\item{}
\sphinxstyleliteralstrong{cskin} (\href{https://docs.python.org/3/library/functions.html\#int}{\sphinxstyleliteralemphasis{int}}) -- cool skin switch 0 or 1
\sphinxstyleliteralstrong{T} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\item{}
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{P} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air pressure at sea level (hPa)
\item{}
\sphinxstyleliteralstrong{qmeth} (\href{https://docs.python.org/3/library/functions.html\#str}{\sphinxstyleliteralemphasis{str}}) -- method to calculate specific humidity from vapour pressure
\end{itemize}
\item[{Returns}]\leavevmode
\begin{itemize}
\item{}
\sphinxstylestrong{qair} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific humidity of air (g/kg)
\item{}
\sphinxstylestrong{qsea} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific humidity over sea surface (g/kg)
Calculate the saturation vapor pressure. For temperatures above 0$^{\circ}$C the vapor pressure over liquid water is calculated.
Based on Holger V\"{o}mel's routine modified by S. Biri
\begin{quote}\begin{description}
\item[{Parameters}]\leavevmode\begin{itemize}
\item{}
\sphinxstyleliteralstrong{temp} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- temperature ($^\circ$C)
\sphinxstyleliteralstrong{phase} (\href{https://docs.python.org/3/library/functions.html\#str}{\sphinxstyleliteralemphasis{str}}) -- ``liquid'' : Calculate vapor pressure over liqiud water or ``ice'' : Calculate vapor pressure over ice
\sphinxstyleliteralstrong{opt} (\href{https://docs.python.org/3/library/functions.html\#str}{\sphinxstyleliteralemphasis{str}}) -- type of adiabatic lapse rate dry or ``moist''. dry can be set to be constant (``dry\_c''), for dry air (``dry'', default) or for unsaturated air with water vapour (``dry\_v'')
\item{}
\sphinxstyleliteralstrong{sst} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- sea surface temperature (K)
\item{}
\sphinxstyleliteralstrong{t} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- air temperature (K)
\item{}
\sphinxstyleliteralstrong{q} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- specific humidity (kg/kg)
\item{}
\sphinxstyleliteralstrong{cp} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- heat capacity of air at constant pressure (kJ/kgK)
\end{itemize}
\item[{Returns}]\leavevmode
\sphinxstylestrong{gamma} (\href{https://docs.python.org/3/library/functions.html\#float}{\sphinxstyleliteralemphasis{float}}) -- lapse rate (K/m)