R/get_CRU_stack.R
get_CRU_stack.Rd
This function automates downloading and importing CRU CL v. 2.0 climatology data into R and creates a list of raster stacks of the data. If requested, minimum and maximum temperature may also be automatically calculated as described in the data readme.txt file. Data may be cached for later use by this function, saving time downloading files in future use of the function.
Nomenclature and units from readme.txt:
precipitation (millimetres/month)
wet-days (number days with >0.1mm rain per month)
mean temperature (degrees Celsius)
mean diurnal temperature range (degrees Celsius)
relative humidity (percent)
sunshine (percent of maximum possible (percent of day length))
ground-frost (number of days with ground-frost per month)
10 metre windspeed (metres/second)
elevation (automatically converted to metres)
For more information see the description of the data provided by CRU, https://crudata.uea.ac.uk/cru/data/hrg/tmc/readme.txt
get_CRU_stack( pre = FALSE, pre_cv = FALSE, rd0 = FALSE, tmp = FALSE, dtr = FALSE, reh = FALSE, tmn = FALSE, tmx = FALSE, sunp = FALSE, frs = FALSE, wnd = FALSE, elv = FALSE, cache = FALSE )
pre | Logical. Fetch precipitation (millimetres/month) from server and
return in the data frame? Defaults to |
---|---|
pre_cv | Logical. Fetch cv of precipitation (percent) from server and
return in the data frame? Defaults to |
rd0 | Logical. Fetch wet-days (number days with >0.1millimetres rain
per month) and return in the data frame? Defaults to |
tmp | Logical. Fetch temperature (degrees Celsius) and return it in the
data frame? Defaults to |
dtr | Logical. Fetch mean diurnal temperature range (degrees Celsius)
and return it in the data frame? Defaults to |
reh | Logical. Fetch relative humidity and return it in the data frame? Defaults to FALSE. |
tmn | Logical. Calculate minimum temperature values (degrees Celsius)
and return it in the data frame? Defaults to |
tmx | Logical. Calculate maximum temperature (degrees Celsius) and
return it in the data frame? Defaults to |
sunp | Logical. Fetch sunshine, percent of maximum possible (percent of
day length) and return it in data frame? Defaults to |
frs | Logical. Fetch ground-frost records (number of days with ground-
frost per month) and return it in data frame? Defaults to |
wnd | Logical. Fetch 10m wind speed (metres/second) and return it in
the data frame? Defaults to |
elv | Logical. Fetch elevation (converted to metres) and return it in
the data frame? Defaults to |
cache | Logical. Store CRU CL v. 2.0 data files locally for later use?
If |
A list
of raster
stack
objects of CRU CL v. 2.0 climatology elements
This package automatically converts elevation values from kilometres to metres.
This package crops all spatial outputs to an extent of ymin = -60, ymax = 85, xmin = -180, xmax = 180. Note that the original wind data include land area for parts of Antarctica, these data are excluded in the raster stacks generated by this function.
Adam H. Sparks, adamhsparks@gmail.com
# \donttest{ # Download data and create a raster stack of precipitation and temperature # without caching the data files CRU_pre_tmp <- get_CRU_stack(pre = TRUE, tmp = TRUE) CRU_pre_tmp#> $pre #> class : RasterBrick #> dimensions : 870, 2160, 1879200, 12 (nrow, ncol, ncell, nlayers) #> resolution : 0.1666667, 0.1666667 (x, y) #> extent : -180, 180, -60, 85 (xmin, xmax, ymin, ymax) #> crs : +proj=longlat +datum=WGS84 #> source : memory #> names : jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec #> min values : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 #> max values : 910.1, 824.3, 727.3, 741.3, 1100.0, 2512.6, 2505.5, 1799.4, 849.8, 851.6, 843.7, 733.3 #> #> #> $tmp #> class : RasterBrick #> dimensions : 870, 2160, 1879200, 12 (nrow, ncol, ncell, nlayers) #> resolution : 0.1666667, 0.1666667 (x, y) #> extent : -180, 180, -60, 85 (xmin, xmax, ymin, ymax) #> crs : +proj=longlat +datum=WGS84 #> source : memory #> names : jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec #> min values : -51.6, -47.6, -45.2, -36.6, -22.2, -16.3, -14.0, -17.3, -26.4, -36.3, -41.6, -49.0 #> max values : 32.5, 32.1, 32.4, 34.3, 36.0, 38.3, 37.8, 36.8, 34.8, 32.8, 32.4, 32.2 #> #># }