Skip to content

Commit

Permalink
Merge pull request #97 from melofton/eco_apps_release
Browse files Browse the repository at this point in the history
Eco apps release
melofton authored Aug 12, 2021
2 parents f4b1e3a + eb24cba commit aee8a4c
Showing 5 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions 4.1_JAGS_models/readme.txt
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ 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

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

4 changes: 2 additions & 2 deletions 5_Model_output/readme.txt
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion 8_Visualization/Fig5_Fig6_FigS11toS15.R
Original file line number Diff line number Diff line change
@@ -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)

8 changes: 4 additions & 4 deletions 8_Visualization/Fig7_Fig8_FigS16.R
Original file line number Diff line number Diff line change
@@ -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)

15 changes: 8 additions & 7 deletions 9_Data_publication/9A_rename_hindcast_files.R
Original file line number Diff line number Diff line change
@@ -3,22 +3,23 @@
#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/"

#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)){

0 comments on commit aee8a4c

Please sign in to comment.