Skip to content

Commit

Permalink
Fix problem with variable name liquid_precipitation_duration_fraction
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrownf committed Nov 28, 2023
1 parent 8bc760f commit 2b23d6c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions R/check_args.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

check_var <- function(x){
valid_variables <- c("cloud_cover",
"liquid_precipitation_duration_fraction",
valid_variables <- c("Cloud-Cover",
"Precipitation-Rain-Duration-Fraction",
"snow_thickness_lwe",
"Solar-Radiation-Flux",
"Temperature-Air-2m",
Expand Down Expand Up @@ -69,7 +69,7 @@ check_temp_vars <- function(x){
check_vars_with_stat <- function(x){

vars_with_stat <- c("Temperature-Air-2m",
"cloud_cover",
#"Cloud_Cover",
"snow_thickness_lwe",
"2m_dewpoint_temperature",
"snow_thickness",
Expand Down
4 changes: 2 additions & 2 deletions R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#'@details
#'# Valid variable values
#'\itemize{
#'\item "cloud_cover"
#'\item "liquid_precipitation_duration_fraction"
#'\item "Cloud-Cover"
#'\item "Precipitation-Rain-Duration-Fraction"
#'\item "snow_thickness_lwe"
#'\item "Solar-Radiation-Flux"
#'\item "Temperature-Air-2m"
Expand Down
8 changes: 7 additions & 1 deletion R/get_file_path.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ get_file_path <- function(date_to_search, variable, statistic, time, path){
prefix <- paste0(prefix, "_C3S-glob-agric_AgERA5_")
}

if(isFALSE(check_vars_with_stat(variable)) && variable != "Relative-Humidity-2m"){
if(variable == "Cloud-Cover"){
prefix <- paste(variable, "Mean", sep = "-")

prefix <- paste0(prefix, "_C3S-glob-agric_AgERA5_")
}

if(isFALSE(check_vars_with_stat(variable)) && !variable %in% c("Relative-Humidity-2m", "Cloud-Cover")){
prefix <- paste0(variable, "_C3S-glob-agric_AgERA5_")
}

Expand Down
4 changes: 2 additions & 2 deletions man/ag5_extract.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2b23d6c

Please sign in to comment.