Skip to content

Commit

Permalink
Update forecast_output_validator.R
Browse files Browse the repository at this point in the history
  • Loading branch information
rqthomas authored May 22, 2024
1 parent 4b091c8 commit 7609d82
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion R/forecast_output_validator.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
#' @export

forecast_output_validator <- function(forecast_file){

config <- yaml::read_yaml("https://raw.githubusercontent.com/eco4cast/neon4cast-ci/main/challenge_configuration.yaml")

allowed_combinations <- NULL
for(i in 1:length(config$variable_groups)){

curr_tibble <- data.frame(variable = unlist(config$variable_groups[i][[1]]$variable),
duration = unlist(config$variable_groups[i][[1]]$duration))

allowed_combinations <- rbind(allowed_combinations, curr_tibble)
}

file_in <- forecast_file

Expand All @@ -30,7 +40,18 @@ forecast_output_validator <- function(forecast_file){
usethis::ui_warn("missing the variable and prediction columns")
valid <- FALSE
}


unique_variables <- unique(out$variable)

for(i in 1:length(unique_variables)){
if (unique_variables[i] %in% allowed_combinations$variable) {
usethis::ui_done(paste0(unique_variables[i], " is a valid variable name"))
}
else {
usethis::ui_warn(paste0(unique_variables[i], " is not a valid variable name"))
}
}

if(lexists(out, "ensemble")){
usethis::ui_warn("ensemble dimension should be named parameter")
valid <- FALSE
Expand Down

0 comments on commit 7609d82

Please sign in to comment.