# LaTeX equations in micrometeorology

By Peng Zhao | May 23, 2017

I have collected plenty of equations in my research in recent years. Most of them were typed by my own hands. For convenience, I organized them in an ASCII file named eq.tex as an equation library, side by side with a compiled file named eq.pdf. When I needed an equation, I searched eq.pdf, and looked for the codes in eq.tex, and then copied and posted it to my working document. A little annoying, but much better than retyping.

Now comes blogdown and Hugo-academic theme. Everything has changed. I pasted all the texts from eq.tex to an .Rmd file and left it in blogdown. which produced this post. Right click your mouse on an equation in this post - Show Math As - TeX Commands, and I get the LaTeX code of the equation immediately.

Farewell, $$\LaTeX$$. I guess I would never go back to the old fashioned way of$$\TeX$$ - pdf couple any more.

## Meteorology

### Atmpspheric pressure

$$$P=101.325 \cdot (\frac{293-0.0065z}{293}) ^ {5.26} = 86.838\,\text{kPa}$$$

$$z$$: elevation above sea level in m.

$$$-\text{d} p =\rho g \text{d}z$$$

$$$\ln \frac{p_2}{p_1} = - \int_{z_1}^{z_2} \frac{g}{RT}\text{d}z$$$

### Psychrometric constant

$$$\gamma =\frac{c_p P}{\varepsilon \lambda} = 0.665 \times 10 ^ {-3} P$$$

$$$\lambda = -0.0000614342 T^3 + 0.00158927 T^2 - 2.36418T + 2500.79$$$

$$P$$: atmospheric pressure.

$$\lambda$$: latent heat of vaporization (2.46 MJ kg$$^{-1}$$)

$$c_p$$: specific heat of the air (at constant pressure $$1.013 \times 10 ^{-3}$$ MJ kg$$^{-1}$$K$$^{-1}$$)

### Humidity

$$$e_{\text s}=6.112\exp\frac {17.62t}{243.12+t}$$$

$$e_s$$: saturated vapor pressure over water at $$-45$$ to 60 $$^{\circ}$$C (sonntag1990)

$$$s_{\text c}=\frac {4284e_{\text s}}{(243.12+t)^2}$$$

$$s_c$$: slope of the saturation vapor pressure temperature relationship.

or

$$$e_{\text s} = 0.6108\exp\frac {17.27T}{237.3 + T}$$$

and

$$$s_{\text c}=\frac {4098 \cdot 0.6108\exp\frac {17.27T}{237.3 + T}}{(237.3 + T)^2}$$$

## Carbon

$$$\text {GPP} = \frac{\alpha R_{\mathrm g}\beta }{\alpha R_{\mathrm g}+\beta }$$$

$$$\frac{\text {GPP}}{\text {LAI}_\text{act}}\ = \frac{\alpha' R_{\mathrm g}\beta' }{\alpha' R_{\mathrm g}+\beta' }$$$

$$$\label{eGPPLRg} \text{GPP} = \text{LAI}_\text{act}\frac{\alpha' R_{\mathrm g}\beta' }{\alpha' R_{\mathrm g}+\beta' },$$$

$$$\label{eGPPL} \text {GPP} = a_\text {LAI}\text{LAI}_\text {act}.$$$

Chamber flux calculation:

