From 79a372d5bb717a330f86a2f7a18d1daa10603a63 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Tue, 22 Oct 2024 09:50:49 +0100 Subject: [PATCH] Fix chelsa paths --- NEWS.md | 4 ++++ R/filenames_chelsa_future.R | 5 +++-- R/filenames_chelsa_present.R | 5 +++-- R/filenames_chelsa_trace21k.R | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 72b7d1d0..c586d7ee 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# pastclim dev +* Add delta downscaling functions +* Fix chelsa paths to match new URLs + # pastclim 2.1.0 * Add all CHELSA present and future datasets (including the use of virtual rasters to avoid downloading all data) * Add paleoclim at multiple resolutions diff --git a/R/filenames_chelsa_future.R b/R/filenames_chelsa_future.R index 61d7834a..dc9d02dc 100644 --- a/R/filenames_chelsa_future.R +++ b/R/filenames_chelsa_future.R @@ -32,14 +32,15 @@ filenames_chelsa_future <- function(dataset, bio_var){ } time_steps <- c("2011-2040","2041-2070","2071-2100") time_steps_underscore <- c("2011_2040","2041_2070","2071_2100") + chelsa_root <- "https://os.zhdk.cloud.switch.ch/chelsav2/GLOBAL/climatologies/" # compose download paths if (var_prefix=="bio"){ - chelsa_files <- paste0("https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/", + chelsa_files <- paste0(chelsa_root, time_steps,"/",dataset_parsed[3],"/",dataset_parsed[4],"/", var_prefix,"/CHELSA_",var_index,"_",time_steps,"_", tolower(dataset_parsed[3]),"_",dataset_parsed[4],"_V.2.1.tif") } else { - chelsa_files <- paste0("https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/", + chelsa_files <- paste0(chelsa_root, time_steps,"/",dataset_parsed[3],"/",dataset_parsed[4],"/", var_prefix,"/CHELSA_",tolower(dataset_parsed[3]), "_r1i1p1f1_w5e5_",dataset_parsed[4], "_",var_index, diff --git a/R/filenames_chelsa_present.R b/R/filenames_chelsa_present.R index dab75a06..9d6a1599 100644 --- a/R/filenames_chelsa_present.R +++ b/R/filenames_chelsa_present.R @@ -28,6 +28,7 @@ filenames_chelsa_present <- function(dataset, bio_var){ var_index <- paste0(var_prefix,"_",var_index) } # compose download paths - paste0("https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/1981-2010/", - var_prefix,"/CHELSA_",var_index,"_1981-2010_V.2.1.tif") + chelsa_root <- "https://os.zhdk.cloud.switch.ch/chelsav2/GLOBAL/climatologies/1981-2010/" +# chelsa_root <- "https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/1981-2010/" + paste0(chelsa_root, var_prefix,"/CHELSA_",var_index,"_1981-2010_V.2.1.tif") } \ No newline at end of file diff --git a/R/filenames_chelsa_trace21k.R b/R/filenames_chelsa_trace21k.R index 0da98f97..76efe194 100644 --- a/R/filenames_chelsa_trace21k.R +++ b/R/filenames_chelsa_trace21k.R @@ -35,6 +35,7 @@ filenames_chelsa_trace21k<- function(dataset, bio_var){ as.numeric(substr(bio_var,nchar(bio_var)-1,nchar(bio_var)))) } # create file names for a given variable - chelsa_trace_root <- "https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/chelsa_trace" + #chelsa_trace_root <- "https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/chelsa_trace" + chelsa_trace_root <- "https://os.zhdk.cloud.switch.ch/chelsav1/chelsa_trace" file.path(chelsa_trace_root, var_prefix, paste0("CHELSA_TraCE21k_",var_index,"_",yr_id,"_V",version,".tif")) } \ No newline at end of file