Minor shifts in atmospheric circulation can have major impacts on rainfall patterns in mountainous regions. This has important implications for crops such as coffee which are grown at altitude.

Rainfall derives from uplift of moist air. In mountainous areas, uplift is forced by terrain and so depends on the horizontal wind vector . The dependence of rainfall on wind direction is illustrated below for a fictitious range of hills (dashed contours indicate the hills).

The “upslope” model for rainfall () at location is:

(1)

is the gradient of the terrain height and is related to the saturated water vapour density. is the background rainfall rate.

In reality, Equation (2) is a poor approximation. Rain spreads downwind because there is a delay before raindrops can form, and another delay before fallout. Airflow dynamics also spreads the influence of an obstacle upwind. These effects can be included in a Fourier transformed version of equation (1):

(2)

is the Fourier transform of the terrain height and is a form factor which includes the effects of advection and mountain wave dynamics. Equation (2) reduces to the upslope model when .

*R*: Fast Fourier Transform & Rcpp

The figure illustrates orographic rainfall for a fictitious range of gaussian hills. It is very quick to compute (2) using Discrete FFT. If you use *R*, things can be speeded up by constructing the integrand in C++ using *Rcpp* before passing it to *fft*. This is very fast even for realistic landscapes.

R. Smith & I. Barstad,A linear theory of orographic precipitation, J. Atmos. Sci., 61, 1377–1391, (2004)