rainfarmr

RainFARM logo

Stochastic precipitation downscaling with the RainFARM method.

rainfarmr is a R package implementing the RainFARM (Rainfall Filtered Autoregressive Model) stochastic precipitation downscaling method. Adapted for climate downscaling according to (D’Onofrio et al. 2018) and with fine-scale orographic weights (Terzago et al. 2018).

RainFARM (Rebora et al. 2006) is a metagaussian stochastic downscaling procedure based on the extrapolation of the coarse-scale Fourier power spectrum of a spatio-temporal precipitation field to small scales.

Example

# Make some sample synthetic rainfall data
# 10 fields of 8 by 8 pixel resolution
r <- exp(rnorm(8 * 8 * 10))
# The corresponding latitudes and longitudes
lon <- seq(5, 8.5, 0.5)
lat <- seq(43.5, 47, 0.5)
dim(r) <- c(8, 8, 10)
nf <- 8  # This is the factor by which we will increase resolution
# Downscale with spectral slope=1.7 to size 64x64
rd <- rainfarm(r, 1.7, nf, fsmooth = TRUE) 
# Get the corresponding fine-scale longitudes and latititudes
grid <- lon_lat_fine(lon, lat, nf)
grid$lon[1:4]
# [1] 4.78125 4.84375 4.90625 4.96875

References

Other languages

A julia version by the same author is available.

Authors:

R version - J. von Hardenberg, ISAC-CNR (2019)