Hi everyone,
I've made some changes to get_terra (which is used by micro_era5 and micro_ncep for climate change scenarios) and micro_terra to enable you to have the data locally. This will get around failures to connect to the data by opendap, which can be a pain if you're running a big loop. I pushed the changes to the github repository so you'll need to reinstall it with
devtools::install_github('mrke/NicheMapR')
to use these changes. I'll put it in the new release which I'll finalise late next month.
The code below will download all the data (about 86 gigs) which you should then arrange into subfolders:
data
data_plus2
data_plus4
with the historical data going into 'data'. Then you can specify the folder that these subfolders are in as the 'terra_source' parameter in micro_ncep, micro_era5 and micro_terra (and 'source' for get_terra) and it will look there to find the files.
code for downloading:
vars <- c('ppt', 'soil', 'srad', 'tmax', 'tmin', 'vap', 'ws', 'vpd')
for(year in 1958:2021){
for(j in 1:length(vars)){
cmd <- paste0('wget -nc -c -nd
https://climate.northwestknowledge.net/TERRACLIMATE-DATA/TerraClimate_', vars[j], '_', year, '.nc')
system(cmd)
}
}
vars <- c('ppt', 'soil', 'srad', 'tmax', 'tmin', 'vpd')
for(year in 1985:2015){
for(j in 1:length(vars)){
cmd <- paste0('wget
http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data_plus4C/TerraClimate_4c_', vars[j], '_', year, '.nc')
system(cmd)
cmd <- paste0('wget
http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data_plus2C/TerraClimate_2c_', vars[j], '_', year, '.nc')
system(cmd)
}
}
All the best,
Mike