R/get_CRU_df.R
get_CRU_df.Rd
This function automates downloading and importing CRU CL v. 2.0 climatology data and creates a tidy data frame 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_df( 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 tidy data frame of CRU CL v. 2.0 climatology
elements as a tibble
object
This package automatically converts elevation values from kilometres to metres.
Adam H. Sparks, adamhsparks@gmail.com
# \donttest{ # Download data and create a data frame of precipitation and temperature # without caching the data files CRU_pre_tmp <- get_CRU_df(pre = TRUE, tmp = TRUE) head(CRU_pre_tmp)#> # A tibble: 6 x 5 #> lat lon month pre tmp #> <dbl> <dbl> <fct> <dbl> <dbl> #> 1 -59.1 -26.6 jan 105. 0.2 #> 2 -58.4 -26.4 jan 107. 0.4 #> 3 -58.4 -26.2 jan 106. 0.6 #> 4 -55.9 -67.2 jan 73.1 8 #> 5 -55.8 -67.6 jan 71.7 8.4 #> 6 -55.8 -67.4 jan 70.2 8#> # A tibble: 6,795,144 x 5 #> lat lon month pre tmp #> <dbl> <dbl> <fct> <dbl> <dbl> #> 1 -59.1 -26.6 jan 105. 0.2 #> 2 -58.4 -26.4 jan 107. 0.4 #> 3 -58.4 -26.2 jan 106. 0.6 #> 4 -55.9 -67.2 jan 73.1 8 #> 5 -55.8 -67.6 jan 71.7 8.4 #> 6 -55.8 -67.4 jan 70.2 8 #> 7 -55.8 -67.2 jan 68.7 8.2 #> 8 -55.6 -68.2 jan 73.8 8.4 #> 9 -55.6 -68.1 jan 71.6 8.2 #> 10 -55.6 -67.6 jan 66.5 8.6 #> # … with 6,795,134 more rows# }