$$$F_c = \frac{10 V P_0 (1 - \frac{W_0}{1000})}{RS (T_0 + 273.15)} \frac{\partial C'}{\partial t}$$$

flux in μmol m s, p in kpa, volume in cm, w0 in 0.001, t in °C, t in s, c in ppm.

$$$C' = C'_x + (C'_0 - C'_x) e ^ {-a(t-t_0)}$$$

$$$\frac{\partial C'}{\partial t} | _{t = t_0} = a(C'_x - C'_0)$$$

$$$C' = (C'_x + kt) + (C'_0 - C'_x) e ^ {-a(t-t_0)}$$$

$$$\frac{\partial C'}{\partial t} | _{t = t_0} = a(C'_x - C'_0) + k$$$

## Energy

### Evaporation from water by energy balance

$$$E_r = \frac{R_n}{l_v \rho_w} \times 1000 \times 86400$$$

$$$l_v = 2.501 \times 10^6 - 2370T$$$

$$E_r$$ in mm d$$^{-1}$$.

$$R_n$$: net radiation (hourly mean - WRCC).

$$l_v$$: latent heat of vaporization (J/kg).

$$\rho_w$$: mean water density at constant pressure (999.8 kg m$$^{-3}$$)

### Penman Monteith equation for latent heat flux

$$$Q ^\text {PM}_{\text E}=\frac {s_{\text c} \frac{-R_{\text n}-Q_{\text G}}{86400\text{s}} + \frac{\rho_a c_{\text p} (e_{\text s} - e_{\text a})}{r_{\text a}}}{s_{\text c} + \gamma (1 + \frac{r_{\text s}}{r_{\text a}})}$$$

$$Q ^\text {PM}_{\text E}$$: latent heat flux representing ET fraction (day 4.55 MJ m$$^{-2}$$d$$^{-1}$$, night 4.43 MJ m$$^{-2}$$d$$^{-1}$$)

$$R_n$$: (0.957 MJ m$$^{-2}$$d$$^{-1}$$)

$$G_{hrday}$$: 0.0957 MJ m$$^{-2}$$d$$^{-1}$$

$$G_{hrnight}$$: 0.4789 MJ m$$^{-2}$$d$$^{-1}$$

$$e_s-e_a$$: vapor pressure deficit of the air (1.9484 kPa - 0.439 kPa = 1.509 kPa)

$$\rho_a$$: mean air density at constant pressure (1.040 kg m$$^{-3}$$)

$$$\rho_{adry} = \frac{p}{RT} = 1.229 \text { kg m}^{-3}$$$

$$$\rho_{ahumid} = \frac{p_d}{R_d T} + \frac{p_v}{R_v T}= 1.040 \text { kg m}^{-3}$$$

$$$p_v = RH \times p_{sat} = 1.142 \text{kPa}$$$

$$$p_{sat} = 6.1078 \cdot 10 ^{\frac{7.5T-2048.625}{T-35.85}} \cdot 100 = 1.84 \text { kPa}$$$

$$$p_d = p_{abs} - p_v = 85.696 \text{ kPa}$$$

$$c_p$$: specific heat of the air (at constant pressure $$1.013 \times 10 ^{-3}$$ MJ kg$$^{-1}$$K$$^{-1}$$)

$$s_c$$: slope of the saturation vapor pressure remperature relationship (0.117 kPa K$$^{-1}$$)

$$\gamma$$: psychrometric constant (0.0577 kPa K$$^{-1}$$)

$$r_s$$: bulk surface resistance (20.83 s m$$^{-1}$$)

$$$r_\text s=\frac{r_\text {si}}{\text {LAI}_\text {active}},$$$

$$r_\text {si}$$: bulk stomatal resistance well illuminated leaf (100 s m$$^{-1}$$)

LAI$$_{active}$$: active sulit leaf area index. It differs widely for crops but 3 – 5 common for most mature crops. Changes through season and normally reaches max before flowering. Depends on plant density and crop variety. Generally 0.5LAI, i.e. only top half of dense clipped grass is active in surface heat and vapor transfer. For clipped grass LAI$$=24h$$.

$$r_a$$: aerodynamic resistence (155.33 s m$$^{-1}$$)

$$$r_{\text a}= \frac{\ln \frac{z-d}{z_{\textrm{om}}} \ln \frac {z-d}{z_{\textrm{oh}}}}{\kappa ^2 u_z} = \frac{124.264}{u_z}=155.33\text { s m}^{-1}$$$

$$z_m$$: height of wind measurements (2 m)

$$z_h$$: height of humidity measurements (2 m)

$$h$$: constant vegetation height (0.4 m)

$$d$$: zero plane desplacement height ($$\frac{2}{3}h$$, 0.27 m)

$$z_{om}$$: roughness length governing momentum transfer ($$0.123h$$, 0.0492 m)

$$z_{oh}$$: roughness length governing transfer of heat and vapor ($$0.1z_{om}$$, 0.00492 m)

$$u_z$$: wind speed at 2 m height (mean 0.8 m s$$^{-1}$$)

### FAO Penman Monteith equation for ET rate from reference surface (ET$$_0$$)

$$$ET_0 = \frac {0.408 s_{\text c} \frac{-R_{\text n}-Q_{\text G}}{86400\text{s}} + \frac{\gamma 900 u_z (e_{\text s} - e_{\text a})}{T+273}}{s_{\text c} + \gamma (1 + 0.34u_z)}$$$

$$ET_0$$: reference evapotraspiration (day 1.109 mm day$$^{-1}$$, night 1.064 mm day$$^{-1}$$)

$$ET_0$$: reference evapotraspiration (day 2.72 MJ m$$^{-2}$$d$$^{-1}$$, night 2.61 MJ m$$^{-2}$$d$$^{-1}$$)

$$R_n$$: net radiation (0.445 MJ m$$^{-2}$$d$$^{-1}$$)

$$G_{hrday}$$: 0.0445 MJ m$$^{-2}$$d$$^{-1}$$

$$G_{hrnight}$$: 0.2227 MJ m$$^{-2}$$d$$^{-1}$$

$$e_s-e_a$$: vapor pressure deficit of the air (1.9484 kPa - 0.439 kPa = 1.509 kPa)

$$T$$: mean daily air temperature at 2 m height (16.2$$^\circ$$C)

### Equations in GaFiR documentation

$$$\text{NEE = GPP} + R_\text{eco} \tag{1}$$$

$$$\label{ePM} Q ^\text {PM}_{\text E}=\frac {s_{\text c} (-R_{\text n}-Q_{\text G}) + \frac{\rho c_{\text p} (e_{\text s} - e_{\text a})}{r_{\text a}}}{s_{\text c} + \gamma (1 + \frac{r_{\text s}}{r_{\text a}})},$$$

$$$\label{era} r_{\text a}= \frac{\ln \frac{z-d}{z_{\textrm{om}}} \ln \frac {z-d}{z_{\textrm{oh}}}}{\kappa ^2 u},$$$

$$$\label{eRl} %r^{\text {LAI}}_\text s=\frac{r_\text {si}}{0.5\text {LAI}}, r_\text s=\frac{r_\text {si}}{\text {LAI}_\text {active}},$$$

$$$\label{eKP} %\frac{r^{\text {KP}}_\text s}{r_\text a} = a \frac{r^*}{r_\text a} + b, \frac{r_\text s}{r_\text a} = a \frac{r^*}{r_\text a} + b,$$$

$$$r^*=\frac{(s_\text c + \gamma)\rho c_\text p (e_{\text s} - e_{\text a})}{s_\text c \gamma (-R_{\text n}-Q_{\text G})},$$$

$$$\label{eRs} r_{\text s}= \frac {r_{\text a}s_{\text c} (-R_{\text n}-Q_{\text G}) + \rho c_{\text p} (e_{\text s} - e_{\text a}) - r_{\text a}Q_{\text E}(s_{\text c} + \gamma)} {\gamma Q_{\text E}}.$$$

$$$\label{ePT} E=\alpha_{\text {PT}} \frac {s_{\text c}}{s_{\text c} + \gamma}(-Q_{\text A})$$$

## Model evaluation

$$$\text{ME}=\frac{1}{N}\sum_{i=1}^{N}|P_i-O_i|$$$

$$$\text{MAE}=\frac{1}{N}\sum_{i=1}^{N}(P_i-O_i)$$$

$$$\text{MSE}=\frac{1}{N}\sum_{i=1}^{N}(P_i-O_i)^2$$$

$$$\text{RMSE}=\sqrt{\frac{1}{N}\sum_{i=1}^{N}(P_i-O_i)^2}$$$

$$$\text{NRMSE}=100\frac{\text{RMSE}}{O_\text{max} - O_\text{min}}$$$

$$$\text{PBIAS} =100\frac{\sum_{i=1}^{n}(P_i-O_i)}{\sum_{i=1}^{n}O_i}$$$

$$$\text{RSR} =\frac{\text{RMSE}}{\sigma_O}$$$

$$$\text{rSD} =\frac{\sigma_P}{\sigma_O}$$$

$$$\text{NSE} =1-\frac{\sum_{i=1}^{n}(O_i-P_i)^2}{\sum_{i=1}^{n}(O_i - \overline{O})^2}$$$

$$$\text{mNSE} =1-\frac{\sum_{i=1}^{n}|O_i-P_i||^j}{\sum_{i=1}^{n}|O_i - \overline{O}|^j}$$$

$$$\text{rNSE} =1-\frac{\sum_{i=1}^{n}(\frac{O_i-P_i}{\overline{O}})^2}{\sum_{i=1}^{n}(\frac{O_i - \overline{O}}{\overline{O}})^2}$$$

$$$d =1-\frac{\sum_{i=1}^{n}(P_i-O_i)^2}{\sum_{i=1}^{n}(|P_i-O_i|+|P_i+O_i|)^2}$$$

$$$md =1 - \frac{\sum_{i=1}^{n}(P_i-O_i)^j}{\sum_{i=1}^{n}(|P_i-O_i|+|P_i+O_i|)^j}$$$

$$$rd =1-\frac{\sum_{i=1}^{n}(\frac{P_i-O_i}{\overline{O}})^2}{\sum_{i=1}^{n}(\frac{|P_i-O_i|+|P_i+O_i|}{\overline{O}})^2}$$$

$$$\text{cp} =1-\frac{\sum_{i=2}^{n}(O_i-P_i)^2}{\sum_{i=1}^{n-1}(O_{i+1} - O_i)^2}$$$

$$$R =\frac{\sum_{i=1}^{n}(O_i-\overline{O})(P_i-\overline{P})}{\sqrt{\sum_{i=1}^{n}(O_i-\overline{O})^2}\sqrt{\sum_{i=1}^{n}(P_i-\overline{P})^2}) }$$$

$$$R^2 =(\frac{\sum_{i=1}^{n}(O_i-\overline{O})(P_i-\overline{P})}{\sqrt{\sum_{i=1}^{n}(O_i-\overline{O})^2}\sqrt{\sum_{i=1}^{n}(P_i-\overline{P})^2}) })^2$$$

