Downloads zip files (one per site) for available FLUXNET sites.
Usage
flux_download(
file_list_df = NULL,
site_ids = "all",
download_dir = "fluxnet",
overwrite = FALSE,
...
)Arguments
- file_list_df
When
NULL(default),flux_listall()is used to determine the sites with data available to download (specific sites can be selected withsite_ids). Iffile_list_dfis supplied, it should be a data frame generated byflux_listall(), but potentially filtered to exlude some rows. This provides an alternative way of downloading only specific sites. See the examples for a possible use case. Iffile_list_dfis notNULL,cache_dir,use_cache, andcache_agewill be ingored butsite_idsother than"all"will still be used.- site_ids
Character; either
"all"to download all sites available, or a vector of site IDs. For example,c("UK-GaB", "CA-Ca2").- download_dir
The directory to download zip files to.
- overwrite
Logical; overwrite already downloaded .zip files? If
FALSEit will skip downloading existing files, unless they are invalid .zip files (e.g. due to partial download or corruption).- ...
Arguments passed to
flux_listall().
Value
Invisibly returns a tibble with the download URL, path on disk, HTTP status code, and whether or not the download was successful.
Examples
if (FALSE) { # \dontrun{
# Download data for all available sites
flux_download()
# Download data for just select site IDs
flux_download(site_ids = c("UK-GaB", "CA-Ca2"))
# Download specific sites filtered by site metadata (IGPB and data hub for example)
available_sites <- flux_listall()
to_get <-
available_sites[available_sites$igbp == "CRO" & available_sites$data_hub == "AmeriFlux", ]
flux_download(file_list_df = to_get)
# Get a fresh list of available data and overwrite any existing downloads
flux_download(use_cache = FALSE, overwrite = FALSE)
} # }