From 03b704283c5e42d93bdbd2a319cdd013e4fbb9cd Mon Sep 17 00:00:00 2001 From: Samuel Viana-Jimenez Date: Mon, 8 Jan 2024 12:05:48 +0000 Subject: [PATCH] First set of changes to make these scripts compatible with the tagged new version of harp (0.2.0). It has been tested under ATOS with a conda environment for producing rds (point_verif.R) and collection of verification figures (point_verif_local.R) for the Spain_202205 case. --- R/point_verif/point_verif.R | 51 ++++++------ R/point_verif/point_verif_local.R | 58 +++++++------- R/visualization/fn_plot_aux_scores.R | 66 ++++++++-------- R/visualization/fn_plot_helpers.R | 40 +++++----- R/visualization/fn_plot_point_verif.R | 107 +++++++++++++------------- config/config_atos.R | 27 ++++--- config/config_atos.sh | 2 +- config/config_atos.yml_Spain_202205 | 26 ++++--- 8 files changed, 193 insertions(+), 184 deletions(-) diff --git a/R/point_verif/point_verif.R b/R/point_verif/point_verif.R index b8c5383..5dc5c1c 100755 --- a/R/point_verif/point_verif.R +++ b/R/point_verif/point_verif.R @@ -73,18 +73,15 @@ run_verif <- function(prm_info, prm_name) { # Read the forecast fcst <- read_point_forecast( - start_date = start_date, - end_date = end_date, - fcst_model = fcst_model, - fcst_type = fcst_type, - parameter = prm_name, - lead_time = lead_time, - lags = lags, - by = by_step, - file_path = fcst_path, - vertical_coordinate = vertical_coordinate - ) - + dttm=seq_dttm(start_date,end_date,by_step), + fcst_model = fcst_model, + fcst_type = fcst_type, + parameter = prm_name, + lead_time = lead_time, + lags = lags, + file_path = fcst_path, + vertical_coordinate = vertical_coordinate + ) # Find the common cases - for upper air parmeters we need to ensure # that the level column is included in the check fcst <- switch( @@ -98,38 +95,39 @@ run_verif <- function(prm_info, prm_name) { # function with a named list containing the arguments. if (!is.null(prm_info$scale_fcst)) { fcst <- do.call( - scale_point_forecast, - c(list(.fcst = fcst), prm_info$scale_fcst)) + scale_param,list(fcst, prm_info$scale_obs$scaling, prm_info$scale_obs$new_units, prm_info$scale_obs$mult) + ) } # Read the observations getting the dates and stations from # the forecast obs <- read_point_obs( - start_date = first_validdate(fcst), - end_date = last_validdate(fcst), + #dttm=seq_dttm(start_date,end_date,by_step), + dttm=unique_valid_dttm(fcst), parameter = prm_name, obs_path = obs_path, - stations = pull_stations(fcst), + stations = unique_stations(fcst), vertical_coordinate = vertical_coordinate - ) - + ) # optional rescaling of observations using the scale_obs part of the # params list. We use do.call to call the scale_point_forecast # function with a named list containing the arguments. - if (!is.null(prm_info$scale_obs)) { + if (!is.null(prm_info$scale_obs)) { obs <- do.call( - scale_point_obs, - c(list(.obs = obs, parameter = prm_name), prm_info$scale_obs) + scale_param, list(obs, prm_info$scale_obs$scaling, prm_info$scale_obs$new_units, prm_info$scale_obs$mult, col = {{prm_name}}) ) } # Join observations to the forecast - fcst <- join_to_fcst(fcst, obs) + fcst <- join_to_fcst(fcst, obs, force=TRUE) + #Note by Samuel: Some stop clause is needed here if any of the models + #intersects 0 with the observations' SIDS + # Check for errors removing obs that are more than a certain number # of standard deviations from the forecast. You could add a number # of standard deviations to use in the params list fcst <- check_obs_against_fcst(fcst, prm_name) - + # Make sure that grps is a list so that it adds on the vertical # coordinate group correctly if (!is.list(grps)) { @@ -168,15 +166,14 @@ print(params) # Use possibly from the purrr package to allow the script to continue # if it fails for a parameter - it returns NULL if it fails. See # ?safely and ?quietly if you want to retain the errors. -possible_run_verif <- possibly(run_verif, otherwise = NULL) -print(possible_run_verif) +possible_run_verif <- safely(run_verif, otherwise = NULL, quiet= FALSE) # Use imap from the purrr package to map each element of the params list # to the possible_run_verif function. imap passes the element of the list # as the first argument and the name of the element as the second. verif <- imap(params, possible_run_verif) -# This will be addd in the visualization part +# This will be added in the visualization part # You can open the results in a shiny app using # shiny_plot_point_verif(verif_path) diff --git a/R/point_verif/point_verif_local.R b/R/point_verif/point_verif_local.R index 4368a21..794beba 100755 --- a/R/point_verif/point_verif_local.R +++ b/R/point_verif/point_verif_local.R @@ -13,6 +13,8 @@ library(RColorBrewer) # Some colourmaps (some of which are colourblind friendly) library(gridExtra) # For grid arrange library(grid) # For grid arrange library(pracma) # For logseq +library(boomer) +library(mapproj) ### source(Sys.getenv('CONFIG_R')) @@ -46,6 +48,7 @@ params <- CONFIG$params_details start_date <- ifelse(is.null(args$start_date),CONFIG$shared$start_date,args$start_date) end_date <- ifelse(is.null(args$end_date),CONFIG$shared$end_date,args$end_date) by_step <- CONFIG$verif$by_step #Read from config file +by_obs_step <- CONFIG$verif$by_obs_step #Read from config file fcst_model <- CONFIG$verif$fcst_model lead_time_str <- CONFIG$verif$lead_time lead_time <- eval(parse(text = lead_time_str)) @@ -57,8 +60,8 @@ verif_path <- CONFIG$verif$verif_path grps <- CONFIG$verif$grps plot_output <- CONFIG$post$plot_output # Load in png archive directory -# Verif results by leadtime for each fcst_cycle (should be default choice?) -grps <- list(c("leadtime","fcst_cycle"),"leadtime") +# Verif results by lead_time for each fcst_cycle (should be default choice?) +grps <- list(c("lead_time","fcst_cycle"),"lead_time") # Useful functions # This does some renaming of groups (those with NA or "00;12", etc.) @@ -114,14 +117,12 @@ run_verif <- function(prm_info, prm_name) { # Read the forecast fcst <- read_point_forecast( - start_date = start_date, - end_date = end_date, + dttm=seq_dttm(start_date,end_date,by_step), fcst_model = fcst_model, fcst_type = fcst_type, parameter = prm_name, lead_time = lead_time, lags = lags, - by = by_step, file_path = fcst_path, get_lat_and_lon = TRUE, # Useful when lat/lon missing from vobs files vertical_coordinate = vertical_coordinate @@ -140,18 +141,17 @@ run_verif <- function(prm_info, prm_name) { # function with a named list containing the arguments. if (!is.null(prm_info$scale_fcst)) { fcst <- do.call( - scale_point_forecast, - c(list(.fcst = fcst), prm_info$scale_fcst)) + scale_param,list(fcst, prm_info$scale_obs$scaling, prm_info$scale_obs$new_units, prm_info$scale_obs$mult) + ) } # Read the observations getting the dates and stations from # the forecast obs <- read_point_obs( - start_date = first_validdate(fcst), - end_date = last_validdate(fcst), + dttm=seq_dttm(start_date,end_date,by_obs_step), parameter = prm_name, obs_path = obs_path, - stations = pull_stations(fcst), + stations = unique_stations(fcst), min_allowed = prm_info$obsmin_val, # If obsmin/max not set, reverts to default max_allowed = prm_info$obsmax_val, vertical_coordinate = vertical_coordinate @@ -162,8 +162,7 @@ run_verif <- function(prm_info, prm_name) { # function with a named list containing the arguments. if (!is.null(prm_info$scale_obs)) { obs <- do.call( - scale_point_obs, - c(list(.obs = obs, parameter = prm_name), prm_info$scale_obs) + scale_param, list(obs, prm_info$scale_obs$scaling, prm_info$scale_obs$new_units, prm_info$scale_obs$mult, col = {{prm_name}}) ) } @@ -188,8 +187,9 @@ run_verif <- function(prm_info, prm_name) { ) # add valid_hour to fcst - #fcst <- mutate_list(fcst,valid_hour=substr(YMDh(validdate),9,10)) - fcst <- expand_date(fcst,validdate) # Add in valid_year, valid_month, valid_day, valid_hour + #fcst <- mutate_list(fcst,valid_hour=substr(YMDh(valid_dttm),9,10)) + fcst <- expand_date(fcst,valid_dttm) # Add in valid_year, valid_month, valid_day, valid_hour + #fcst <- rig(expand_date)(fcst,valid_dttm) # Add in valid_year, valid_month, valid_day, valid_hour fcst <- mutate_list(fcst,valid_hour = sprintf("%02d",valid_hour)) # Convert to character and pad # Remove stations that only occur very infrequently (for surface variables only) if (is.na(vertical_coordinate)){ @@ -226,28 +226,29 @@ run_verif <- function(prm_info, prm_name) { ) verif <- fn_verif_rename(verif) verif_toplot <- verif # Used for passing to plotting script (as it may be modified below) - verif_toplot[[2]][["leadtime"]] <- as.character(verif_toplot[[2]][["leadtime"]]) # For plotting purposes + verif_toplot[[2]][["lead_time"]] <- as.character(verif_toplot[[2]][["lead_time"]]) # For plotting purposes + # Do some additional verif depending on UA parameter if (!is.na(vertical_coordinate)){ # Group by valid_hour for profiles (threshold scores not required) - grps_vh <- lapply(grps_c,function(x) gsub("leadtime","valid_hour",x)) + grps_vh <- lapply(grps_c,function(x) gsub("lead_time","valid_hour",x)) verif_vh <- get(verif_fn)( fcst, prm_name, thresholds = NULL, groupings = grps_vh ) verif_vh <- fn_verif_rename(verif_vh) } else { - # Compute scores as a function of validdate (should take the same format as default leadtime groups) + # Compute scores as a function of valid_dttm (should take the same format as default lead_time groups) # Assuming threshold scores are not required - grps_vd <- lapply(grps_c,function(x) gsub("leadtime","validdate",x)) + grps_vd <- lapply(grps_c,function(x) gsub("lead_time","valid_dttm",x)) verif_vd <- get(verif_fn)( fcst, prm_name, thresholds = NULL, groupings = grps_vd ) verif_vd <- fn_verif_rename(verif_vd) - + # Compute scores for each station for map purposes - grps_sid <- lapply(grps_c,function(x) gsub("leadtime","SID",x)) + grps_sid <- lapply(grps_c,function(x) gsub("lead_time","SID",x)) # Replace fcst_cycle by valid_hour if ("fcst_cycle" %in% grps_sid[[1]]){ grps_sid <- lapply(grps_sid,function(x) gsub("fcst_cycle","valid_hour",x)) @@ -263,12 +264,12 @@ run_verif <- function(prm_info, prm_name) { verif_sid <- fn_verif_rename(verif_sid) # Need to add lat/lon to the SIDs verif_sid <- fn_sid_latlon(verif_sid,fcst) - - # Flag to compute the standard threshold scores over all leadtimes and add + + # Flag to compute the standard threshold scores over all lead_times and add alllt_thresholds <- TRUE if (alllt_thresholds){ - # Compute threshold scores over all leadtimes (as done in Monitor) (retain default group structure) - grps_nolt <- lapply(grps_c,function(x) x[x != "leadtime"]) + # Compute threshold scores over all lead_times (as done in Monitor) (retain default group structure) + grps_nolt <- lapply(grps_c,function(x) x[x != "lead_time"]) grps_nolt <- grps_nolt[lapply(grps_nolt,length)>0] # Note: This will remove character(0) entries but will miss the "All" option for fcst_cycle etc. # Hence we add a NULL below (NB: this may not be required with updated version of harp) @@ -277,10 +278,10 @@ run_verif <- function(prm_info, prm_name) { fcst, prm_name, thresholds = prm_info$thresholds, groupings = grps_nolt ) verif_alllt <- fn_verif_rename(verif_alllt) - # Add in indication that we use all leadtimes (important for plotting script and for binding below) - verif_alllt <- mutate_list(verif_alllt,leadtime = "All") + # Add in indication that we use all lead_times (important for plotting script and for binding below) + verif_alllt <- mutate_list(verif_alllt,lead_time = "All") - print("Adding threshold scores over all leadtimes") + print("Adding threshold scores over all lead_times") # Bind rows will match the column names verif_toplot[[2]] <- bind_rows(verif_toplot[[2]],verif_alllt[[2]]) } @@ -306,7 +307,8 @@ run_verif <- function(prm_info, prm_name) { # Use possibly from the purrr package to allow the script to continue # if it fails for a parameter - it returns NULL if it fails. See # ?safely and ?quietly if you want to retain the errors. -possible_run_verif <- possibly(run_verif, otherwise = NULL) +#possibly(run_verif, otherwise = NULL) +possible_run_verif <- safely(run_verif, otherwise = NULL, quiet= FALSE) #possible_run_verif <- run_verif #print(possible_run_verif) diff --git a/R/visualization/fn_plot_aux_scores.R b/R/visualization/fn_plot_aux_scores.R index 39a4e5f..256526d 100755 --- a/R/visualization/fn_plot_aux_scores.R +++ b/R/visualization/fn_plot_aux_scores.R @@ -37,15 +37,15 @@ fn_plot_aux_scores <- function(fcst_input,png_archive,station_group_var = "stati if (fcst_type == "ens"){ # Add in ensemble mean and spread fcst <- ens_stats(fcst_input) - fcst <- bind_fcst(fcst) # Can take a while + fcst <- bind(fcst) # Can take a while fcst_names <- names(fcst) - # TODO: Check in latest version of harp if the same behaviour occurs. When you bind_fcst after using ens_stats, + # TODO: Check in latest version of harp if the same behaviour occurs. When you bind() after using ens_stats, # the mean and spread are added on as columns ens_mean/spread (these repeat for each member). Thus do some manipulation here # to add the mean/spread to the "member" column to tidy things up # TODO: Possibly this is not recommended...may have to revisit df_meanspread <- NULL for (c_model in models_vec){ - df_tmp <- fcst %>% filter(mname == c_model); members_tmp <- unique(df_tmp[["member"]]) + df_tmp <- fcst %>% filter(fcst_model == c_model); members_tmp <- unique(df_tmp[["member"]]) df_tmp <- df_tmp %>% filter(member == members_tmp[1]) df_mean <- df_tmp %>% mutate(member = "mean",forecast = ens_mean) df_spread <- df_tmp %>% mutate(member = "spread",forecast = ens_spread) @@ -54,14 +54,14 @@ fn_plot_aux_scores <- function(fcst_input,png_archive,station_group_var = "stati fcst <- bind_rows(fcst,df_meanspread); fcst <- select(fcst,-ens_mean,-ens_spread) rm(df_tmp,members_tmp,df_mean,df_spread,df_meanspread) } else if (fcst_type == "det"){ - fcst <- bind_fcst(fcst_input) + fcst <- bind(fcst_input) fcst_names <- names(fcst) } # Add in validhour and station group if they do not exist if (!("valid_hour" %in% fcst_names)){ - #fcst <- mutate(fcst,validhour=substr(YMDh(validdate),9,10)) - fcst <- expand_date(fcst,validdate) + #fcst <- mutate(fcst,validhour=substr(YMDh(valid_dttm),9,10)) + fcst <- expand_date(fcst,valid_dttm) fcst <- mutate_list(fcst,valid_hour = sprintf("%02d",valid_hour)) } if (!(station_group_var %in% fcst_names)){ @@ -74,8 +74,8 @@ fn_plot_aux_scores <- function(fcst_input,png_archive,station_group_var = "stati cycles <- sort(unique(fcst[["fcst_cycle"]])) stations <- unique(fcst[[station_group_var]]) par_unit <- unique(fcst[["units"]]) - sdate <- YMDh(first(sort(unique(fcst[["fcdate"]])))) - edate <- YMDh(last(sort(unique(fcst[["fcdate"]])))) + sdate <- YMDh(first(sort(unique(fcst[["fcst_dttm"]])))) + edate <- YMDh(last(sort(unique(fcst[["fcst_dttm"]])))) # Check if the png_archive points to sdate-edate? If not, create a subdirectory d_end <- paste0(sdate,"-",edate) @@ -88,7 +88,7 @@ fn_plot_aux_scores <- function(fcst_input,png_archive,station_group_var = "stati # USER INTERACTION #=================================================# - lt_to_use <- seq(3,48,3) # What leadtimes to use? + lt_to_use <- seq(3,48,3) # What lead_times to use? cycles_oi <- c("All") # What cycles to plot for? stations_oi <- unique(c(stations,"All")) # What stations to plot for? fd_adjust <- 1 # Adjust parameter in freq dist plotting @@ -164,13 +164,13 @@ fn_plot_aux_scores <- function(fcst_input,png_archive,station_group_var = "stati # COMPUTE VARIOUS AUX SCORES #=================================================# - fcst <- filter(fcst,leadtime %in% lt_to_use) - leadtimes <- sort(unique(fcst[["leadtime"]])) + fcst <- filter(fcst,lead_time %in% lt_to_use) + lead_times <- sort(unique(fcst[["lead_time"]])) - if (length(leadtimes)>5){ - lt_used_fig <- c(leadtimes[1],leadtimes[2],"... ",leadtimes[length(leadtimes)]) + if (length(lead_times)>5){ + lt_used_fig <- c(lead_times[1],lead_times[2],"... ",lead_times[length(lead_times)]) } else { - lt_used_fig <- leadtimes + lt_used_fig <- lead_times } for (cycle in cycles_oi){ @@ -219,12 +219,12 @@ fn_plot_aux_scores <- function(fcst_input,png_archive,station_group_var = "stati # Member scores (not really required) if (mbr_plots){ - group_vars <- c("mname","valid_hour","member") + group_vars <- c("fcst_model","valid_hour","member") vroption_list$score <- "mbrdailyvar"; vroption_list$xgroup <- "valid_hour"; vroption_list$xg_str <- "vh" fn_dvar_ts(cc_fcst,group_vars,title_str,subtitle_str,fxoption_list,vroption_list) - group_vars <- c("mname","validdate","member") - vroption_list$score <- "mbrtimeseries"; vroption_list$xgroup <- "validdate"; vroption_list$xg_str <- "vd" + group_vars <- c("fcst_model","valid_dttm","member") + vroption_list$score <- "mbrtimeseries"; vroption_list$xgroup <- "valid_dttm"; vroption_list$xg_str <- "vd" fn_dvar_ts(cc_fcst,group_vars,title_str,subtitle_str,fxoption_list,vroption_list) vroption_list$xgroup <- "NA"; vroption_list$score <- "mbrfreqdist"; vroption_list$xg_str <- "NA"; @@ -255,13 +255,13 @@ fn_aux <- function(fc,title_str,subtitle_str,fxoption_list,vroption_list){ } # Daily Var - group_vars <- c("mname","valid_hour") + group_vars <- c("fcst_model","valid_hour") vroption_list$xgroup <- "valid_hour"; vroption_list$score <- paste0(cprefix,"dailyvar"); vroption_list$xg_str <- "vh" fn_dvar_ts(fc,group_vars,title_str,subtitle_str,fxoption_list,vroption_list) # Timeseries - group_vars <- c("mname","validdate") - vroption_list$xgroup <- "validdate"; vroption_list$score <- paste0(cprefix,"timeseries"); vroption_list$xg_str <- "vd" + group_vars <- c("fcst_model","valid_dttm") + vroption_list$xgroup <- "valid_dttm"; vroption_list$score <- paste0(cprefix,"timeseries"); vroption_list$xg_str <- "vd" fn_dvar_ts(fc,group_vars,title_str,subtitle_str,fxoption_list,vroption_list) # Frequency distribution @@ -291,15 +291,15 @@ fn_dvar_ts <- function(fc,group_vars,title_str,subtitle_str,fxoption_list,vropti vroption_list$score <- score } - dv <- fc %>% group_by_at(group_vars) %>% summarise(!!score := mean(forecast), mean_obs = mean(OBS),num_cases=n()) + dv <- fc %>% group_by_at(group_vars) %>% summarise(!!score := mean(fcst), mean_obs = mean(OBS),num_cases=n()) - # Replace mean_obs by "OBS" in mname (or member) + # Replace mean_obs by "OBS" in fcst_model (or member) if (grepl("mbr",score_orig)){ dv_tmp <- filter(dv,member == unique(dv[["member"]][1])) dv_tmp <- mutate(dv_tmp,member = "OBS","{score}" := mean_obs) } else { - dv_tmp <- filter(dv,mname == unique(dv[["mname"]])[1]) - dv_tmp <- mutate(dv_tmp,mname = "OBS","{score}" := mean_obs) + dv_tmp <- filter(dv,fcst_model == unique(dv[["fcst_model"]])[1]) + dv_tmp <- mutate(dv_tmp,fcst_model = "OBS","{score}" := mean_obs) } dv <- bind_rows(dv,dv_tmp); dv <- select(dv,-mean_obs) @@ -335,23 +335,23 @@ fn_freqdist <- function(fc,title_str,subtitle_str,fxoption_list,vroption_list){ fc <- fc %>% filter(!(member %in% c("mean","spread","OBS"))) p_out <- ggplot()+ - geom_density(data=fc,aes(x=forecast,group=interaction(mname,member)),color="gray", + geom_density(data=fc,aes(x=fcst,group=interaction(fcst_model,member)),color="gray", size=fxoption_list$line_size,adjust=fxoption_list$fd_adjust,alpha=0.5)+ - geom_density(data=fc_ctrl,aes(x=forecast,group=mname,color="mbr000"), + geom_density(data=fc_ctrl,aes(x=fcst,group=fcst_model,color="mbr000"), size=fxoption_list$line_size,adjust=fxoption_list$fd_adjust,alpha=0.5)+ - geom_density(data=fc_mean,aes(x=forecast,group=mname,color="mean"), + geom_density(data=fc_mean,aes(x=fcst,group=fcst_model,color="mean"), size=fxoption_list$line_size,adjust=fxoption_list$fd_adjust,alpha=0.5)+ - geom_density(data=fc_obs,aes(x=forecast,group=mname,color="OBS"), + geom_density(data=fc_obs,aes(x=fcst,group=fcst_model,color="OBS"), size=fxoption_list$line_size,adjust=fxoption_list$fd_adjust,alpha=0.5)+ - facet_wrap(vars(mname),ncol=min(fxoption_list$num_models,2))+ + facet_wrap(vars(fcst_model),ncol=min(fxoption_list$num_models,2))+ labs(x = fxoption_list$par_unit, y = "Relative frequency",color = "", title=ptitle,subtitle = subtitle_str)+fxoption_list$ptheme_l } else { - fc_obs <- fc %>% filter(mname == unique(fc[["mname"]][1])) + fc_obs <- fc %>% filter(fcst_model == unique(fc[["fcst_model"]][1])) p_out <- ggplot()+ - geom_density(data=fc,aes(x=forecast,color=fct_inorder(mname)),size=fxoption_list$line_size, + geom_density(data=fc,aes(x=fcst,color=fct_inorder(fcst_model)),size=fxoption_list$line_size, adjust=fxoption_list$fd_adjust)+ geom_density(data=fc_obs,aes(x=OBS,color="OBS"),size=fxoption_list$line_size, adjust=fxoption_list$fd_adjust)+ @@ -384,9 +384,9 @@ fn_scatterplot <- function(fc,title_str,subtitle_str,fxoption_list,vroption_list title_scores <- gsub("_"," ",str_to_title(title_scores)) ptitle <- paste0(paste0(title_scores,collapse = ", ")," : ",title_str) - p_scat <- fc %>% ggplot(aes(x=OBS,y=forecast))+ + p_scat <- fc %>% ggplot(aes(x=OBS,y=fcst))+ geom_hex(bins=fxoption_list$scat_bins)+ - facet_wrap(vars((mname)),ncol=min(fxoption_list$num_models,3)) + facet_wrap(vars((fcst_model)),ncol=min(fxoption_list$num_models,3)) max_count <- max(ggplot_build(p_scat)$data[[1]]$count) br1 <- round(logseq(1,max_count,5),0) p_scat <- p_scat + diff --git a/R/visualization/fn_plot_helpers.R b/R/visualization/fn_plot_helpers.R index 2a0d7ea..b9dfb1c 100755 --- a/R/visualization/fn_plot_helpers.R +++ b/R/visualization/fn_plot_helpers.R @@ -35,8 +35,8 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li df <- verif } - # A check on the type of xgroup (in case of character type for leadtime and validhour) - if ((xgroup %in% names(df)) & (is.character(df[[xgroup]])) & ((xgroup == "leadtime") || (xgroup == "valid_hour"))){ + # A check on the type of xgroup (in case of character type for lead_time and validhour) + if ((xgroup %in% names(df)) & (is.character(df[[xgroup]])) & ((xgroup == "lead_time") || (xgroup == "valid_hour"))){ df[[xgroup]] <- as.numeric(df[[xgroup]]) } @@ -49,8 +49,8 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li # Plot title ptitle <- paste0(paste0(title_scores,collapse = ", ")," : ",title_str) - # Change point size if we are looking at validdate - if (xgroup == "validdate"){ + # Change point size if we are looking at valid_dttm + if (xgroup == "valid_dttm"){ stroke_size = 0; point_size = 0 } @@ -61,9 +61,9 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li models_tmp <- names(mcolors) colours_tmp <- unname(mcolors) # Colour table - ctab <- data.frame(mname = models_tmp,colour = colours_tmp) - colnames(ctab) <- c("mname","colour") - plot_point_verif(verif,{{all_scores}}, rank_is_relative = "TRUE", rank_hist_type = "lollipop", colour_by = "mname", + ctab <- data.frame(fcst_model = models_tmp,colour = colours_tmp) + colnames(ctab) <- c("fcst_model","colour") + plot_point_verif(verif,{{all_scores}}, rank_is_relative = "TRUE", rank_hist_type = "lollipop", colour_by = "fcst_model", colour_table = ctab, plot_title = ptitle, plot_subtitle = subtitle_str, legend_position = "top", plot_caption = "none") # Save @@ -73,8 +73,8 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li return(p_out) } else if (any(grepl("mbr",all_scores))){ - # If looking at validdate, then use only one column - if (xgroup == "validdate"){ + # If looking at valid_dttm, then use only one column + if (xgroup == "valid_dttm"){ ncols = 1 } else { ncols = min(num_models,2) @@ -82,7 +82,7 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li # Plot all members and facet by model name c_score <- gsub("mbr","",all_scores) - # If OBS exists as a mname, then add this in + # If OBS exists as a fcst_model, then add this in df_ctrl <- df %>% filter(member == "mbr000") # This deals with the case of dailyvar/timeseries if ("OBS" %in% unique(df[["member"]])){ @@ -91,20 +91,20 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li df <- df %>% filter(!(member %in% c("mean","spread","OBS"))) p_out <- ggplot()+ - geom_path(data=df,aes(x=get(xgroup),y=get(c_score),group=interaction(mname,member)), + geom_path(data=df,aes(x=get(xgroup),y=get(c_score),group=interaction(fcst_model,member)), alpha=0.5,size=line_size,color="gray")+ geom_path(data=df_ctrl,aes(x=get(xgroup),y=get(c_score),color="mbr000"),size=line_size)+ geom_path(data=df_mean,aes(x=get(xgroup),y=get(c_score),color="Mean"),size=line_size)+ geom_path(data=df_obs,aes(x=get(xgroup),y=get(c_score),color="OBS"),size=line_size)+ - facet_wrap(vars(mname),ncol=ncols)+ + facet_wrap(vars(fcst_model),ncol=ncols)+ labs(x = str_to_title(xgroup),y = par_unit,title=ptitle,subtitle=subtitle_str,color="")+ptheme_l } else { p_out <- ggplot()+ - geom_path(data=df,aes(x=get(xgroup),y=get(c_score),group=interaction(mname,member)), + geom_path(data=df,aes(x=get(xgroup),y=get(c_score),group=interaction(fcst_model,member)), alpha=0.5,size=line_size,color="gray")+ geom_path(data=df_ctrl,aes(x=get(xgroup),y=get(c_score)),color="red",size=line_size)+ - facet_wrap(vars(mname),ncol=ncols)+ + facet_wrap(vars(fcst_model),ncol=ncols)+ labs(x = str_to_title(xgroup),y = par_unit,title=ptitle,subtitle=subtitle_str)+ptheme_l } @@ -118,14 +118,14 @@ fn_plot_point <- function(verif,title_str,subtitle_str,fxoption_list,vroption_li if (num_scores == 1){ # Remove Inf/-Inf values which may appear for ens skill scores df <- df[!is.infinite(df[[all_scores]]),] - p_out <- df %>% ggplot(aes(x=get(xgroup),color=fct_inorder(mname)))+ + p_out <- df %>% ggplot(aes(x=get(xgroup),color=fct_inorder(fcst_model)))+ geom_line(aes(y=get(all_scores)),size=line_size)+ geom_point(aes(y=get(all_scores)),stroke=stroke_size,size=point_size) } else if (num_scores == 2){ # Remove Inf/-Inf values which may appear for ens skill scores df <- df[!is.infinite(df[[all_scores[1]]]),] df <- df[!is.infinite(df[[all_scores[2]]]),] - p_out <- df %>% ggplot(aes(x=get(xgroup),color=fct_inorder(mname)))+ + p_out <- df %>% ggplot(aes(x=get(xgroup),color=fct_inorder(fcst_model)))+ geom_line(aes(y=get(all_scores[1]),linetype=title_scores[1]),size=line_size)+ geom_point(aes(y=get(all_scores[1])),stroke=stroke_size,size=point_size)+ geom_line(aes(y=get(all_scores[2]),linetype=title_scores[2]),size=line_size)+ @@ -166,8 +166,8 @@ fn_plot_numcases <- function(verif,fxoption_list,vroption_list){ df <- verif } - # A check on the type of xgroup (in case of character type for leadtime and validhour) - if ((xgroup %in% names(df)) & (is.character(df[[xgroup]])) & ((xgroup == "leadtime") || (xgroup == "valid_hour"))){ + # A check on the type of xgroup (in case of character type for lead_time and validhour) + if ((xgroup %in% names(df)) & (is.character(df[[xgroup]])) & ((xgroup == "lead_time") || (xgroup == "valid_hour"))){ df[[xgroup]] <- as.numeric(df[[xgroup]]) } @@ -182,7 +182,7 @@ fn_plot_numcases <- function(verif,fxoption_list,vroption_list){ } ylabel <- "Num. cases obs." } - p_out<- df %>% ggplot(aes(x=get(xgroup),color=fct_inorder(mname)))+ + p_out<- df %>% ggplot(aes(x=get(xgroup),color=fct_inorder(fcst_model)))+ geom_line(aes(y=get(ncy)),size=line_size)+ geom_point(aes(y=get(ncy)),stroke=stroke_size,size=point_size)+ labs(x = " ",y = ylabel,color = " ",shape = " ")+ptheme_nc+ @@ -198,4 +198,4 @@ fn_plot_numcases <- function(verif,fxoption_list,vroption_list){ } return(p_out) } -#================================================# \ No newline at end of file +#================================================# diff --git a/R/visualization/fn_plot_point_verif.R b/R/visualization/fn_plot_point_verif.R index 8149e06..b9fd01b 100755 --- a/R/visualization/fn_plot_point_verif.R +++ b/R/visualization/fn_plot_point_verif.R @@ -23,10 +23,10 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR if (all(grepl("det_",scores_tables))){ fcst_type <- "det" - model_names <- unique(verif$det_summary_scores$mname) + model_names <- unique(verif$det_summary_scores$fcst_model) } else if (any(grepl("ens_",scores_tables))){ fcst_type <- "ens" - model_names <- unique(verif$ens_summary_scores$mname) + model_names <- unique(verif$ens_summary_scores$fcst_model) } else { stop("Input does not look like a harpPoint verification object, aborting") } @@ -50,9 +50,9 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # START OF SURFACE SCORES - # Scores as a fn of leadtime + # Scores as a fn of lead_time scores_lt <- c("bias~rmse") - # Scores as a fn of validdate + # Scores as a fn of valid_dttm scores_vd <- c("bias~stde") # Scores as a fn of threshold scores_th <- c("threat_score","false_alarm_rate","false_alarm_ratio","kuiper_skill_score", @@ -64,11 +64,11 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # Map scores (combining scores won't work here) scores_mp <- c("bias","rmse") - # Leadtimes to plot when looking at scores_th - #tleadtimes <- c("24","48","All") - tleadtimes <- c("All") + # lead_times to plot when looking at scores_th + #tlead_times <- c("24","48","All") + tlead_times <- c("All") - # Cycles to consider when plotting (summary, threshold scores as fn of leadtime, theshold scores as fn of threshold) + # Cycles to consider when plotting (summary, threshold scores as fn of lead_time, theshold scores as fn of threshold) cycles_summary <- c("00","12","All") cycles_threshold_lt <- c("All") cycles_threshold_th <- c("00","12","All") @@ -76,7 +76,7 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # END OF SURFACE SCORES # START OF UA SCORES - # Scores as a fn of leadtime + # Scores as a fn of lead_time p_scores_lt <- c("bias~rmse") # Profile scores @@ -87,22 +87,22 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # NB: What groups are considered? # This controls what group to look for in the verif object and then do something sensible from there). # There are several options available (note that the "p_*" refers to UA plotting): - # 1) "leadtime", "validdate", "threshold", "p_leadtime" - Here the groups are used for the x-axis + # 1) "lead_time", "valid_dttm", "threshold", "p_lead_time" - Here the groups are used for the x-axis # 2) "SID" - For map scores # 3) "p_prof" - For UA profiles # 4) "other" - Some special ens scores which are handled by harp's plot_point_verif # In general one can leave xgroups as all of the above; if the data does not exist in the verif object, # it will simply be skipped - xgroups <- c("leadtime","validdate","threshold","SID","p_leadtime","p_prof") + xgroups <- c("lead_time","valid_dttm","threshold","SID","p_lead_time","p_prof") # EPS EXPERIMENT } else if (fcst_type == "ens"){ # START OF SURFACE SCORES - # Ensemble scores as a fn of leadtime + # Ensemble scores as a fn of lead_time scores_lt <- c("mean_bias~rmse","rmse~spread","crps","fair_crps") - # Ensemble scores as a fn of validdate + # Ensemble scores as a fn of valid_dttm scores_vd <- c("mean_bias~stde") # Ensemble scores as a fn of thresholds scores_th <- c("brier_score","brier_skill_score","fair_brier_score","roc_area") @@ -127,11 +127,11 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR scores_mp <- c(scores_mp,"ctrlbias","ctrlrmse") } - # Leadtimes to plot when looking at scores_th - #tleadtimes <- c(seq(12,48,12),"All") - tleadtimes <- c("All") + # lead_times to plot when looking at scores_th + #tlead_times <- c(seq(12,48,12),"All") + tlead_times <- c("All") - # Cycle to consider when plotting (summary, threshold scores as fn of leadtime, theshold scores as fn of threshold) + # Cycle to consider when plotting (summary, threshold scores as fn of lead_time, theshold scores as fn of threshold) cycles_summary <- c("00","12","All") cycles_threshold_lt <- c("All") cycles_threshold_th <- c("00","12","All") @@ -139,7 +139,7 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # END OF SURFACE SCORES # START OF UA SCORES - # Scores as a fn of leadtime + # Scores as a fn of lead_time p_scores_lt <- c("mean_bias~rmse") # Profile scores @@ -153,7 +153,7 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # ENS OF UA SCORES # What groups are considered? (see descriptionin "det" section above) - xgroups <- c("leadtime","validdate","threshold","SID","other","p_leadtime","p_prof") + xgroups <- c("lead_time","valid_dttm","threshold","SID","other","p_lead_time","p_prof") } @@ -169,8 +169,11 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # Get useful attributes num_models <- length(model_names) param <- attr(verif,"parameter") - sdate <- attr(verif,"start_date") - edate <- attr(verif,"end_date") + sdate <- attr(verif,"dttm")[1] + sdate <- format(str_datetime_to_datetime(sdate),"%Y%m%d%H") + edate <- attr(verif,"dttm")[length(attr(verif,"dttm"))] + edate <- format(str_datetime_to_datetime(edate),"%Y%m%d%H") + # Note: The unit of the parameter is not included in the harp verif object by default (it seems?) # It should be manually added as an extra attribute upstream. If not, it will be set to empty par_unit <- attr(verif,"unit") @@ -283,10 +286,10 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR c_ind = TRUE # Just a counter for printing # Define some options based on the x-axis - if (xgroup == "leadtime"){ + if (xgroup == "lead_time"){ xg_str <- "lt" scores <- scores_lt - } else if (xgroup == "validdate"){ + } else if (xgroup == "valid_dttm"){ xg_str <- "vd" scores <- scores_vd } else if (xgroup == "valid_hour"){ @@ -301,7 +304,7 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR } else if (xgroup == "SID"){ xg_str <- "mp" scores <- scores_mp - } else if (xgroup == "p_leadtime"){ + } else if (xgroup == "p_lead_time"){ xg_str <- "lt" scores <- p_scores_lt } else if (xgroup == "p_prof"){ @@ -354,7 +357,7 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR verif <- tmp_out$verif stations <- tmp_out$stations cycles <- tmp_out$cycles; cycles <- intersect(cycles,cycles_oi) - leadtimes <- tmp_out$leadtimes; leadtime_vals <- intersect(tleadtimes,leadtimes) + lead_times <- tmp_out$lead_times; lead_time_vals <- intersect(tlead_times,lead_times) validhours <- tmp_out$validhours station_group_var <- tmp_out$station_group_var rm(tmp_out) @@ -392,21 +395,21 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR # Plot if (c_typ == "threshold"){ - # Here we are either plotting as a fn of leadtime or threshold + # Here we are either plotting as a fn of lead_time or threshold if (xgroup == "threshold"){ - loop_values <- leadtime_vals; filter_col <- "leadtime" + loop_values <- lead_time_vals; filter_col <- "lead_time" verif_III <- verif_II - } else if (xgroup == "leadtime"){ + } else if (xgroup == "lead_time"){ loop_values <- threshold_vals; filter_col <- "threshold" - # Remove case where we have threshold scores over all leadtimes - verif_III <- filter_list(verif_II,leadtime != "All") + # Remove case where we have threshold scores over all lead_times + verif_III <- filter_list(verif_II,lead_time != "All") } for (ii in loop_values){ verif_IIII <- filter_list(verif_III,get(filter_col) == ii) c_subtitle <- paste0(subtitle_str," : ",str_to_title(filter_col)," = ",ii) if (xgroup == "threshold"){ vlt = ii; vth = "NA" - } else if (xgroup == "leadtime"){ + } else if (xgroup == "lead_time"){ vlt = "NA" if (ii < 0){ vth <- paste0("m",abs(ii)) @@ -461,17 +464,17 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR if (score == "rank_histogram"){ p_out <- fn_plot_point(verif_II,title_str,subtitle_str,fxoption_list,vroption_list) } else { - # Loop over all leadtime+threshold pairs - for (lt in leadtime_vals){ + # Loop over all lead_time+threshold pairs + for (lt in lead_time_vals){ for (th in threshold_vals){ verif_III <- verif_II - verif_III[[2]] <- filter(verif_III[[2]],leadtime == lt,threshold == th) + verif_III[[2]] <- filter(verif_III[[2]],lead_time == lt,threshold == th) if (th < 0){ vth <- paste0("m",abs(th)) } else { vth <- th } - c_subtitle <- paste0(subtitle_str," : Leadtime = ",lt," : Threshold = ",th) + c_subtitle <- paste0(subtitle_str," : lead_time = ",lt," : Threshold = ",th) p_out <- fn_plot_point(verif_III,title_str,c_subtitle,fxoption_list,vroption_list,vlt=lt,vth=vth) } } @@ -535,16 +538,16 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR } # if validhour exists # UA scores - } else if ((xgroup %in% c("p_leadtime","p_prof")) & (all(strsplit(score,"~")[[1]] %in% cnames)) & ("p" %in% cnames)){ + } else if ((xgroup %in% c("p_lead_time","p_prof")) & (all(strsplit(score,"~")[[1]] %in% cnames)) & ("p" %in% cnames)){ - if ((xgroup == "p_leadtime") & ("leadtime" %in% cnames)){ + if ((xgroup == "p_lead_time") & ("lead_time" %in% cnames)){ if (c_ind){ print(paste0("Working on xgroup: ",xgroup)) c_ind = FALSE } - vroption_list$xgroup <- "leadtime" + vroption_list$xgroup <- "lead_time" # Get the available pressure levels p_levels <- unique(verif_II[[1]][["p"]]) @@ -570,7 +573,7 @@ fn_plot_point_verif <- function(harp_verif_input,png_archive,plot_num_cases = TR } # pressure levels - } # if p_leadtime + } # if p_lead_time if ((xgroup == "p_prof") & ("valid_hour" %in% cnames)){ @@ -643,11 +646,11 @@ fn_check_verif <- function(df,verif,dfnames){ cycles <- c("All") verif <- verif %>% mutate_list(fcst_cycle = "All") } - # And check what leadtimes exist - if ("leadtime" %in% dfnames){ - leadtimes <- unique(df[["leadtime"]]) + # And check what lead_times exist + if ("lead_time" %in% dfnames){ + lead_times <- unique(df[["lead_time"]]) } else { - leadtimes <- "NA" + lead_times <- "NA" } # And check what validhours exist if ("valid_hour" %in% dfnames){ @@ -658,7 +661,7 @@ fn_check_verif <- function(df,verif,dfnames){ return(list("verif" = verif, "cycles" = cycles, "stations" = stations, - "leadtimes" = leadtimes, + "lead_times" = lead_times, "validhours" = validhours, "station_group_var" = station_group_var)) } @@ -716,7 +719,7 @@ fn_plot_map <- function(verif,title_str,subtitle_str,fxoption_list,vroption_list legend.position = "right", strip.background = element_rect(fill="white"), strip.text = element_text(size=14))+ - facet_wrap(vars(mname),ncol=min(num_models,3))+ + facet_wrap(vars(fcst_model),ncol=min(num_models,3))+ scale_size_continuous(range = c(0.1, 3))+ # Controls the overall point size labs(title = ptitle,subtitle = subtitle_str,fill = "",size = "")+ guides(size="none") # Remove size label from legend @@ -758,11 +761,11 @@ fn_plot_profile <- function(verif,title_str,subtitle_str,plot_num_cases,fxoption # Note: No member plotting considered here if (num_scores == 1){ - p_out <- df %>% ggplot(aes(y=p,color=fct_inorder(mname)))+ + p_out <- df %>% ggplot(aes(y=p,color=fct_inorder(fcst_model)))+ geom_path(aes(x=get(all_scores)),size=line_size)+ geom_point(aes(x=get(all_scores)),stroke=stroke_size,size=point_size) } else if (num_scores == 2){ - p_out <- df %>% ggplot(aes(y=p,color=fct_inorder(mname)))+ + p_out <- df %>% ggplot(aes(y=p,color=fct_inorder(fcst_model)))+ geom_path(aes(x=get(all_scores[1]),linetype=title_scores[1]),size=line_size)+ geom_point(aes(x=get(all_scores[1])),stroke=stroke_size,size=point_size)+ geom_path(aes(x=get(all_scores[2]),linetype=title_scores[2]),size=line_size)+ @@ -788,7 +791,7 @@ fn_plot_profile <- function(verif,title_str,subtitle_str,plot_num_cases,fxoption if (plot_num_cases){ ncy <- "num_cases" ylabel <- "Num. cases" - p_nc <- df %>% ggplot(aes(y=p,color=fct_inorder(mname)))+ + p_nc <- df %>% ggplot(aes(y=p,color=fct_inorder(fcst_model)))+ geom_path(aes(x=get(ncy)),size=line_size)+ geom_point(aes(x=get(ncy)),stroke=stroke_size,size=point_size)+ labs(y = " ",x = ylabel,color = " ",shape = " ")+ptheme_nc+ @@ -833,11 +836,11 @@ fn_sid_issue_table <- function(df,fxoption_list,vroption_list,vlt="NA",vth="NA") png_archive <- fxoption_list$png_archive; sdate <- fxoption_list$sdate; edate <- fxoption_list$edate; param <- fxoption_list$param - mnames <- unique(df[[1]][["mname"]]) + fcst_models <- unique(df[[1]][["fcst_model"]]) num_stations <- unique(df[[1]][["SID"]]) - stns_lrmse <- df[[1]] %>% filter(mname == mnames[1]) %>% arrange(-rmse) + stns_lrmse <- df[[1]] %>% filter(fcst_model == fcst_models[1]) %>% arrange(-rmse) ns_val <- min(10,num_stations) # Info for 10 stations with largest rmse - stns_lrmse <- stns_lrmse[1:ns_val,] %>% select("mname","valid_hour","fcst_cycle","SID","lat","lon","rmse","num_cases") + stns_lrmse <- stns_lrmse[1:ns_val,] %>% select("fcst_model","valid_hour","fcst_cycle","SID","lat","lon","rmse","num_cases") stns_lrmse[["rmse"]] <- round(stns_lrmse[["rmse"]],2) # Get corresponding png name @@ -847,4 +850,4 @@ fn_sid_issue_table <- function(df,fxoption_list,vroption_list,vlt="NA",vth="NA") # Save as a table write.table(stns_lrmse,file=file.path(png_archive,tab_fname),sep=",",row.names = FALSE) } -#================================================# \ No newline at end of file +#================================================# diff --git a/config/config_atos.R b/config/config_atos.R index e6eb07f..d6b0fa9 100644 --- a/config/config_atos.R +++ b/config/config_atos.R @@ -34,25 +34,30 @@ conf_get_params_details <- function(){ Q_thr <- c(seq(0, 0.15, 0.015)) SD_thr <- c(0,1,3,6,10, seq(20, 80, 20)) params <- list( - T2m = list( + MAXT2m = list( thresholds = T2m_thr, - scale_fcst = list(scale_factor = -273.15, new_units = "degC"), - scale_obs = list(scale_factor = -273.15, new_units = "degC") + scale_fcst = list(scaling = -273.15, new_units = "degC", mult= FALSE), + scale_obs = list(scaling = -273.15, new_units = "degC", mult= FALSE) ), + MINT2m = list( + thresholds = T2m_thr, + scale_fcst = list(scaling = -273.15, new_units = "degC", mult= FALSE), + scale_obs = list(scaling = -273.15, new_units = "degC", mult= FALSE) + ), Td2m = list( thresholds = T2m_thr, - scale_fcst = list(scale_factor = -273.15, new_units = "degC"), - scale_obs = list(scale_factor = -273.15, new_units = "degC") + scale_fcst = list(scaling = -273.15, new_units = "degC", mult= FALSE), + scale_obs = list(scaling = -273.15, new_units = "degC", mult= FALSE) ), Tmax = list( thresholds = Tmax_thr, - scale_fcst = list(scale_factor = -273.15, new_units = "degC"), - scale_obs = list(scale_factor = -273.15, new_units = "degC") + scale_fcst = list(scaling = -273.15, new_units = "degC", mult= FALSE), + scale_obs = list(scaling = -273.15, new_units = "degC", mult= FALSE) ), Tmin = list( thresholds = Tmin_thr, - scale_fcst = list(scale_factor = -273.15, new_units = "degC"), - scale_obs = list(scale_factor = -273.15, new_units = "degC") + scale_fcst = list(scaling = -273.15, new_units = "degC", mult= FALSE), + scale_obs = list(scaling = -273.15, new_units = "degC", mult= FALSE) ), S10m = list( thresholds = S10m_thr @@ -88,8 +93,8 @@ conf_get_params_details <- function(){ thresholds = SD_thr ), T = list( - scale_fcst = list(scale_factor = -273.15, new_units = "degC"), - scale_obs = list(scale_factor = -273.15, new_units = "degC"), + scale_fcst = list(scaling = -273.15, new_units = "degC", mult= FALSE), + scale_obs = list(scaling = -273.15, new_units = "degC", mult= FALSE), vc = "pressure" ), Pcp = list ( diff --git a/config/config_atos.sh b/config/config_atos.sh index 1b307ba..dec9536 100644 --- a/config/config_atos.sh +++ b/config/config_atos.sh @@ -1,7 +1,7 @@ #/bin/bash ## load modules -module load R/4.0.4 +#module load R/4.0.4 CONFIG_INITIAL=config_atos diff --git a/config/config_atos.yml_Spain_202205 b/config/config_atos.yml_Spain_202205 index 8903c4a..1a9cab1 100644 --- a/config/config_atos.yml_Spain_202205 +++ b/config/config_atos.yml_Spain_202205 @@ -11,7 +11,7 @@ pre: by_vobs_step: "1h" vfld_template: #include one for each model if they are different. - "vfld" - do_all: TRUE # if true, it will ignore list of parameters and do all that is available in the vfld files + do_all: FALSE # if true, it will ignore list of parameters and do all that is available in the vfld files params: - Pcp - AccPcp1h @@ -44,25 +44,26 @@ pre: #Section to define paths for the verification # This section will be used by the scripts under verification verif: - by_step: "6h" + by_step: "24h" + by_obs_step: "1h" fcst_model: - AIB_43h221_de - - AIB_46h1_de2 - VAL500m_46h1_de2 - lead_time: seq(0, 48, 1) +# - M05B + lead_time: seq(0, 24, 1) fcst_type: "det" #det or eps - grps: "leadtime" - fcst_path: "/perm/sp3c/deode_verif/cases/Spain_202205/FCTABLE" - obs_path: "/perm/sp3c/deode_verif/cases/Spain_202205/OBSTABLE" - verif_path: "/perm/sp3c/deode_verif/cases/Spain_202205/output/verif_results" + grps: "lead_time" + fcst_path: "/perm/sp3c/deode_verif20/cases/Spain_202205d/FCTABLE" + obs_path: "/perm/sp3c/deode_verif20/cases/Spain_202205d/OBSTABLE" + verif_path: "/perm/sp3c/deode_verif20/cases/Spain_202205d/output/verif_results" #Section to define the paths for the output # This section will be used by the plotting scripts post: - plot_output: "/perm/sp3c/deode_verif/cases/Spain_202205/output" - rds_path: "/perm/sp3c/deode_verif/cases/Spain_202205/verif_rds" + plot_output: "/perm/sp3c/deode_verif20/cases/Spain_202205d/output" + rds_path: "/perm/sp3c/deode_verif20/cases/Spain_202205d/verif_rds" #This section if only for the scorecards scorecards: - ref_model: AIB_43h221_de + ref_model: AIB_46h1_de2 fcst_model: VAL500m_46h1_de2 params: - T2m @@ -84,4 +85,5 @@ scorecards: - Td2m - Tmax - Tmin - - vis + - vis +