View source: R/create_CRU_stack.R
create_CRU_stack | R Documentation |
Automates importing CRU CL v.2.0 climatology
data and creates a terra
rast
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.
Nomenclature and units from readme.txt:
precipitation (millimetres/month)
cv of precipitation (percent)
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
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 |
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 |
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 |
dsn |
Local file path where CRU CL v.2.0 .dat.gz files are located. |
A list
of terra
rast
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 terra rast objects generated by this function.
Adam H. Sparks, adamhsparks@gmail.com
get_CRU_stack
# Create a terra rast object of temperature from tmp 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_stack(tmp = TRUE, dsn = tempdir())
CRU_tmp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.