From dd921720e373ba69040839055c03e33742681abe Mon Sep 17 00:00:00 2001 From: melofton Date: Thu, 12 Aug 2021 12:08:15 -0400 Subject: [PATCH 1/2] editing plots to reflect new model names --- 8_Visualization/Fig5_Fig6_FigS11toS15.R | 2 +- 8_Visualization/Fig7_Fig8_FigS16.R | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8_Visualization/Fig5_Fig6_FigS11toS15.R b/8_Visualization/Fig5_Fig6_FigS11toS15.R index 5b95db9a..3cede1fb 100644 --- a/8_Visualization/Fig5_Fig6_FigS11toS15.R +++ b/8_Visualization/Fig5_Fig6_FigS11toS15.R @@ -16,7 +16,7 @@ my_directory <- "C:/Users/Mary Lofton/Dropbox/Ch5/Bayes_model_analysis_output/" #setting up counters and vectors for for-loop model_names <- c("RW_obs","RW_bias","AC","base_DLM","wtrtemp_min","wtrtemp_min_lag","wtrtemp_MA7","wnd_dir_2day_lag","GDD","schmidt_max_lag","schmidt_and_wind","temp_and_wind","wind_and_GDD") -model_labels <- c("a. RW","b. BiasRW","c. AC","d. BaseDLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","WindDir","GDD","SchmidtLag","Schmidt+Wind","e. Temp+Wind","Wind+GDD") +model_labels <- c("a. RW","b. OffsetRW","c. AC","d. BaseLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","WindDir","GDD","SchmidtLag","Schmidt+Wind","e. Temp+Wind","Wind+GDD") forecast_weeks <- c(1,4) diff --git a/8_Visualization/Fig7_Fig8_FigS16.R b/8_Visualization/Fig7_Fig8_FigS16.R index 18a3811f..756d60e5 100644 --- a/8_Visualization/Fig7_Fig8_FigS16.R +++ b/8_Visualization/Fig7_Fig8_FigS16.R @@ -17,7 +17,7 @@ my_directory <- "C:/Users/Mary Lofton/Dropbox/Ch5/Uncertainty_partitioning_analy #setting up counters and vectors for for-loop model_names <- c("RW_obs","RW_bias","AC","base_DLM","wtrtemp_min","wtrtemp_min_lag","wtrtemp_MA7","wnd_dir_2day_lag","GDD","schmidt_max_lag","schmidt_and_wind","temp_and_wind","wind_and_GDD") -model_labels <- c("a. RW","b. BiasRW","c. AC","d. BaseDLM","a. MinWaterTemp","b. MinWaterTempLag","c. WaterTempMA","d. WindDir","e. GDD","f. SchmidtLag","g. Schmidt+Wind","e. Temp+Wind","h. Wind+GDD","i. Ensemble") +model_labels <- c("a. RW","b. OffsetRW","c. AC","d. BaseLM","a. MinWaterTemp","b. MinWaterTempLag","c. WaterTempMA","d. WindDir","e. GDD","f. SchmidtLag","g. Schmidt+Wind","e. Temp+Wind","h. Wind+GDD","i. Ensemble") schmidt_title <- expression(paste("e. ",Delta,"Schmidt", sep = "")) forecast_weeks <- c(1:4) @@ -125,9 +125,9 @@ for(n in 1:length(forecast_weeks)){ } -rm(list = ls()) ############plot that just has legend to include in final figures + tiff(file = file.path(paste(my_directory,paste0("Fig7_FigSX_legend.tif"),sep = "")), width = 4, height = 4, units = "in", res = 300) plot.new() @@ -143,7 +143,7 @@ my_directory <- "C:/Users/Mary Lofton/Dropbox/Ch5/Uncertainty_partitioning_analy #setting up counters and vectors for for-loop model_names <- c("RW_obs","RW_bias","AC","base_DLM","wtrtemp_min","wtrtemp_min_lag","wtrtemp_MA7","wnd_dir_2day_lag","GDD","schmidt_max_lag","schmidt_and_wind","temp_and_wind","wind_and_GDD","ensemble") -model_labels <- c("RW","BiasRW","AC","BaseDLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","WindDir","GDD","SchmidtLag","Schmidt+Wind","Temp+Wind","Wind+GDD","Ensemble") +model_labels <- c("RW","OffsetRW","AC","BaseLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","WindDir","GDD","SchmidtLag","Schmidt+Wind","Temp+Wind","Wind+GDD","Ensemble") forecast_weeks <- c(1:4) plotdata <- NULL @@ -200,7 +200,7 @@ plotdata <- as_tibble(plotdata) %>% V5 = as.double(V5), V6 = as.double(V6), V7 = as.double(V7), - V2 = fct_relevel(V2, "RW","BiasRW","AC","BaseDLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","SchmidtLag","WindDir","GDD","Schmidt+Wind","Temp+Wind","Wind+GDD","Ensemble")) + V2 = fct_relevel(V2, "RW","OffsetRW","AC","BaseLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","SchmidtLag","WindDir","GDD","Schmidt+Wind","Temp+Wind","Wind+GDD","Ensemble")) colnames(plotdata) <- c("model_name","mod_label","Initial Conditions","Parameter","Driver","Process","forecast_week") plotdata$best_delPL <- c(NA,NA,NA,1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,rep(NA, times = 14),rep(NA, times = 14),NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,NA,NA) From eb24cba2298d8ebff8d847b94a747cefbffddfa9 Mon Sep 17 00:00:00 2001 From: melofton Date: Thu, 12 Aug 2021 12:31:47 -0400 Subject: [PATCH 2/2] updating readmes to reflect new model names --- 4.1_JAGS_models/readme.txt | 4 ++-- 5_Model_output/readme.txt | 4 ++-- 9_Data_publication/9A_rename_hindcast_files.R | 15 ++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/4.1_JAGS_models/readme.txt b/4.1_JAGS_models/readme.txt index 8f54f4f2..7a47fdd0 100644 --- a/4.1_JAGS_models/readme.txt +++ b/4.1_JAGS_models/readme.txt @@ -6,7 +6,7 @@ Refer to Table 2 and Table S4 of the Lofton et al. 2021 manuscript for descripti AC = null model with autocorrelation term; corresponds to AC model in manuscript -base_DLM = null dynamic linear model; correspond to BaseDLM model in manuscript +base_DLM = null dynamic linear model; correspond to BaseLM model in manuscript GDD = GDD model in manuscript @@ -14,7 +14,7 @@ precip = Precip model in manuscript RW = random walk model with uninformed observation error prior; not presented in manuscript -RW_bias = random walk null model with bias term; correspond to BiasRW in manuscript +RW_bias = random walk null model with bias term; correspond to OffsetRW in manuscript RW_obs = random walk model with informed observation error prior; corresponds to RW model in manuscript diff --git a/5_Model_output/readme.txt b/5_Model_output/readme.txt index 9cf8ddd9..5d3a9255 100644 --- a/5_Model_output/readme.txt +++ b/5_Model_output/readme.txt @@ -17,7 +17,7 @@ There are between 80-120 output files for each Bayesian state-space model, depen The names of the .csv files for each model follow the naming convention below: [model name]_[sources of uncertainty included in hindcast]_[year of hindcast]_[week of year].csv For example, the following file: -AR_det.prediction_2015_1.csv contains the 1-4 week hindcasts generated for weeks 1-4 of the 2015 sampling season for the AR model, with no forms of uncertainty included +AC_det.prediction_2015_1.csv contains the 1-4 week hindcasts generated for weeks 1-4 of the 2015 sampling season for the AC model, with no forms of uncertainty included A second example: GDD_hindcast.IC.Pa.D.P._2016_12.csv contains the 1-4 week hindcasts generated for weeks 12-15 of the 2016 sampling season for the GDD model, and includes initial conditions, parameter, driver, and process uncertainty @@ -46,7 +46,7 @@ There are between 80-120 output files for each Bayesian state-space model, depen The names of the .csv files for each model follow the naming convention below: [model name]_[sources of uncertainty included in hindcast]_[year of hindcast]_[week of year].csv For example, the following file: -AR_det.prediction_2015_1.csv contains the 1-4 week hindcasts generated for weeks 1-4 of the 2015 sampling season for the AR model, with no forms of uncertainty included +AC_det.prediction_2015_1.csv contains the 1-4 week hindcasts generated for weeks 1-4 of the 2015 sampling season for the AC model, with no forms of uncertainty included A second example: GDD_hindcast.IC.Pa.D.P._2016_12.csv contains the 1-4 week hindcasts generated for weeks 12-15 of the 2016 sampling season for the GDD model, and includes initial conditions, parameter, driver, and process uncertainty diff --git a/9_Data_publication/9A_rename_hindcast_files.R b/9_Data_publication/9A_rename_hindcast_files.R index 09425d6b..a703980d 100644 --- a/9_Data_publication/9A_rename_hindcast_files.R +++ b/9_Data_publication/9A_rename_hindcast_files.R @@ -3,6 +3,13 @@ #Date: 25MAY20 library(tidyverse) +#get sampling dates +obs <- read_csv("./00_Data_files/Covariate_analysis_data/HC_Gechinulata_long.csv") %>% + filter(year %in% c(2015:2016)) +dates <- as.character(obs$date) +new_wks <- c("2015-05-14",dates[1:19],"2016-05-19",dates[21:39]) + +#reset working directory setwd("./9_Data_publication/") startingDir <- "./5_Model_output/5.2_Hindcasting/" @@ -10,15 +17,9 @@ startingDir <- "./5_Model_output/5.2_Hindcasting/" #create wks vector wks <- c(paste0("2015_",1:20),paste0("2016_",1:20)) -#get sampling dates -obs <- read_csv("./00_Data_files/Covariate_analysis_data/HC_Gechinulata_long.csv") %>% - filter(year %in% c(2015:2016)) -dates <- as.character(obs$date) -new_wks <- c("2015-05-14",dates[1:19],"2016-05-19",dates[21:39]) - #create vector of model names model_names <- c("RW_obs","RW_bias","AC","base_DLM","wtrtemp_min","wtrtemp_min_lag","wtrtemp_MA7","GDD","wnd_dir_2day_lag","schmidt_max_lag","schmidt_and_wind","temp_and_wind","wind_and_GDD") -new_model_names <- c("RW","BiasRW","AC","BaseDLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","GDD","WindDir","SchmidtLag","SchmidtAndWind","TempAndWind","WindAndGDD") +new_model_names <- c("RW","OffsetRW","AC","BaseLM","MinWaterTemp","MinWaterTempLag","WaterTempMA","GDD","WindDir","SchmidtLag","SchmidtAndWind","TempAndWind","WindAndGDD") for(n in 13:length(model_names)){