Skip to content

Commit

Permalink
add min and max temp
Browse files Browse the repository at this point in the history
  • Loading branch information
dramanica committed Apr 22, 2024
1 parent ace072e commit f82dd43
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/filenames_chelsa_present.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ filenames_chelsa_present <- function(dataset, bio_var){
if ("bio"== substr(bio_var,1,3)){
var_prefix <- "bio"
var_index <- paste0(var_prefix,as.numeric(var_index)) # strip leading 0
} else if ("tem" == substr(bio_var,1,3)){
} else if (length(grep(pattern="temperature_min",bio_var))){
var_prefix <- "tasmin"
var_index <- paste0(var_prefix,"_",var_index)
} else if (length(grep(pattern="temperature_max",bio_var)) ){
var_prefix <- "tasmax"
var_index <- paste0(var_prefix,"_",var_index)

} else if (length(grep(pattern="temperature_",bio_var))){
var_prefix <- "tas"
var_index <- paste0(var_prefix,"_",var_index)
var_index <- paste0(var_prefix,"_",var_index)
} else if ("pre" == substr(bio_var,1,3)){
var_prefix <- "pr"
var_index <- paste0(var_prefix,"_",var_index)
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
24 changes: 24 additions & 0 deletions data-raw/data_files/dataset_list_included.csv
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,30 @@ precipitation_09,precipitation_09,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_prec_09_v
precipitation_10,precipitation_10,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_prec_10_v1.0.0.vrt,,download_chelsa,,,1.0.0,precipitation Oct,P Oct,october,mm per month,*mm~mo^-1*,
precipitation_11,precipitation_11,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_prec_11_v1.0.0.vrt,,download_chelsa,,,1.0.0,precipitation Nov,P Nov,november,mm per month,*mm~mo^-1*,
precipitation_12,precipitation_12,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_prec_12_v1.0.0.vrt,,download_chelsa,,,1.0.0,precipitation Dec,P Dec,december,mm per month,*mm~mo^-1*,
temperature_max_01,temperature_max_01,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_01_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Jan,max T Jan,january,degrees Celsius,*degree*C*,
temperature_max_02,temperature_max_02,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_02_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Feb,max T Feb,february,degrees Celsius,*degree*C*,
temperature_max_03,temperature_max_03,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_03_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Mar,max T Mar,march,degrees Celsius,*degree*C*,
temperature_max_04,temperature_max_04,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_04_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Apr,max T Apr,april,degrees Celsius,*degree*C*,
temperature_max_05,temperature_max_05,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_05_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature May,max T May,may,degrees Celsius,*degree*C*,
temperature_max_06,temperature_max_06,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_06_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Jun,max T Jun,june,degrees Celsius,*degree*C*,
temperature_max_07,temperature_max_07,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_07_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Jul,max T Jul,july,degrees Celsius,*degree*C*,
temperature_max_08,temperature_max_08,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_08_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Aug,max T Aug,august,degrees Celsius,*degree*C*,
temperature_max_09,temperature_max_09,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_09_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Sep,max T Sep,september,degrees Celsius,*degree*C*,
temperature_max_10,temperature_max_10,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_10_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Oct,max T Oct,october,degrees Celsius,*degree*C*,
temperature_max_11,temperature_max_11,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_11_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Nov,max T Nov,november,degrees Celsius,*degree*C*,
temperature_max_12,temperature_max_12,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_max_12_v1.0.0.vrt,,download_chelsa,,,1.0.0,max temperature Dec,max T Dec,december,degrees Celsius,*degree*C*,
temperature_min_01,temperature_min_01,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_01_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Jan,min T Jan,january,degrees Celsius,*degree*C*,
temperature_min_02,temperature_min_02,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_02_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Feb,min T Feb,february,degrees Celsius,*degree*C*,
temperature_min_03,temperature_min_03,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_03_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Mar,min T Mar,march,degrees Celsius,*degree*C*,
temperature_min_04,temperature_min_04,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_04_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Apr,min T Apr,april,degrees Celsius,*degree*C*,
temperature_min_05,temperature_min_05,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_05_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature May,min T May,may,degrees Celsius,*degree*C*,
temperature_min_06,temperature_min_06,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_06_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Jun,min T Jun,june,degrees Celsius,*degree*C*,
temperature_min_07,temperature_min_07,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_07_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Jul,min T Jul,july,degrees Celsius,*degree*C*,
temperature_min_08,temperature_min_08,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_08_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Aug,min T Aug,august,degrees Celsius,*degree*C*,
temperature_min_09,temperature_min_09,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_09_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Sep,min T Sep,september,degrees Celsius,*degree*C*,
temperature_min_10,temperature_min_10,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_10_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Oct,min T Oct,october,degrees Celsius,*degree*C*,
temperature_min_11,temperature_min_11,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_11_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Nov,min T Nov,november,degrees Celsius,*degree*C*,
temperature_min_12,temperature_min_12,CHELSA_2.1_0.5m,TRUE,CHELSA_2.1_0.5m_temp_min_12_v1.0.0.vrt,,download_chelsa,,,1.0.0,min temperature Dec,min T Dec,december,degrees Celsius,*degree*C*,
bio01,bio01,CHELSA_2.1_0.5m_vsi,FALSE,CHELSA_2.1_0.5m_bio01_v1.0.0_vsi.vrt,,download_chelsa,,,1.0.0,annual mean temperature,ann. mean T,year,degrees Celsius,*degree*C*,
bio02,bio02,CHELSA_2.1_0.5m_vsi,FALSE,CHELSA_2.1_0.5m_bio02_v1.0.0_vsi.vrt,,download_chelsa,,,1.0.0,mean diurnal range,diurn. range,year,degrees Celsius,*degree*C*,
bio03,bio03,CHELSA_2.1_0.5m_vsi,FALSE,CHELSA_2.1_0.5m_bio03_v1.0.0_vsi.vrt,,download_chelsa,,,1.0.0,isothermality,isothermality,year,,,
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test_filenames_chelsa_present.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ test_that("filenames_chelsa_present are correct", {
expect_true(url_is_valid(bio_files))
bio_files <- filenames_chelsa_present(bio_var = "precipitation_09")
expect_true(url_is_valid(bio_files))
bio_files <- filenames_chelsa_present(bio_var = "temperature_min_09")
expect_true(url_is_valid(bio_files))
bio_files <- filenames_chelsa_present(bio_var = "temperature_max_09")
expect_true(url_is_valid(bio_files))
}
)

0 comments on commit f82dd43

Please sign in to comment.