fetch_ad: Fetch AREAdata dataset
Description
Retrieve AREAdata dataset/s specified by metric and spatial scale (GID).
Usage
fetch_ad(
metric = "temp",
gid = 0,
use_cache = TRUE,
cache_location = NULL,
refresh_cache = FALSE,
timeout = 240,
basereq = ad_basereq()
)
Value
A ohvbd.ad.matrix of the requested data (with added attributes for gid and metric).
Arguments
- metric
the metric to retrieve from areadata.
- gid
the spatial scale to retrieve (0 = country-level, 1=province-level ...).
- use_cache
load files from cache if possible, and save them if not present.
- cache_location
path to cache location (defaults to a temporary user directory, or one set by set_default_ohvbd_cache()).
- refresh_cache
force a refresh of the relevant cached data (and enables use_cache).
- timeout
timeout for data download from figshare/github in seconds.
- basereq
the url of the AREAdata database (usually generated by ad_basereq()). If NA, uses the default.
Valid metrics
The following metrics are valid (alternative names are listed in brackets):
temp (temperature)
spechumid (specific humidity)
relhumid (relative humidity)
uv (ultraviolet)
precip (precipitation, rainfall)
popdens (population density, population)
forecast (future climate, future)
Examples
Run this codeif (FALSE) { # interactive()
fetch_ad(metric="temp", gid=0)
}
Run the code above in your browser using DataLab