Created
November 4, 2021 15:22
-
-
Save khufkens/e296102d224fa7393e306e5a7cfff660 to your computer and use it in GitHub Desktop.
Download Plumber 2 data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
# base html url | |
url <- "http://dapds00.nci.org.au/thredds/fileServer/ks32/CLEX_Data/PLUMBER2/v1-0/Flux/" | |
# catalogue | |
html_page = read_html("https://dap.nci.org.au/thredds/remoteCatalogService?catalog=http://dapds00.nci.org.au/thredds/catalog/ks32/CLEX_Data/PLUMBER2/v1-0/Flux/catalog.xml") | |
# grab files from the catalogue | |
files = html_page %>% | |
html_nodes("a") %>% | |
html_text() | |
# remove readme and stuff (only retain nc) | |
files <- files[grepl("*.nc",files)] | |
# set destination path | |
dest_path <- "~/data/plumber2" | |
# loop over all files | |
lapply(files, function(file){ | |
download.file(file.path(url, file), file.path(dest_path,file)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
update