Title: | '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 list of 'terra' 'rast' objects for use. '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>. |
Authors: | Adam H. Sparks [aut, cre] , Curtin University of Technology [cph] (Provided support through Adam Sparks's time.), Grains Research and Development Corporation [cph] (GRDC Project CUR2210-005OPX (AAGI-CU)) |
Maintainer: | Adam H. Sparks <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.2 |
Built: | 2025-01-17 03:52:51 UTC |
Source: | https://github.com/ropensci/getCRUCLdata |
Automates importing CRU CL v.2.0 climatology data and creates a data.table 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 using this function. This function can be useful if you have network connection issues that mean automated downloading of the files using R does not work properly.
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 ) 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 )
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 ) 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 )
pre |
Loads precipitation (millimetres/month) from server and
returns in the data frame, |
pre_cv |
Loads cv of precipitation (percent) from server and
returns in the data frame, |
rd0 |
Loads wet-days (number days with >0.1 millimetres rain per
month) and returns in the data frame, |
tmp |
Loads temperature (degrees Celsius) and returns it in the
data frame, |
dtr |
Loads mean diurnal temperature range (degrees Celsius)
and returns it in the data frame, |
reh |
Loads relative humidity and returns it in the data frame, |
tmn |
Calculate minimum temperature values (degrees Celsius)
and returns it in the data frame, |
tmx |
Calculate maximum temperature (degrees Celsius) and
return it in the data frame, |
sunp |
Loads sunshine, percent of maximum possible (percent of
day length) and returns it in the data frame, |
frs |
Loads ground-frost records (number of days with ground-
frost per month) and returns it in the data frame, |
wnd |
Load 10 m wind speed (metres/second) and returns it in the
data frame, |
elv |
Loads elevation (converted to metres) and returns it in
the data frame, |
dsn |
Local file path where CRU CL v.2.0 .dat.gz files are located. |
A data.table::data.table object of CRU CL v. 2.0 climatology elements.
precipitation (millimetres/month)
cv of precipitation (percent)
wet-days (number days with >0.1 millimetres 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
Adam H. Sparks, [email protected]
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_pre.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_rd0.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_dtr.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_reh.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_sunp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_frs.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_wnd.dat.gz, areas originally including Antarctica are removed.
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.
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
# 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
# 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
Automates importing CRU CL v.2.0 climatology data and creates a terra terra::rast object 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 using this function. This function can be useful if you have network connection issues that mean automated downloading of the files using R does not work properly.
create_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, dsn ) create_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, dsn )
create_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, dsn ) create_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, dsn )
pre |
Loads precipitation (millimetres/month) from server and
returns in the data frame, |
pre_cv |
Loads cv of precipitation (percent) from server and
returns in the data frame, |
rd0 |
Loads wet-days (number days with >0.1 millimetres rain per
month) and returns in the data frame, |
tmp |
Loads temperature (degrees Celsius) and returns it in the
data frame, |
dtr |
Loads mean diurnal temperature range (degrees Celsius)
and returns it in the data frame, |
reh |
Loads relative humidity and returns it in the data frame, |
tmn |
Calculate minimum temperature values (degrees Celsius)
and returns it in the data frame, |
tmx |
Calculate maximum temperature (degrees Celsius) and
return it in the data frame, |
sunp |
Loads sunshine, percent of maximum possible (percent of
day length) and returns it in the data frame, |
frs |
Loads ground-frost records (number of days with ground-
frost per month) and returns it in the data frame, |
wnd |
Load 10 m wind speed (metres/second) and returns it in the
data frame, |
elv |
Loads elevation (converted to metres) and returns it in
the data frame, |
dsn |
Local file path where CRU CL v.2.0 .dat.gz files are located. |
A base::list of terra::rast objects of CRU CL v. 2.0 climatology elements.
precipitation (millimetres/month)
cv of precipitation (percent)
wet-days (number days with >0.1 millimetres 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
Adam H. Sparks, [email protected]
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_pre.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_rd0.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_dtr.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_reh.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_sunp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_frs.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_wnd.dat.gz, areas originally including Antarctica are removed.
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.
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
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_stack(tmp = TRUE, dsn = tempdir()) CRU_tmp
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_stack(tmp = TRUE, dsn = tempdir()) CRU_tmp
This function automates downloading and importing CRU CL v. 2.0 climatology data and creates a data.table 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 this function.
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 ) 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 )
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 ) 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 |
Fetches precipitation (millimetres/month) from server and
returns it in the data frame, |
pre_cv |
Fetch cv of precipitation (percent) from server and
returns it in the data frame, |
rd0 |
Fetches wet-days (number days with >0.1 millimetres rain
per month) and returns it in the data frame? Defaults to |
tmp |
Fetches temperature (degrees Celsius) and returns it in the
data frame, |
dtr |
Fetches mean diurnal temperature range (degrees Celsius)
and returns it in the data frame? Defaults to |
reh |
Fetches relative humidity and returns it in the data frame,
|
tmn |
Calculates minimum temperature values (degrees Celsius)
and returns it in the data frame, |
tmx |
Calculates maximum temperature (degrees Celsius) and
returns it in the data frame, |
sunp |
Fetch sunshine, percent of maximum possible (percent of
day length) and return it in the data frame? Defaults to |
frs |
Fetches ground-frost records (number of days with ground-
frost per month) and return it in the data frame? Defaults to |
wnd |
Fetches 10m wind speed (metres/second) and returns it in the
data frame, |
elv |
Fetches elevation (converted to metres) and returns it in
the data frame, |
cache |
Stores CRU CL v. 2.0 data files locally for later use.
If |
A data.table::data.table object of CRU CL v. 2.0 climatology elements.
precipitation (millimetres/month)
cv of precipitation (percent)
wet-days (number days with >0.1 millimetres 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
Adam H. Sparks, [email protected]
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_pre.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_rd0.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_dtr.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_reh.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_sunp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_frs.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_wnd.dat.gz, areas originally including Antarctica are removed.
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.
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
create_CRU_stack, manage_cache.
# 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) CRU_pre_tmp
# 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) CRU_pre_tmp
This function automates downloading and importing CRU CL v. 2.0 climatology data into R and creates a list of terra terra::rast objects 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 using this function.
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 ) 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 )
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 ) 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 |
Fetches precipitation (millimetres/month) from server and
returns it in the data frame, |
pre_cv |
Fetch cv of precipitation (percent) from server and
returns it in the data frame, |
rd0 |
Fetches wet-days (number days with >0.1 millimetres rain
per month) and returns it in the data frame? Defaults to |
tmp |
Fetches temperature (degrees Celsius) and returns it in the
data frame, |
dtr |
Fetches mean diurnal temperature range (degrees Celsius)
and returns it in the data frame? Defaults to |
reh |
Fetches relative humidity and returns it in the data frame,
|
tmn |
Calculates minimum temperature values (degrees Celsius)
and returns it in the data frame, |
tmx |
Calculates maximum temperature (degrees Celsius) and
returns it in the data frame, |
sunp |
Fetch sunshine, percent of maximum possible (percent of
day length) and return it in the data frame? Defaults to |
frs |
Fetches ground-frost records (number of days with ground-
frost per month) and return it in the data frame? Defaults to |
wnd |
Fetches 10m wind speed (metres/second) and returns it in the
data frame, |
elv |
Fetches elevation (converted to metres) and returns it in
the data frame, |
cache |
Stores CRU CL v. 2.0 data files locally for later use.
If |
A base::list of terra::rast objects of CRU CL v. 2.0 climatology elements.
precipitation (millimetres/month)
cv of precipitation (percent)
wet-days (number days with >0.1 millimetres 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
Adam H. Sparks, [email protected]
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_pre.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_rd0.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_tmp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_dtr.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_reh.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_sunp.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_frs.dat.gz
https://crudata.uea.ac.uk/cru/data/hrg/tmc/grid_10min_wnd.dat.gz, areas originally including Antarctica are removed.
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.
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
create_CRU_stack, manage_cache.
# Download data and create a list of {terra} `rast` objects of precipitation # and temperature without caching the data files CRU_pre_tmp <- get_CRU_stack(pre = TRUE, tmp = TRUE) CRU_pre_tmp
# Download data and create a list of {terra} `rast` objects of precipitation # and temperature without caching the data files CRU_pre_tmp <- get_CRU_stack(pre = TRUE, tmp = TRUE) CRU_pre_tmp
Manage cached getCRUCLdata files with hoardr.
The default cache directory is
tools::R_user_dir(package = "getCRUCLdata")
, but you can set your own path
using manage_cache$cache_path_set()
.
manage_cache$cache_delete
only accepts one file name, while
manage_cache$cache_delete_all
does not accept any names, but deletes all files. For deleting many specific
files, use manage_cache$cache_delete
in an base::lapply type call.
manage_cache$cache_path_get()
get cache path
manage_cache$cache_path_set()
set cache path
manage_cache$list()
returns a character vector of full path file names
manage_cache$files()
returns file objects with metadata
manage_cache$details()
returns files with details
manage_cache$delete()
delete specific files
manage_cache$delete_all()
delete all files, returns nothing
Adam H. Sparks, [email protected]
## Not run: # list files in cache manage_cache$list() # delete certain database files manage_cache$delete("file path") manage_cache$list() # delete all files in cache manage_cache$delete_all() manage_cache$list() # set a different cache path from the default manage_cache$cache_path_set("~/tmp") ## End(Not run)
## Not run: # list files in cache manage_cache$list() # delete certain database files manage_cache$delete("file path") manage_cache$list() # delete all files in cache manage_cache$delete_all() manage_cache$list() # set a different cache path from the default manage_cache$cache_path_set("~/tmp") ## End(Not run)