| Type: | Package |
| Title: | 'CRU' 'CL' v. 2.0 Climatology Client |
| Version: | 2.0.0 |
| Description: | Provides functions that automate downloading and importing University of East Anglia Climate Research Unit ('CRU') 'CL' v. 2.0 climatology data, facilitates the calculation of minimum temperature and maximum temperature and formats the data into a data.table object or a 'terra' 'SpatRaster' object. 'CRU' 'CL' v. 2.0 data are a gridded climatology of 1961-1990 monthly means released in 2002 and cover all land areas (excluding Antarctica) at 10 arc minutes (0.1666667 degree) resolution. For more information see the description of the data provided by the University of East Anglia Climate Research Unit, https://crudata.uea.ac.uk/cru/data/hrg/tmc/readme.txt. |
| License: | MIT + file LICENSE |
| URL: | https://codeberg.org/ropensci/getCRUCLdata, https://docs.ropensci.org/getCRUCLdata/ |
| BugReports: | https://codeberg.org/ropensci/getCRUCLdata/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | brio, cli, data.table, fs, httr2, rlang, terra |
| Suggests: | knitr, R.utils, rmarkdown, roxygen2, roxyglobals, spelling, testthat, withr |
| VignetteBuilder: | knitr |
| ByteCompile: | TRUE |
| Config/Needs/build: | moodymudskipper/devtag |
| Config/roxygen2/version: | 8.0.0 |
| Config/roxyglobals/filename: | globals.R |
| Config/roxyglobals/unique: | FALSE |
| Config/roxylint: | list(linters = roxylint::tidy) |
| Config/testthat/edition: | 3 |
| Config/testthat/parallel: | true |
| Encoding: | UTF-8 |
| Language: | en-US |
| X-schema.org-applicationCategory: | Tools |
| X-schema.org-isPartOf: | https://ropensci.org |
| X-schema.org-keywords: | anglia-cru, climate-data, cru-cl2, temperature, rainfall, elevation, data-access, wind, relative-humidity, solar-radiation, diurnal-temperature, frost |
| NeedsCompilation: | no |
| Packaged: | 2026-05-16 11:48:48 UTC; adamsparks |
| Author: | Adam H. Sparks |
| Maintainer: | Adam H. Sparks <adamhsparks@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-05-20 09:10:02 UTC |
getCRUCLdata: 'CRU' 'CL' v. 2.0 Climatology Client
Description
Provides functions that automate downloading and importing University of East Anglia Climate Research Unit ('CRU') 'CL' v. 2.0 climatology data, facilitates the calculation of minimum temperature and maximum temperature and formats the data into a data.table object or a 'terra' 'SpatRaster' object. 'CRU' 'CL' v. 2.0 data are a gridded climatology of 1961-1990 monthly means released in 2002 and cover all land areas (excluding Antarctica) at 10 arc minutes (0.1666667 degree) resolution. For more information see the description of the data provided by the University of East Anglia Climate Research Unit, https://crudata.uea.ac.uk/cru/data/hrg/tmc/readme.txt.
Author(s)
Maintainer: Adam H. Sparks adamhsparks@gmail.com (ORCID)
Authors:
Adam H. Sparks adamhsparks@gmail.com (ORCID)
See Also
Useful links:
Report bugs at https://codeberg.org/ropensci/getCRUCLdata/issues
Add derived temperature values for TMAX and TMIN
Description
Add derived temperature values for TMAX and TMIN
Usage
.add_derived_dt(dt, vars)
Arguments
dt |
A data.table object of CRU data containing |
vars |
A named logical vector. |
Value
A data.table with tmin and or tmax cols.
Remove source vars if not requested
Description
If tmin or tmax are requested but tmp or dtr are not requested, this
function drops the unrequested vars.
Usage
.drop_source_vars_dt(dt, vars)
Arguments
dt |
A data.table object of CRU data containing |
vars |
A named logical vector. |
Value
A data.table with the unrequested var columns removed.
Create a data.table of CRU CL v. 2.0 climatology elements
Description
Automates importing CRU CL v.2.0 climatology data and from either the CRU server or local files and creates a data.table of the data. If requested, minimum and maximum temperature may also be calculated as described in the data readme.txt file and returned.
Usage
read_cru_dt(
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,
x = NULL
)
Arguments
pre |
Read precipitation (millimetres/month) and return it, |
pre_cv |
Read cv of precipitation (percent) and return it, |
rd0 |
Read wet-days (number days with >0.1 millimetres rain per
month) and return it, |
tmp |
Reads temperature (degrees Celsius) and return it, TRUE |
dtr |
Read mean diurnal temperature range (degrees Celsius)
and return it, |
reh |
Read relative humidity and return it, |
tmn |
Calculate minimum temperature values (degrees Celsius)
and return it, |
tmx |
Calculate maximum temperature (degrees Celsius) and return it,
|
sunp |
Read sunshine, percent of maximum possible (percent of
day length) and return it, |
frs |
Read ground-frost records (number of days with ground-
frost per month) and return it, |
wnd |
Read 10 m wind speed (metres/second) and return it, |
elv |
Read elevation (converted to metres) and return it, |
x |
An optional local file path where CRU CL v.2.0 .dat.gz files are located. If this is empty, the requested data will automatically be downloaded from the server. |
Value
A data.table::data.table object of CRU CL v. 2.0 climatology elements.
Nomenclature and Units
- pre
precipitation (millimetres/month)
- cv
cv of precipitation (percent)
- rd0
wet-days (number days with >0.1 millimetres 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 wind speed (metres/second)
- elv
elevation (automatically converted to metres from kilometres)
For more information see the description of the data provided by CRU, https://crudata.uea.ac.uk/cru/data/hrg/tmc/readme.txt
Author(s)
Adam H. Sparks, adamhsparks@gmail.com
Source
- pre
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_pre.dat.gz
- rd0
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_rd0.dat.gz
- tmp
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz
- dtr
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_dtr.dat.gz
- reh
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_reh.dat.gz
- sunp
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_sunp.dat.gz
- frs
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_frs.dat.gz
- wnd
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_wnd.dat.gz, areas originally including Antarctica are removed.
- elv
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_elv.dat.gz, values are converted from kilometres to metres.
This package crops all spatial outputs to an extent of ymin = -60, ymax = 85, xmin = -180, xmax = 180.
References
New, Mark, et al. "A high-resolution data set of surface climate over global land areas." Climate research 21.1 (2002): 1-25. https://crudata.uea.ac.uk/cru/data/hrg/tmc/new_et_al_10minute_climate_CR.pdf
See Also
Examples
# Create a data frame of temperature from locally available files in the
# tempdir() directory.
library(fs)
f <- path(path_temp(), "grid_10min_tmp.dat.gz")
download.file(
url = "https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz",
destfile = f
)
cru_tmp <- read_cru_dt(tmp = TRUE, x = f)
cru_tmp
# or downloading directly from the CRU server
cru_tmp <- read_cru_dt(tmp = TRUE)
cru_tmp
Create a terra SpatRaster object of CRU CL v. 2.0 climatology elements
Description
Create a terra::SpatRaster object or list of objects from CRU CL 2.0 data.
Usage
read_cru_rast(
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,
x = NULL
)
Arguments
pre |
Read precipitation (millimetres/month) and return it, |
pre_cv |
Read cv of precipitation (percent) and return it, |
rd0 |
Read wet-days (number days with >0.1 millimetres rain per
month) and return it, |
tmp |
Reads temperature (degrees Celsius) and return it, TRUE |
dtr |
Read mean diurnal temperature range (degrees Celsius)
and return it, |
reh |
Read relative humidity and return it, |
tmn |
Calculate minimum temperature values (degrees Celsius)
and return it, |
tmx |
Calculate maximum temperature (degrees Celsius) and return it,
|
sunp |
Read sunshine, percent of maximum possible (percent of
day length) and return it, |
frs |
Read ground-frost records (number of days with ground-
frost per month) and return it, |
wnd |
Read 10 m wind speed (metres/second) and return it, |
elv |
Read elevation (converted to metres) and return it, |
x |
An optional local file path where CRU CL v.2.0 .dat.gz files are located. If this is empty, the requested data will automatically be downloaded from the server. |
Value
A terra::SpatRaster object.
Nomenclature and Units
- pre
precipitation (millimetres/month)
- cv
cv of precipitation (percent)
- rd0
wet-days (number days with >0.1 millimetres 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 wind speed (metres/second)
- elv
elevation (automatically converted to metres from kilometres)
For more information see the description of the data provided by CRU, https://crudata.uea.ac.uk/cru/data/hrg/tmc/readme.txt
Author(s)
Adam H. Sparks, adamhsparks@gmail.com
Source
- pre
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_pre.dat.gz
- rd0
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_rd0.dat.gz
- tmp
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz
- dtr
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_dtr.dat.gz
- reh
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_reh.dat.gz
- sunp
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_sunp.dat.gz
- frs
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_frs.dat.gz
- wnd
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_wnd.dat.gz, areas originally including Antarctica are removed.
- elv
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_elv.dat.gz, values are converted from kilometres to metres.
This package crops all spatial outputs to an extent of ymin = -60, ymax = 85, xmin = -180, xmax = 180.
References
New, Mark, et al. "A high-resolution data set of surface climate over global land areas." Climate research 21.1 (2002): 1-25. https://crudata.uea.ac.uk/cru/data/hrg/tmc/new_et_al_10minute_climate_CR.pdf
See Also
Examples
# Create a data frame of temperature from locally available files in the
# tempdir() directory.
library(fs)
f <- path(path_temp(), "grid_10min_tmp.dat.gz")
download.file(
url = "https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz",
destfile = f
)
cru_tmp <- read_cru_rast(tmp = TRUE, x = f)
cru_tmp
# or downloading directly from the CRU server
cru_tmp <- read_cru_rast(tmp = TRUE)
cru_tmp