Automates 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. This function can be useful if you have network connection issues that mean automated downloading of the files using R does not work properly. In this instance it is recommended to use an FTP client (e.g., FileZilla), web browser or command line command (e.g., wget or curl) to download the files, save locally and use this function to import the data into R.

Nomenclature and units from readme.txt:

pre

precipitation (millimetres/month)

rd0

wet-days (number days with >0.1mm rain per month)

tmp

mean temperature (degrees Celsius)

dtr

mean diurnal temperature range (degrees Celsius)

reh

relative humidity (percent)

sunp

sunshine (percent of maximum possible (percent of day length))

frs

ground-frost (number of days with ground-frost per month)

wnd

10 metre windspeed (metres/second)

elv

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

create_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,
  dsn = ""
)

Arguments

pre

Logical. Fetch precipitation (millimetres/month) from server and return in the data frame? Defaults to FALSE.

pre_cv

Logical. Fetch cv of precipitation (percent) from server and return in the data frame? Defaults to FALSE. NOTE. Setting this to TRUE will always results in pre being set to TRUE and returned as well.

rd0

Logical. Fetch wet-days (number days with >0.1millimetres rain per month) and return in the data frame? Defaults to FALSE.

tmp

Logical. Fetch temperature (degrees Celsius) and return it in the data frame? Defaults to FALSE.

dtr

Logical. Fetch mean diurnal temperature range (degrees Celsius) and return it in the data frame? Defaults to FALSE.

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 FALSE.

tmx

Logical. Calculate maximum temperature (degrees Celsius) and return it in the data frame? Defaults to FALSE.

sunp

Logical. Fetch sunshine, percent of maximum possible (percent of day length) and return it in data frame? Defaults to FALSE.

frs

Logical. Fetch ground-frost records (number of days with ground- frost per month) and return it in data frame? Defaults to FALSE.

wnd

Logical. Fetch 10m wind speed (metres/second) and return it in the data frame? Defaults to FALSE.

elv

Logical. Fetch elevation (converted to metres) and return it in the data frame? Defaults to FALSE.

dsn

Local file path where CRU CL v.2.0 .dat.gz files are located.

Value

A tidy data frame of CRU CL v. 2.0 climatology elements as a tibble object

Note

This package automatically converts elevation values from kilometres to metres.

See also

Author

Adam H Sparks, adamhsparks@gmail.com

Examples

# \donttest{ # Create a data frame of temperature from locally available files in the # tempdir() directory. download.file( url = "https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz", destfile = file.path(tempdir(), "grid_10min_tmp.dat.gz") ) CRU_tmp <- create_CRU_df(tmp = TRUE, dsn = tempdir()) CRU_tmp
#> # A tibble: 6,795,144 x 4 #> lat lon month tmp #> <dbl> <dbl> <fct> <dbl> #> 1 -59.1 -26.6 jan 0.2 #> 2 -58.4 -26.2 jan 0.6 #> 3 -58.4 -26.4 jan 0.4 #> 4 -55.9 -67.2 jan 8 #> 5 -55.8 -67.2 jan 8.2 #> 6 -55.8 -67.4 jan 8 #> 7 -55.8 -67.6 jan 8.4 #> 8 -55.6 -67.4 jan 8.3 #> 9 -55.6 -67.6 jan 8.6 #> 10 -55.6 -68.1 jan 8.2 #> # … with 6,795,134 more rows
# }