$$$\text{bR2} =bR^2$$$

## Mathematics

$$$\frac{\text {d} x^\mu}{\text {d} x} = \mu x ^{\mu - 1}\\$$$

$$$\frac{\text {d} e^x}{\text {d} x} = e^x\\$$$

$$$\frac{\text {d} a^x}{\text {d} x} = a^x \ln a \\$$$

$$$\frac{\text {d} \ln x}{\text {d} x} = \frac{1}{x}\\$$$

$$$\frac{\text {d} \log _a x}{\text {d} x} = \frac{1}{x\ln a}\\$$$

$$$\frac{\text {d} \sin x}{\text {d} x} = \cos x\\$$$

$$$\frac{\text {d} \cos x}{\text {d} x} = - \sin x\\$$$

$$$\int k \text {d} x = kx + C$$$

$$$\int x ^ \mu \text {d} x = \frac{x^{\mu + 1}}{\mu + 1} + C\ (\mu \neq -1)$$$

$$$\int \frac{1}{x}\text {d} x = \ln \left | x \right | + C$$$

$$$\int \text {e} ^x \text {d} x = \text {e} ^x + C\\$$$

$$$\int a ^x \text {d} x = \frac{a^x}{\ln a}+ C\\$$$

$$$\int \frac{1}{1+x^2}\text {d} x = \arctan x + C\\$$$

$$$\int \frac{1}{1-x^2}\text {d} x = \arcsin x + C\\$$$

$$$\int \cos x \text {d} x = \sin x + C\\$$$

$$$\int \sin x \text {d} x = -\cos x + C\\$$$

$$$\int \frac{1}{\cos^2 x} \text {d} x = \tan x + C\\$$$

$$$\int \frac{1}{\sin^2 x} \text {d} x = -\cot x + C\\$$$

$$$\int \sec x \tan x \text {d} x = \sec x + C\\$$$

$$$\int \csc x \cot x \text {d} x = -\csc x + C\\$$$