diff --git a/0.002478752 b/0.002478752 old mode 100644 new mode 100755 diff --git a/0.002578752 b/0.002578752 old mode 100644 new mode 100755 diff --git a/ACLIM2.Rproj b/ACLIM2.Rproj old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart.Rmd b/ACLIM2_quickStart.Rmd old mode 100644 new mode 100755 index cee9349..8328160 --- a/ACLIM2_quickStart.Rmd +++ b/ACLIM2_quickStart.Rmd @@ -57,28 +57,32 @@ To run this tutorial first clone the ACLIM2 repository to your local drive: This set of commands, run within R, downloads the ACLIM2 repository and unpacks it, with the ACLIM2 directory structrue being located in the specified `download_path`. This also performs the folder renaming mentioned in Option 2. ```{r gitdwnld, eval = FALSE,echo =T} + # Specify the download directory main_nm <- "ACLIM2" # Note: Edit download_path for preference download_path <- path.expand("~") dest_fldr <- file.path(download_path,main_nm) - url <- "https://github.com/kholsman/ACLIM2/archive/main.zip" dest_file <- file.path(download_path,paste0(main_nm,".zip")) + download.file(url=url, destfile=dest_file) # unzip the .zip file (manually unzip if this doesn't work) setwd(download_path) - unzip (dest_file, exdir = download_path,overwrite = T) + unzip(dest_file, exdir = download_path,overwrite = T) #rename the unzipped folder from ACLIM2-main to ACLIM2 file.rename(paste0(main_nm,"-main"), main_nm) setwd(main_nm) - -# Caption: Timeseries of season Aug East Bering Sea bottom temp or 400m temp (which ever is shallower) for the 1955-2099 period. The simulations are forced using historical emission (1955 to 2014) and SSP1-2.6 scenario for future projection (2015 to 2099). A 1-year running mean is applied. Figures show, in colors, CESM2-WACCM ensemble mean, in light grey, the spread of all the CMIP6 models, and in medium grey, and dark grey, 80% and 50% the spread of all the CMIP6 members, respectively. Left panel shows the mean values and right panel shows the anomalies relative to the 1980-2013 climatology. - + # Caption: Timeseries of season Aug East Bering Sea bottom temp or 400m temp (which ever is shallower) + # for the 1955-2099 period. The simulations are forced using historical emission (1955 to 2014) and + # SSP1-2.6 scenario for future projection (2015 to 2099). A 1-year running mean is applied. Figures show, + # in colors, CESM2-WACCM ensemble mean, in light grey, the spread of all the CMIP6 models, and in medium + # grey, and dark grey, 80% and 50% the spread of all the CMIP6 members, respectively. Left panel shows + # the mean values and right panel shows the anomalies relative to the 1980-2013 climatology. ``` @@ -380,7 +384,8 @@ Appendix A includes the code used to generate the ACLIM2 indices and bias correc The following code will open an interactive shiny() app for exploring the indices. You can also view this online at (kkh2022.shinyapps.io/ACLIM2_indices)[https://kkh2022.shinyapps.io/ACLIM2_indices/]. ```{r, eval=F, include=T,echo=T} - + suppressMessages(source("R/make.R")) + tmpwd<-getwd() setwd("R/shiny_aclim/ACLIM2_indices") shiny::runApp("app.R") @@ -463,6 +468,102 @@ The following code will open an interactive shiny() app for exploring the indice ``` +## RKC indices (Andre) + +The target indices for RKC include bottom temperature,SST, wind, and other indices during multiple larval phases and very specific station locations. + +Two approaches were used +(1) generate strata-specific indices for spring and summer and fall +(2) generate averages across a subset of stations for summer replicated indicies + + +Hindcast values from 1970-2019 were stitched the operational hindcast (2019-2022) and ACLIM projections from 2022-2100 to generate the indices for CMIP5 and CMIP6. + + +```{r nrs, eval=F, include=T,echo=T, results='hide',message=FALSE} + # to access these scripts go to https://github.com/kholsman/ACLIM2/tree/main/R/sub_scripts + +suppressMessages(source("R/make.R")) + source("R/sub_scripts/make_RKC_Indices_Andre.R") + +# Check the Indices + load("Data/out/PCOD_indices/PCOD_vars.Rdata") + load("Data/out/PCOD_indices/PCOD_vars_op.Rdata") + + require(ggplot2) + require(dplyr) + + load("Data/out/NRS_indices/NRS_vars_raw.Rdata") + load("Data/out/NRS_indices/NRS_vars_op_raw.Rdata") + NRS_vars_raw <- NRS_vars + NRS_vars_op_raw <- NRS_vars_op + rm(NRS_vars) + rm(NRS_vars_op) + load("Data/out/NRS_indices/NRS_vars.Rdata") + load("Data/out/NRS_indices/NRS_vars_op.Rdata") + + unique(NRS_vars$var) + unique(NRS_vars$scen) + + plot_var <- "fracbelow2" # plot_var <- "temp_surface5m" + plot_scen <- "ssp585" # plot_scen <- "rcp45" + + + dat_all <- rbind( + NRS_vars_op%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars_op",op = "op",raw="corrected"), + + NRS_vars_op_raw%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars_op_raw",op = "op",raw="raw"), + + NRS_vars%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars",op = "not op",raw="corrected"), + + NRS_vars_raw%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars_raw",op = "not op",raw="raw")) + + + # compare val_use and val_biascorrected (should be diff for raw): + p1<- ggplot(dat = dat_all)+ + geom_line(aes(x=year, y=val_use,color=GCM_scen,linetype="val_use"),size=.7)+ + geom_line(aes(x=year, y=val_biascorrected,color=GCM_scen,linetype="val_biascorrected"),size=.8)+ + theme_minimal()+facet_grid(op~raw)+ylab("value") + p1 + + jpeg("Data/out/NRS_indices/raw_vs_not_NRS_1.jpg",width=8, height=6, res=350, units="in") + p1 + dev.off() + + + # compare val_delta and val_biascorrected (should be the same for all plots) + p2<- ggplot(dat = dat_all)+ + geom_line(aes(x=year, y=val_biascorrected,color=GCM_scen,linetype="val_biascorrected"),size=.7)+ + geom_line(aes(x=year, y=val_delta,color=GCM_scen,linetype="val_delta"),size=.8)+ + theme_minimal()+facet_grid(op~raw)+ylab("value") + p2 + + jpeg("Data/out/NRS_indices/raw_vs_not_NRS_2.jpg",width=8, height=6, res=350, units="in") + p2 + dev.off() + + # compare val_raw and val_use (should be different for "corrected" (not raw)) + p3<- ggplot(dat = dat_all)+ + geom_line(aes(x=year, y=val_use,color=GCM_scen,linetype="val_use"),size=.7)+ + geom_line(aes(x=year, y=val_raw,color=GCM_scen,linetype="val_raw"),size=.8)+ + theme_minimal()+facet_grid(op~raw)+ylab("value") + p3 + + jpeg("Data/out/NRS_indices/raw_vs_not_NRS_3.jpg",width=8, height=6, res=350, units="in") + p3 + dev.off() + +``` + + ## NRS indices (André) The target indices for NRS include cold pool, bottom temperature, wind, SEBS and NEBS, during the growing season (May-August) @@ -477,12 +578,86 @@ Hindcast values from 1970-2019 were stitched the operational hindcast (2019-2022 ```{r nrs, eval=F, include=T,echo=T, results='hide',message=FALSE} # to access these scripts go to https://github.com/kholsman/ACLIM2/tree/main/R/sub_fun - + suppressMessages(source("R/make.R")) source("R/sub_scripts/make_NRS_indices.R") source("R/sub_scripts/make_NRS_indices_raw.R") - - - + source("R/sub_scripts/make_pcod_indices_Andre.R") + +# Check the Indices + load("Data/out/PCOD_indices/PCOD_vars.Rdata") + load("Data/out/PCOD_indices/PCOD_vars_op.Rdata") + + require(ggplot2) + require(dplyr) + + load("Data/out/NRS_indices/NRS_vars_raw.Rdata") + load("Data/out/NRS_indices/NRS_vars_op_raw.Rdata") + NRS_vars_raw <- NRS_vars + NRS_vars_op_raw <- NRS_vars_op + rm(NRS_vars) + rm(NRS_vars_op) + load("Data/out/NRS_indices/NRS_vars.Rdata") + load("Data/out/NRS_indices/NRS_vars_op.Rdata") + + unique(NRS_vars$var) + unique(NRS_vars$scen) + + plot_var <- "fracbelow2" # plot_var <- "temp_surface5m" + plot_scen <- "ssp585" # plot_scen <- "rcp45" + + + dat_all <- rbind( + NRS_vars_op%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars_op",op = "op",raw="corrected"), + + NRS_vars_op_raw%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars_op_raw",op = "op",raw="raw"), + + NRS_vars%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars",op = "not op",raw="corrected"), + + NRS_vars_raw%>%filter(var==plot_var,scen==plot_scen)%>% + select(year,val_use, val_raw, val_biascorrected,val_delta,GCM_scen)%>% + mutate(type="NRS_vars_raw",op = "not op",raw="raw")) + + + # compare val_use and val_biascorrected (should be diff for raw): + p1<- ggplot(dat = dat_all)+ + geom_line(aes(x=year, y=val_use,color=GCM_scen,linetype="val_use"),size=.7)+ + geom_line(aes(x=year, y=val_biascorrected,color=GCM_scen,linetype="val_biascorrected"),size=.8)+ + theme_minimal()+facet_grid(op~raw)+ylab("value") + p1 + + jpeg("Data/out/NRS_indices/raw_vs_not_NRS_1.jpg",width=8, height=6, res=350, units="in") + p1 + dev.off() + + + # compare val_delta and val_biascorrected (should be the same for all plots) + p2<- ggplot(dat = dat_all)+ + geom_line(aes(x=year, y=val_biascorrected,color=GCM_scen,linetype="val_biascorrected"),size=.7)+ + geom_line(aes(x=year, y=val_delta,color=GCM_scen,linetype="val_delta"),size=.8)+ + theme_minimal()+facet_grid(op~raw)+ylab("value") + p2 + + jpeg("Data/out/NRS_indices/raw_vs_not_NRS_2.jpg",width=8, height=6, res=350, units="in") + p2 + dev.off() + + # compare val_raw and val_use (should be different for "corrected" (not raw)) + p3<- ggplot(dat = dat_all)+ + geom_line(aes(x=year, y=val_use,color=GCM_scen,linetype="val_use"),size=.7)+ + geom_line(aes(x=year, y=val_raw,color=GCM_scen,linetype="val_raw"),size=.8)+ + theme_minimal()+facet_grid(op~raw)+ylab("value") + p3 + + jpeg("Data/out/NRS_indices/raw_vs_not_NRS_3.jpg",width=8, height=6, res=350, units="in") + p3 + dev.off() + ``` @@ -667,8 +842,12 @@ Hindcast values from 1970-2019 were stitched the operational hindcast (2019-2022 ## make CEATTLE indices (Kir) ```{r ceattle, eval=F, include=T,echo=T, results='hide',message=FALSE} +suppressMessages( suppressWarnings(source("R/make.R"))) source("R/sub_scripts/make_ceattle_indices.R") -# now jump down to make .dat file +source("R/sub_scripts/make_CEATTLE_dat_files.R") + + +# now jump down to make .dat file that is generic ``` @@ -935,262 +1114,9 @@ fn_long <- "ACLIM2_CMIP6_delta_bc.dat" archive_old <- T # Archive the older version of the .dat file? normlist <- read.csv(file=file.path(Rdata_path,"../normlist.csv")) -outpath <- "Data/out/ADMB_datfiles" -if(!dir.exists(outpath)) dir.create(outpath) - -# define hind and fut data files -fndat_hind <- file.path(outpath,paste("KKHhind_",fn,sep="")) -fndat_fut <- file.path(outpath,paste("KKHfut_",fn,sep="")) - -fndat_hind_long <- file.path(outpath,paste("KKHhind_",fn_long,sep="")) -fndat_fut_long <- file.path(outpath,paste("KKHfut_",fn_long,sep="")) - -fndat_hind2 <- file.path(outpath,paste("hind_",fn,sep="")) -fndat_fut2 <- file.path(outpath,paste("fut_",fn,sep="")) - -# create and archive .dat files -outfile <- fndat_fut -if(file.exists(outfile)&archive_old){ - # archive older version - archivefl <- paste0(substr(outfile,start=1,stop=nchar(outfile)-4), - format(Sys.time(), "%Y%m%d_%H%M%S"),".dat") - file.rename(outfile, archivefl) - #file.remove(outfile) -} - -file.create(outfile) -outfile <- fndat_hind -if(file.exists(outfile)&archive_old){ - # archive older version - archivefl <- paste0(substr(outfile,start=1,stop=nchar(outfile)-4), - format(Sys.time(), "%Y%m%d_%H%M%S"),".dat") - file.rename(outfile, archivefl) - #file.remove(outfile) -} -file.create(outfile) - - - -# 2 -- rescale (Z-score) data and get variables -# ---------------------------------------------- CMIPS <- c("K20P19_CMIP6","K20P19_CMIP5") -# preview possible variables -varall <- unique(ceattle_vars_op$var) -varall - - -# vars -ceattle_vars_op -ceattle_vars_wide_op - -grpby2 <- c("type","var","basin", - "year","sim","sim_type", - "bc") - -#define hind and fut: -hind <- ceattle_vars_op%>%filter(year%in%hind_yrs,sim_type=="hind")%>% - ungroup() - -mnhind <- hind%>% - group_by(season,var,basin)%>% - summarize(mnhind = mean(val_use,na.rm=T), - sdhind = sd(val_use, na.rm=T))%>%ungroup() -hind <- hind%>%left_join(mnhind)%>% - mutate(val_use_scaled = (val_use-mnhind)/sdhind)%>% - select(all_of(c(grpby2,"val_use","val_use_scaled")))%>%distinct()%>% - ungroup() - - -hind <- hind%>%full_join(expand.grid(year= hind_yrs, var = unique(hind$var))) - - -fut <- ceattle_vars_op%>% - filter(year%in%fut_yrs) - -#temporary fix: Add Large Zoop for CESM RCP85 -tmp_fut <-fut%>%filter(GCM_scen=="cesm_rcp85") -grplist<-c("NCaS_integrated","EupS_integrated") - -if(length(grep("largeZoop_integrated",unique(tmp_fut$var_raw)) )==0){ - tmp_futA <- tmp_fut[grep(grplist[1],tmp_fut$var),] - tmp_futB <- tmp_fut[grep(grplist[2],tmp_fut$var),] - tmp_futA$var2 <- grplist[1] - tmp_futB$var2 <- grplist[2] - sumat<-c("val_use","mnVal_hind","val_delta","val_biascorrected", - "val_raw","mn_val") - tmp_var_zoop <- rbind(tmp_futA,tmp_futB)%>% - dplyr::filter(var2%in%c("NCaS_integrated","EupS_integrated"))%>% - dplyr::group_by( - var, - season, - type, - basin, - year, - sim, - gcmcmip, - GCM, - scen, - sim_type, - bc, - GCM_scen, - GCM_scen_sim, - CMIP, - GCM2, - GCM2_scen_sim, - jday,mnDate,var_raw,lognorm,var2)%>% - summarise_at(all_of(sumat),mean,na.rm=T)%>% - mutate(var_raw="largeZoop_integrated", - var = paste0(season,"_largeZoop_integrated"))%>%select(-var2)%>% - summarise_at(all_of(sumat),sum,na.rm=T)%>%relocate(names(fut))%>% - distinct() - - fut <- rbind(fut, tmp_var_zoop) - -} - fut <- fut%>%left_join(mnhind)%>% - mutate(val_use_scaled = (val_use-mnhind)/sdhind)%>%ungroup() - -data.frame(fut%>%filter(var=="Winter_largeZoop_integrated",GCM_scen=="cesm_rcp85")) -data.frame(fut%>%ungroup()%>%group_by(GCM_scen)%>%summarise(count = length(var))) - -fut <- fut%>%full_join(expand.grid(year= fut_yrs, - var = unique(fut$var), - GCM_scen = unique(fut$GCM_scen))) -data.frame(fut%>%ungroup()%>%group_by(GCM_scen)%>%summarise(count = length(var))) - data.frame(fut%>%filter(var=="Winter_largeZoop_integrated",GCM_scen=="cesm_rcp85")) - -# now identify which covars are highly correlated - - d_wide <- ceattle_vars_op%>% - filter(year<=lastyr_hind)%>% - left_join(mnhind)%>% - mutate(val_use_scaled = (val_use-mnhind)/sdhind)%>%ungroup()%>% - group_by(across(all_of(grpby2)))%>% - summarize_at(all_of(c("val_use_scaled")), mean, na.rm=T)%>% - tidyr::pivot_wider(names_from = "var", values_from = "val_use_scaled") - - # calculate correlations and display in column format - - # define columns with meta data: - col_meta <- which(colnames(d_wide)%in%grpby2) - d_wide_dat <-d_wide[,-col_meta] - num_col <- ncol(d_wide[,-col_meta]) - out_indx <- which(upper.tri(diag(num_col))) - cor_cols <- d_wide_dat%>% - do(melt(cor(., - method="spearman", - use="pairwise.complete.obs"), - value.name="cor")[out_indx,]) - - corr <- cor(na.omit(d_wide_dat)) - - long_dat <- reshape2::melt(corr,variable.name = "variable") %>% - as.data.frame() - - # plot co variation between variables - corplot <- long_dat %>%arrange(value)%>% - ggplot(aes(x=Var1, y=Var2, fill=value)) + - geom_raster() + - scale_fill_viridis_c()+ - theme_minimal()+ - theme(axis.text.x = element_text(angle = 90)) - - jpeg(filename = file.path("Data/out/CEATTLE_indices/CEATTLE_indicescorplot.jpg"), - width=8,height=7,units="in",res=350) - print(corplot) - dev.off() - - # # remove those where cov is high (temp by season and cold pool by season) - # subset <- long_dat$>$filter(abs(value)<0.6) - -# 3 -- write data to hind .dat file -# ------------------------------------ - - -# CEATTLE uses a spp overlap index - you can skip this - -overlapdat <- data.frame( - atf_OL=c(0.9391937,0.8167094,0.808367,0.5926875,0.7804481,0.5559549, - 0.4006931,0.5881404,0.7856776,0.511565,0.6352048,0.5583476, - 0.5792738,0.5417657,0.8212887,0.6287613,0.4536608,0.6587292, - 0.4884194,0.8289379,0.4399257,0.5950167,0.6388434,0.6111834, - 0.8742649,0.7868746,0.8024257,0.6227457,0.4956742,0.4347917, - 0.4791108,0.4369006,0.5613625,0.4353015), - south_OL=c(0.9980249,0.9390368,0.9959974,0.6130846,0.951234,0.5851891, - 0.4934879,0.641471,0.9809618,0.5596813,0.7196964,0.6754698, - 0.5774808,0.6041351,0.9406521,0.7949525,0.5306435,0.7977694, - 0.5345031,0.9879945,0.5079171,0.7148121,0.8997132,0.7340859, - 0.9962068,0.9627235,0.998043,0.8111,0.6087638,0.513057,0.5492621, - 0.4971361,0.665453,0.5969653) -) - - -includeOverlap <- F -overlap <- matrix(1,3,length(sort(unique(hind$year)))) -overlap_fut <- array(1,c(3,length(unique(fut$GCM_scen))+1,length(sort(unique(fut$year))))) -if(includeOverlap){ - overlap[3,] <- overlapIN - overlap[3,][overlap[3,]>1]<-1 #covs$BT2to6/covs$BT0to6 -} - -# replace NA values with the mean -shortlist <- c("Summer_temp_bottom5m","Winter_temp_bottom5m", - "Winter_pH_depthavg","Summer_oxygen_bottom5m", - "Summer_temp_surface5m", - "Spring_Cop_integrated", - "Fall_largeZoop_integrated") -hind_short <- hind%>%mutate(long_name=var)%>% - filter(var%in%shortlist) -# Kir's .dat file -makeDat_hind(datIN = hind_short, - outfile = fndat_hind, - value2use = "val_use", - value2use_scaled = "val_use_scaled", - NAVal = "mean", - nsppIN = 3, - overlapIN = overlap, - nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), - Scaled_covlist = unique(hind_short$var)) - -makeDat_fut( datIN = fut%>%mutate(long_name=var)%>% - filter(var%in%shortlist), - hinddatIN = hind%>%mutate(long_name=var)%>% - filter(var%in%shortlist), - outfile = fndat_fut, - value2use = "val_use", - value2use_scaled = "val_use_scaled", - NAVal = "mean", - nsppIN = 3, - last_nyrs_avg = 10, - overlapIN = overlap_fut, #(nspp,nsim+1,nyrs_fut) - overlap_hind = overlap, - nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), - Scaled_covlist = unique(hind_short$var)) - -# Kir's .dat file -makeDat_hind(datIN = hind%>%mutate(long_name=var), - outfile = fndat_hind_long, - value2use = "val_use", - value2use_scaled = "val_use_scaled", - NAVal = "mean", - nsppIN = 3, - overlapIN = overlap, - nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), - Scaled_covlist = unique(hind$var)) - -makeDat_fut( datIN = fut%>%mutate(long_name=var), - hinddatIN = hind%>%mutate(long_name=var), - outfile = fndat_fut_long, - value2use = "val_use", - value2use_scaled = "val_use_scaled", - NAVal = "mean", - nsppIN = 3, - last_nyrs_avg = 10, - overlapIN = overlap_fut, #(nspp,nsim+1,nyrs_fut) - overlap_hind = overlap, - nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), - Scaled_covlist = unique(hind$var)) +source("R/sub_scripts/make_CEATTLE_dat_files.R") ### Here's a generic version that doesn't include nspp and overla[] diff --git a/ACLIM2_quickStart.docx b/ACLIM2_quickStart.docx old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart.html b/ACLIM2_quickStart.html old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart.log b/ACLIM2_quickStart.log old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart.md b/ACLIM2_quickStart.md old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart.pdf b/ACLIM2_quickStart.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart.tex b/ACLIM2_quickStart.tex old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/NRS-1.pdf b/ACLIM2_quickStart_files/figure-latex/NRS-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/NRS-2.pdf b/ACLIM2_quickStart_files/figure-latex/NRS-2.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/ewe-1.pdf b/ACLIM2_quickStart_files/figure-latex/ewe-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/ewe-2.pdf b/ACLIM2_quickStart_files/figure-latex/ewe-2.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/sizespec-1.pdf b/ACLIM2_quickStart_files/figure-latex/sizespec-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/sizespec-2.pdf b/ACLIM2_quickStart_files/figure-latex/sizespec-2.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/sizespec-3.pdf b/ACLIM2_quickStart_files/figure-latex/sizespec-3.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/ts-1.pdf b/ACLIM2_quickStart_files/figure-latex/ts-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/ts-2.pdf b/ACLIM2_quickStart_files/figure-latex/ts-2.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-10-1.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-10-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-5-1.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-5-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-1.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-2.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-2.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-3.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-3.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-4.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-6-4.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-7-1.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-7-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-7-2.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-7-2.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-8-1.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-8-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-9-1.pdf b/ACLIM2_quickStart_files/figure-latex/unnamed-chunk-9-1.pdf old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/NRS-1.png b/ACLIM2_quickStart_files/figure-markdown_github/NRS-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/NRS-2.png b/ACLIM2_quickStart_files/figure-markdown_github/NRS-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/ewe-1.png b/ACLIM2_quickStart_files/figure-markdown_github/ewe-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/ewe-2.png b/ACLIM2_quickStart_files/figure-markdown_github/ewe-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/ewe-3.png b/ACLIM2_quickStart_files/figure-markdown_github/ewe-3.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/nrs-3.png b/ACLIM2_quickStart_files/figure-markdown_github/nrs-3.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/salmon-1.png b/ACLIM2_quickStart_files/figure-markdown_github/salmon-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/salmon-2.png b/ACLIM2_quickStart_files/figure-markdown_github/salmon-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/salmon-3.png b/ACLIM2_quickStart_files/figure-markdown_github/salmon-3.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/sizespec-1.png b/ACLIM2_quickStart_files/figure-markdown_github/sizespec-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/sizespec-2.png b/ACLIM2_quickStart_files/figure-markdown_github/sizespec-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/sizespec-3.png b/ACLIM2_quickStart_files/figure-markdown_github/sizespec-3.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/sizespec-4.png b/ACLIM2_quickStart_files/figure-markdown_github/sizespec-4.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/start-1.png b/ACLIM2_quickStart_files/figure-markdown_github/start-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/ts-1.png b/ACLIM2_quickStart_files/figure-markdown_github/ts-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/ts-2.png b/ACLIM2_quickStart_files/figure-markdown_github/ts-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/ts-3.png b/ACLIM2_quickStart_files/figure-markdown_github/ts-3.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-5-1.png b/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-5-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-6-1.png b/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-6-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-6-2.png b/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-6-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-7-1.png b/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-7-1.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-7-2.png b/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-7-2.png old mode 100644 new mode 100755 diff --git a/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-8-1.png b/ACLIM2_quickStart_files/figure-markdown_github/unnamed-chunk-8-1.png old mode 100644 new mode 100755 diff --git a/ACLIM_template.pptx b/ACLIM_template.pptx new file mode 100755 index 0000000..e13058c Binary files /dev/null and b/ACLIM_template.pptx differ diff --git a/Data/.DS_Store b/Data/.DS_Store old mode 100644 new mode 100755 index e901db6..75d2b74 Binary files a/Data/.DS_Store and b/Data/.DS_Store differ diff --git a/Data/README.html b/Data/README.html old mode 100644 new mode 100755 diff --git a/Data/README.md b/Data/README.md old mode 100644 new mode 100755 diff --git a/Data/in/.DS_Store b/Data/in/.DS_Store old mode 100644 new mode 100755 index 892f835..b2bc5c1 Binary files a/Data/in/.DS_Store and b/Data/in/.DS_Store differ diff --git a/Data/in/.keep b/Data/in/.keep old mode 100644 new mode 100755 diff --git a/Data/in/Map_layers/.DS_Store b/Data/in/Map_layers/.DS_Store old mode 100644 new mode 100755 diff --git a/Data/in/Map_layers/placeholder.R b/Data/in/Map_layers/placeholder.R old mode 100644 new mode 100755 diff --git a/Data/in/PSL_Global_CMIP6/CESM_Aug_SSP126_SST_annual.nc b/Data/in/PSL_Global_CMIP6/CESM_Aug_SSP126_SST_annual.nc old mode 100644 new mode 100755 diff --git a/Data/in/PSL_Global_CMIP6/CESM_Aug_SSP585_SST_annual.nc b/Data/in/PSL_Global_CMIP6/CESM_Aug_SSP585_SST_annual.nc old mode 100644 new mode 100755 diff --git a/Data/in/PSL_Global_CMIP6/GFDL_Aug_SSP126_SST_annual.nc b/Data/in/PSL_Global_CMIP6/GFDL_Aug_SSP126_SST_annual.nc old mode 100644 new mode 100755 diff --git a/Data/in/PSL_Global_CMIP6/GFDL_Aug_SSP585_SST_annual.nc b/Data/in/PSL_Global_CMIP6/GFDL_Aug_SSP585_SST_annual.nc old mode 100644 new mode 100755 diff --git a/Data/in/PSL_Global_CMIP6/MIROC_Aug_SSP126_SST_annual.nc b/Data/in/PSL_Global_CMIP6/MIROC_Aug_SSP126_SST_annual.nc old mode 100644 new mode 100755 diff --git a/Data/in/PSL_Global_CMIP6/MIROC_Aug_SSP585_SST_annual.nc b/Data/in/PSL_Global_CMIP6/MIROC_Aug_SSP585_SST_annual.nc old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/CHANGELOG.md b/Data/in/cmip_temperatures-main/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/LICENSE b/Data/in/cmip_temperatures-main/LICENSE old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/README.md b/Data/in/cmip_temperatures-main/README.md old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/cmip5_mmm_temperatures_one_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/cmip5_mmm_temperatures_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/cmip5_models.md b/Data/in/cmip_temperatures-main/cmip5_models.md old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/cmip6_mmm_temperatures_one_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/cmip6_mmm_temperatures_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_all_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_all_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_all_ens_1850_1900_no_bounds_check.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_all_ens_1850_1900_no_bounds_check.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_one_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_one_ens_1850_1900_no_bounds_check.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_absolute_one_ens_1850_1900_no_bounds_check.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_all_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_all_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_all_ens_1850_1900_no_bounds_check.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_all_ens_1850_1900_no_bounds_check.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_one_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_one_ens_1850_1900_no_bounds_check.csv b/Data/in/cmip_temperatures-main/temperatures/cmip5/csv/cmip5_temperatures_one_ens_1850_1900_no_bounds_check.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/Table_11.SM.1_temp_one_ens_1850_1900_md_cmip5.txt b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/Table_11.SM.1_temp_one_ens_1850_1900_md_cmip5.txt old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp26_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp26_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp45_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp45_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp60_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp60_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp85_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_no_bounds_check_rcp85_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp26_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp26_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp45_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp45_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp60_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp60_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp85_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_all_ens_1850_1900_rcp85_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_md_cmip5 b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_md_cmip5 old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_md_cmip5.txt b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_md_cmip5.txt old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp26_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp26_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp45_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp45_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp60_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp60_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp85_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_no_bounds_check_rcp85_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp26_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp26_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp45_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp45_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp60_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp60_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp85_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip5/data_tables/cmip5_temperatures_one_ens_1850_1900_rcp85_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_absolute_all_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_absolute_all_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_absolute_one_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_absolute_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_all_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_all_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_one_ens_1850_1900.csv b/Data/in/cmip_temperatures-main/temperatures/cmip6/csv/cmip6_temperatures_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp119_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp119_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp126_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp126_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp245_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp245_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp370_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp370_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp585_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_all_ens_1850_1900_ssp585_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp119_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp119_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp126_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp126_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp245_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp245_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp370_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp370_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp585_md_raw b/Data/in/cmip_temperatures-main/temperatures/cmip6/data_tables/cmip6_temperatures_one_ens_1850_1900_ssp585_md_raw old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/CHANGELOG.md b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/LICENSE b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/LICENSE old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/README.md b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/README.md old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/cmip5_models.md b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/cmip5_models.md old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/copy_data b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/copy_data old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_start_years_one_ens_1850_1900_no_bounds_check.txt b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_start_years_one_ens_1850_1900_no_bounds_check.txt old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1850_1900.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1850_1900.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1850_1900_no_bounds_check.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1850_1900_no_bounds_check.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1861_1900.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1861_1900.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1995_2014.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/cmip5_warming_levels_one_ens_1995_2014.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1850_1900.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1850_1900_no_bounds_check.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1850_1900_no_bounds_check.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1861_1900.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1861_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1995_2014.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5/csv/cmip5_warming_levels_one_ens_1995_2014.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_start_years_all_ens_1850_1900_no_bounds_check.txt b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_start_years_all_ens_1850_1900_no_bounds_check.txt old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1850_1900.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1850_1900.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1850_1900_no_bounds_check.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1850_1900_no_bounds_check.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1861_1900.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1861_1900.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1995_2014.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/cmip5_warming_levels_all_ens_1995_2014.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1850_1900.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1850_1900_no_bounds_check.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1850_1900_no_bounds_check.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1861_1900.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1861_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1995_2014.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1995_2014.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1850_1900.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1850_1900.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1850_1900_grid.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1850_1900_grid.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1995_2014.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1995_2014.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1995_2014_grid.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/cmip6_warming_levels_one_ens_1995_2014_grid.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1850_1900.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1850_1900_grid.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1850_1900_grid.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1995_2014.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1995_2014.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1995_2014_grid.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6/csv/cmip6_warming_levels_one_ens_1995_2014_grid.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1850_1900.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1850_1900.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1850_1900_grid.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1850_1900_grid.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1995_2014.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1995_2014.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1995_2014_grid.yml b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/cmip6_warming_levels_all_ens_1995_2014_grid.yml old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1850_1900.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1850_1900.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1850_1900_grid.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1850_1900_grid.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1995_2014.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1995_2014.csv old mode 100644 new mode 100755 diff --git a/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1995_2014_grid.csv b/Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1995_2014_grid.csv old mode 100644 new mode 100755 diff --git a/Data/in/fldr_mox_list.csv b/Data/in/fldr_mox_list.csv old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/ROMS_rho_points_Intersect.csv b/Data/in/lookup_tables/ROMS_rho_points_Intersect.csv old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/ROMSdef.Rdata b/Data/in/lookup_tables/ROMSdef.Rdata old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/STATION_LKUP_noObs.Rdata b/Data/in/lookup_tables/STATION_LKUP_noObs.Rdata old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/STRATA_AREA.Rdata b/Data/in/lookup_tables/STRATA_AREA.Rdata old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/Station_lkup2014.csv b/Data/in/lookup_tables/Station_lkup2014.csv old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/modlist.csv b/Data/in/lookup_tables/modlist.csv old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/var_defv2.csv b/Data/in/lookup_tables/var_defv2.csv old mode 100644 new mode 100755 diff --git a/Data/in/lookup_tables/var_defv2.xlsx b/Data/in/lookup_tables/var_defv2.xlsx old mode 100644 new mode 100755 diff --git a/Data/in/placeholder.R b/Data/in/placeholder.R old mode 100644 new mode 100755 diff --git a/Data/out/.Rapp.history b/Data/out/.Rapp.history old mode 100644 new mode 100755 diff --git a/Data/out/normlist.csv b/Data/out/normlist.csv old mode 100644 new mode 100755 diff --git a/Data/out/srvy_vars.Rdata b/Data/out/srvy_vars.Rdata old mode 100644 new mode 100755 index fa447b1..4fd6b55 Binary files a/Data/out/srvy_vars.Rdata and b/Data/out/srvy_vars.Rdata differ diff --git a/Data/out/weekly_vars.Rdata b/Data/out/weekly_vars.Rdata old mode 100644 new mode 100755 index c6601fe..d785545 Binary files a/Data/out/weekly_vars.Rdata and b/Data/out/weekly_vars.Rdata differ diff --git a/Data/shared/._grid_list.Rdata b/Data/shared/._grid_list.Rdata deleted file mode 100644 index 169e65d..0000000 Binary files a/Data/shared/._grid_list.Rdata and /dev/null differ diff --git a/Data/shared/base_data.Rdata b/Data/shared/base_data.Rdata old mode 100644 new mode 100755 diff --git a/Data/shared/grid_list.Rdata b/Data/shared/grid_list.Rdata old mode 100644 new mode 100755 diff --git a/Docs/.DS_Store b/Docs/.DS_Store old mode 100644 new mode 100755 diff --git a/Docs/ACLIM2_setup.Rmd b/Docs/ACLIM2_setup.Rmd old mode 100644 new mode 100755 diff --git a/Docs/ACLIM2_setup.docx b/Docs/ACLIM2_setup.docx old mode 100644 new mode 100755 diff --git a/Docs/ACLIM2_setup.html b/Docs/ACLIM2_setup.html old mode 100644 new mode 100755 diff --git a/Docs/ACLIM2_setup.md b/Docs/ACLIM2_setup.md old mode 100644 new mode 100755 diff --git a/Docs/presentations/ACLIM2_generic_slides.pptx b/Docs/presentations/ACLIM2_generic_slides.pptx new file mode 100755 index 0000000..e13058c Binary files /dev/null and b/Docs/presentations/ACLIM2_generic_slides.pptx differ diff --git a/Docs/presentations/ACLIM3_MHW.pptx b/Docs/presentations/ACLIM3_MHW.pptx new file mode 100755 index 0000000..7289ac6 Binary files /dev/null and b/Docs/presentations/ACLIM3_MHW.pptx differ diff --git a/Docs/presentations/ACLIM3_MHW.qmd b/Docs/presentations/ACLIM3_MHW.qmd new file mode 100755 index 0000000..803c8c3 --- /dev/null +++ b/Docs/presentations/ACLIM3_MHW.qmd @@ -0,0 +1,170 @@ +--- +title: "MHW_ACLIM3" +editor: visual +format: + pptx: + reference-doc: ACLIM3_template2.pptx +--- + +# Some stuff + +## Quarto + + + + + +## Bullets + +When you click the **Render** button a document will be generated that includes: + +- Content authored with markdown +- Output from executable code + +## Code + +When you click the **Render** button a presentation will be generated that includes both content and the output of embedded code. You can embed code like this: + +```{r} +1 + 1 +``` + +# Methods + +## MHW calculations + +## Slide with speaker notes + +- climatology was derived for each week based on average (and variance of) temperatures from `r ref_years[1]` to `r rev(ref_years)[1]`. +- MHW categories were determined as: Category 1 = 1 SD, Category 2 = 2 SD, etc. + +::: notes +Speaker notes go here. +::: + +# SEBS MHWs (bottom temp.) + +::: {.columns .onlytextwidth align="top"} +::: {.column width="40%" align="left"} + +- presently, 20% of the time +- with Carbon Mitigation (ssp126) --> 70% of the time +- without Carbon Mitigation (ssp585) --> 95% of the time +- much higher rate of Cat. 5 MHW + +::: + +::: {.column width="60%" align="center"} +![](../../Data/NotShared/MHW/p_mn_25yr_abrv_temp_bottom5m_SEBS.jpg) +::: +::: + +# NEBS MHWs (bottom temp.) + +::: {.columns .onlytextwidth align="top"} +::: {.column width="40%" align="left"} + +- presently, 20% of the time +- with Carbon Mitigation (ssp126) --> 40% of the time +- without Carbon Mitigation (ssp585) --> 70% of the time +- much higher rate of Cat. 5 MHW + +::: + +::: {.column width="60%" align="center"} +![](../../Data/NotShared/MHW/p_mn_25yr_abrv_temp_bottom5m_NEBS.jpg) +::: +::: +# SEBS MHWs (bottom temp.) + +::: {.columns .onlytextwidth align="top"} +::: {.column width="40%" align="left"} + +- presently, 20% of the time +- with Carbon Mitigation (ssp126) --> 70% of the time +- without Carbon Mitigation (ssp585) --> 95% of the time +- much higher rate of Cat. 5 MHW + +::: + +::: {.column width="60%" align="center"} +![](../../Data/NotShared/MHW/p_mn_10yr_temp_bottom5m_SEBS.jpg) +::: +::: + +# NEBS MHWs (bottom temp.) + +::: {.columns .onlytextwidth align="top"} +::: {.column width="40%" align="left"} + +- presently, 20% of the time +- with Carbon Mitigation (ssp126) --> 40% of the time +- without Carbon Mitigation (ssp585) --> 70% of the time +- much higher rate of Cat. 5 MHW + +::: + +::: {.column width="60%" align="center"} +![](../../Data/NotShared/MHW/p_mn_10yr_temp_bottom5m_NEBS.jpg) +::: +::: + + + +# Historically (NEBS) + +::: {.columns .onlytextwidth align="top"} +::: {.column width="40%" align="left"} + +- +- MHW uncommon winter in NEBS + +::: + +::: {.column width="60%" align="center"} +![](../../Data/NotShared/MHW/temp_bottom5m/p_hind_NEBS.jpg) +::: +::: + + +# Historically (SEBS) + +::: {.columns .onlytextwidth align="top"} +::: {.column width="40%" align="left"} + +- +- MHW uncommon winter in NEBS + +::: + +::: {.column width="60%" align="center"} +![](../../Data/NotShared/MHW/temp_bottom5m/p_hind_SEBS.jpg) +::: +::: + + +# longer look - NEBS + +::: {.columns .onlytextwidth align="top"} + +::: {.column width="1%" align="left"} +::: {.column width="990%" align="left"} + + +![](../../Data/NotShared/MHW/temp_bottom5m/p_hind_NEBSlong.jpg) + +::: +::: +::: + +# longer look - SEBS + +::: {.columns .onlytextwidth align="top"} +::: {.column width="1%" align="left"} +::: {.column width="990%" align="left"} + +![](../../Data/NotShared/MHW/temp_bottom5m/p_hind_SEBSlong.jpg) + +::: +::: +::: \ No newline at end of file diff --git a/Docs/presentations/ACLIM3_template.pptx b/Docs/presentations/ACLIM3_template.pptx new file mode 100755 index 0000000..720d528 Binary files /dev/null and b/Docs/presentations/ACLIM3_template.pptx differ diff --git a/Docs/presentations/ACLIM3_template2.pptx b/Docs/presentations/ACLIM3_template2.pptx new file mode 100755 index 0000000..8aeaa56 Binary files /dev/null and b/Docs/presentations/ACLIM3_template2.pptx differ diff --git a/Docs/presentations/ACLIM_template.pptx b/Docs/presentations/ACLIM_template.pptx new file mode 100755 index 0000000..e13058c Binary files /dev/null and b/Docs/presentations/ACLIM_template.pptx differ diff --git a/ESR_ACLIM.docx b/ESR_ACLIM.docx old mode 100644 new mode 100755 diff --git a/ESR_ACLIM.md b/ESR_ACLIM.md old mode 100644 new mode 100755 diff --git a/ESR_ACLIM.pdf b/ESR_ACLIM.pdf old mode 100644 new mode 100755 diff --git a/ESR_ACLIM.rmd b/ESR_ACLIM.rmd old mode 100644 new mode 100755 index 28028d0..8a97b45 --- a/ESR_ACLIM.rmd +++ b/ESR_ACLIM.rmd @@ -121,8 +121,7 @@ load("ESR_EBS/midCent_N.Rdata") group_by(model,exp,warming_level,GCM)%>%summarize( mnSTyr = mean(start_year), mnENDyr = mean(end_year))%>%mutate(exp = gsub(" ","",exp)) - # files/B10K-K20_CORECFS/Level3/ACLIMsurveyrep_B10K-K20_CORECFS.nc - + # Load the rest of the ROMSNPZ data: # ------------------------ cat("Rdata_path : ", Rdata_path,"\n") @@ -137,49 +136,50 @@ load("ESR_EBS/midCent_N.Rdata") "temp_surface5m", "oxygen_bottom5m", "pH_bottom5m", - "pH_surface5m") + "pH_surface5m", + "aice","EupS_integrated","NCaS_integrated") - - fl <- paste0(reg_txt,dir(Rdata_path)[11],".Rdata") - - # load(file.path(Rdata_path,dir(Rdata_path)[11],fl)) - # dat <- ACLIMregion%>%filter(var%in%plot_vars) - # load("Data/out/H16_CMIP5/allEBS_means/ACLIM_weekly_fut_mn.Rdata") - # ACLIM_weekly_futCMIP5H16 <- ACLIM_weekly_fut - # ACLIM_weekly_futCMIP5H16$GCM <- gsub("MIROC","miroc_h16",ACLIM_weekly_futCMIP5H16$GCM) - # ACLIM_weekly_futCMIP5H16$GCM <- gsub("CESM","cesm_h16", ACLIM_weekly_futCMIP5H16$GCM) - # ACLIM_weekly_futCMIP5H16$GCM <- gsub("GFDL","gfdl_h16", ACLIM_weekly_futCMIP5H16$GCM) - # Load weekly data: # ---------------------------------------------- load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_weekly_fut_mn.Rdata") - ACLIM_weekly_futCMIP5 <- ACLIM_weekly_fut + ACLIM_weekly_futCMIP5 <- ACLIM_weekly_fut%>%left_join(weekly_var_def,join_by(var== name)) load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_weekly_fut_mn.Rdata") load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_weekly_hind_mn.Rdata") - ACLIM_weekly_futCMIP6 <- ACLIM_weekly_fut + load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_weekly_hist_mn.Rdata") + ACLIM_weekly_hist <- ACLIM_weekly_hist%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_weekly_fut <- ACLIM_weekly_fut%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_weekly_futCMIP6 <- ACLIM_weekly_fut ACLIM_weekly_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_weekly_futCMIP5$GCM) ACLIM_weekly_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_weekly_futCMIP5$GCM) ACLIM_weekly_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_weekly_futCMIP5$GCM) - ACLIM_weekly_fut <- rbind(ACLIM_weekly_futCMIP6,ACLIM_weekly_futCMIP5) + ACLIM_weekly_fut <- rbind(ACLIM_weekly_futCMIP6,ACLIM_weekly_futCMIP5) # Load surveyrep data: # ---------------------------------------------- load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_surveyrep_fut_mn.Rdata") - ACLIM_surveyrep_futCMIP5 <- ACLIM_surveyrep_fut + ACLIM_surveyrep_futCMIP5 <- ACLIM_surveyrep_fut%>%left_join(srvy_var_def,join_by(var== name)) load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_fut_mn.Rdata") load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_hind_mn.Rdata") + load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_hist_mn.Rdata") + ACLIM_surveyrep_hist <- ACLIM_surveyrep_hist%>%left_join(srvy_var_def,join_by(var== name)) + ACLIM_surveyrep_hind <- ACLIM_surveyrep_hind%>%left_join(srvy_var_def,join_by(var== name)) + ACLIM_surveyrep_fut <- ACLIM_surveyrep_fut%>%left_join(srvy_var_def,join_by(var== name)) ACLIM_surveyrep_futCMIP6 <- ACLIM_surveyrep_fut ACLIM_surveyrep_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_surveyrep_futCMIP5$GCM) ACLIM_surveyrep_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_surveyrep_futCMIP5$GCM) ACLIM_surveyrep_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_surveyrep_futCMIP5$GCM) - ACLIM_surveyrep_fut <- rbind(ACLIM_surveyrep_futCMIP6,ACLIM_surveyrep_futCMIP5) + ACLIM_surveyrep_fut <- rbind(ACLIM_surveyrep_futCMIP6,ACLIM_surveyrep_futCMIP5) # Load annual data: # ---------------------------------------------- load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_annual_fut_mn.Rdata") - ACLIM_annual_futCMIP5 <- ACLIM_annual_fut + ACLIM_annual_futCMIP5 <- ACLIM_annual_fut%>%left_join(weekly_var_def,join_by(var== name)) load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_fut_mn.Rdata") load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_hind_mn.Rdata") + load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_hist_mn.Rdata") + ACLIM_annual_hist <- ACLIM_annual_hist%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_annual_hind <- ACLIM_annual_hind%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_annual_fut <- ACLIM_annual_fut%>%left_join(weekly_var_def,join_by(var== name)) ACLIM_annual_futCMIP6 <- ACLIM_annual_fut ACLIM_annual_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_annual_futCMIP5$GCM) ACLIM_annual_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_annual_futCMIP5$GCM) @@ -189,21 +189,30 @@ load("ESR_EBS/midCent_N.Rdata") # Load seasonal data: # ---------------------------------------------- load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_seasonal_fut_mn.Rdata") - ACLIM_seasonal_futCMIP5 <- ACLIM_seasonal_fut + ACLIM_seasonal_futCMIP5 <- ACLIM_seasonal_fut%>%left_join(weekly_var_def,join_by(var== name)) load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_seasonal_fut_mn.Rdata") load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_seasonal_hind_mn.Rdata") + load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_seasonal_hist_mn.Rdata") + ACLIM_seasonal_hist <- ACLIM_seasonal_hist%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_seasonal_hind <- ACLIM_seasonal_hind%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_seasonal_fut <- ACLIM_seasonal_fut%>%left_join(weekly_var_def,join_by(var== name)) ACLIM_seasonal_futCMIP6 <- ACLIM_seasonal_fut ACLIM_seasonal_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_seasonal_futCMIP5$GCM) ACLIM_seasonal_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_seasonal_futCMIP5$GCM) ACLIM_seasonal_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_seasonal_futCMIP5$GCM) ACLIM_seasonal_fut <- rbind(ACLIM_seasonal_futCMIP6,ACLIM_seasonal_futCMIP5) + # Load monthly data: # ---------------------------------------------- load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_monthly_fut_mn.Rdata") - ACLIM_monthly_futCMIP5 <- ACLIM_monthly_fut + ACLIM_monthly_futCMIP5 <- ACLIM_monthly_fut%>%left_join(weekly_var_def,join_by(var== name)) load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_monthly_fut_mn.Rdata") load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_monthly_hind_mn.Rdata") - ACLIM_monthly_futCMIP6 <- ACLIM_monthly_fut + load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_monthly_hist_mn.Rdata") + ACLIM_monthly_hist <- ACLIM_monthly_hist%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_monthly_hind <- ACLIM_monthly_hind%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_monthly_fut <- ACLIM_monthly_fut%>%left_join(weekly_var_def,join_by(var== name)) + ACLIM_monthly_futCMIP6 <- ACLIM_monthly_fut ACLIM_monthly_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_monthly_futCMIP5$GCM) ACLIM_monthly_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_monthly_futCMIP5$GCM) ACLIM_monthly_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_monthly_futCMIP5$GCM) @@ -211,58 +220,217 @@ load("ESR_EBS/midCent_N.Rdata") #ACLIM_weekly_fut<-rbind(ACLIM_weekly_fut,ACLIM_weekly_futCMIP5,ACLIM_weekly_futCMIP5H16) - allyears <- min(ACLIM_weekly_hind$year, - na.rm=T):max(ACLIM_weekly_fut$year,na.rm=T) - hindyrs <- min(ACLIM_weekly_hind$year, - na.rm=T):max(ACLIM_weekly_hind$year,na.rm=T) - futyrs <- min(ACLIM_weekly_fut$year, - na.rm=T):max(ACLIM_weekly_fut$year,na.rm=T) + allyears <- min(ACLIM_weekly_hind$year,na.rm=T):max(ACLIM_weekly_fut$year,na.rm=T) + hindyrs <- min(ACLIM_weekly_hind$year,na.rm=T):max(ACLIM_weekly_hind$year,na.rm=T) + futyrs <- min(ACLIM_weekly_fut$year,na.rm=T):max(ACLIM_weekly_fut$year,na.rm=T) scens <- c("ssp126" ,"rcp45" ,"ssp585","rcp85") GCMs <- c("miroc", "gfdl" , "cesm" ) + + # Create climatology + # ------------------------------------------- + # get just the core columns: + grplist <- c("var","sim", + "basin","type", + "sim_type", + "gcmcmip","CMIP", + "scen", + "GCM","mod") + + plot_vars <- c("fracbelow2", + "fracbelow0", + "temp_bottom5m", + "temp_surface5m", + "oxygen_bottom5m", + "pH_bottom5m", + "pH_surface5m", + "aice","EupS_integrated","NCaS_integrated") + + hind <- ACLIM_weekly_hind%>%filter(var%in%plot_vars)%>% + select(all_of(c(grplist,"year","season","mn_val","mnVal_hind","mnDate","jday","wk","mo"))) + + # get weekly climatology + wkly_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"wk")))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) + ggplot(wkly_clim%>%filter(var=="EupS_integrated"))+ + geom_line(aes(x=mndate_clim,y= mn_clim,color=basin))+ + geom_line(aes(x=mndate_clim,y= mn_clim+sd_clim,color=basin),linetype="dashed")+ + geom_line(aes(x=mndate_clim,y= mn_clim-sd_clim,color=basin),linetype="dashed") + + + # get monthly climatology + mo_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"mo")))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) + ggplot(mo_clim%>%filter(var=="EupS_integrated"))+ + geom_line(aes(x=mndate_clim,y= mn_clim,color=basin))+ + geom_line(aes(x=mndate_clim,y= mn_clim+sd_clim,color=basin),linetype="dashed")+ + geom_line(aes(x=mndate_clim,y= mn_clim-sd_clim,color=basin),linetype="dashed") + + + # get seasonal climatology + season_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"season")))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) + ggplot(season_clim%>%filter(var=="EupS_integrated"))+ + geom_line(aes(x=mndate_clim,y= mn_clim,color=basin))+ + geom_line(aes(x=mndate_clim,y= mn_clim+sd_clim,color=basin),linetype="dashed")+ + geom_line(aes(x=mndate_clim,y= mn_clim-sd_clim,color=basin),linetype="dashed") + + # get annual climatatology + annual_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist)))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) + + # Create timeblocks # ------------------------------------------- - blocks <- round(unique(round(allyears/1000,2)*1000)) - if(any(blocks>max(futyrs))) blocks<- blocks[-which(blocks>max(futyrs))] + blocks <- round(unique(round(allyears/1000,2)*1000)) + if(any(blocks>max(futyrs))) + blocks <- blocks[-which(blocks>max(futyrs))] blocks_fut <- unique(round(futyrs/1000,2)*1000) blocks_hind <- unique(10+round(hindyrs/1000,2)*1000) subyear <- blocks + grplist <- c("var","sim", + "basin","type", + "sim_type","jday", + "gcmcmip","CMIP", + "GCM","mod") + + length.na <- function(x,na.rm=F){ + if(na.rm){ + x <- as.numeric(na.omit(x)) + } + length(x) + } + + se <- function(x, na.rm=T){ + if(na.rm){ + x <- as.numeric(na.omit(x)) + } + if(length(x)>0){ + sd(x)/sqrt(length(x)) + }else{ + 0 + } + + } # Re-org the data for plots # ---------------------------------------------- - dat <- ACLIM_weekly_fut%>% + dat <- + ACLIM_weekly_fut%>% filter(var%in%plot_vars)%>% - mutate(yrFactor = factor(as.character(year),levels= allyears), - year_block= 10+round(year/1000,2)*1000)%>% + mutate(yrFactor = factor(as.character(year),levels= allyears), + year_block = 10+round(year/1000,2)*1000)%>% mutate(year_block = factor(as.character(year_block),levels=blocks), - scen = factor(scen,levels= scens)) + scen = factor(RCP,levels= scens)) + dat_hind <- ACLIM_weekly_hind%>% + filter(var%in%plot_vars)%>% + mutate(yrFactor = factor(as.character(year),levels= allyears), + year_block= 10+round(year/1000,2)*1000)%>% + mutate(year_block = factor(as.character(year_block),levels=blocks)) + + dat_hist <- ACLIM_weekly_hist%>% filter(var%in%plot_vars)%>% mutate(yrFactor = factor(as.character(year),levels= allyears), year_block= 10+round(year/1000,2)*1000)%>% mutate(year_block = factor(as.character(year_block),levels=blocks), - scen = factor(scen,levels= scens)) + scen = factor(RCP,levels= scens)) - dat_b <- dat%>%group_by(basin ,GCM, sim,scen, var, units, - jday,long_name,sdVal_hind,mnVal_hind,year_block )%>% + mndat<- + dat_hind%>%group_by(!!!syms(grplist))%>% + summarize(mnVal_hind2 = mean(mn_val,na.rm = T), + mn_hind = mean(mnVal_hind,na.rm = T), + sdVal_hind = sd(mn_val,na.rm = T), + seVal_hind = se(mn_val,na.rm = T), + n = length.na(mn_val,na.rm = T)) + histdat<- + dat_hist%>%group_by(!!!syms(grplist))%>% + summarize(mnVal_hist2 = mean(mn_val,na.rm = T), + mn_hist = mean(mnVal_hist,na.rm = T), + sd_val_hist = sd(mn_val,na.rm = T), + se_val_hist = se(mn_val,na.rm = T), + n_hist = length.na(mn_val,na.rm = T)) + + + + dat_hind <- dat_hind%>%left_join(wkly_clim) + dat_hind <- dat_hind%>%left_join(mndat)%>%ungroup()%>%data.frame() + + #get mean vals by timeblock + dat_b <- dat%>% + group_by(basin ,GCM, sim,scen, + var,jday, + longname,units, + mnVal_hind,year_block )%>% summarize( - mn_val = mean(mn_val,na.rm=T), + mn_val = mean(mn_val,na.rm=T), val_biascorrected = mean(val_biascorrected,na.rm=T))%>% - rename(yrFactor = year_block) + rename(yrFactor = year_block) dat_hind_b <- dat_hind%>% - group_by(basin ,GCM, sim, scen, var, units, jday, - long_name,sdVal_hind,mnVal_hind,year_block )%>% + group_by(basin ,GCM, sim,scen, + var,jday, + sdVal_hind, + mnVal_hind, + year_block )%>% summarize( mn_val = mean(mn_val,na.rm=T))%>% rename(yrFactor = year_block) - dat_s <- ACLIM_seasonal_fut%>%mutate( - gcmscen = paste0(GCM,"_",scen), - season_var = paste0(season,"_",var)) - dat_m <- ACLIM_monthly_fut%>%mutate( + + dat_s <- ACLIM_seasonal_fut%>% + mutate(scen = RCP, + gcmscen = paste0(GCM,"_",scen), + season_var = paste0(season,"_",var)) + + ACLIM_seasonal_hind <- ACLIM_seasonal_hind%>% + mutate( + gcmscen = paste0(GCM,"_",scen), + season_var = paste0(season,"_",var))%>% + group_by(basin ,GCM, sim,scen, + var,season, + longname,units, + mnVal_hind)%>% + summarize( + mnVal_hind2 = mean(mn_val,na.rm=T), + sdVal_hind = sd(mn_val,na.rm=T)) + + ACLIM_monthly_hind <- ACLIM_monthly_hind%>% + mutate( + gcmscen = paste0(GCM,"_",scen), + season_var = paste0(season,"_",var))%>% + group_by(basin ,GCM, sim,scen, + var,mo, + longname,units, + mnVal_hind)%>% + summarize( + mnVal_hind2 = mean(mn_val,na.rm=T), + sdVal_hind = sd(mn_val,na.rm=T)) + + dat_m <- ACLIM_monthly_fut%>% + mutate(scen=RCP, gcmscen = paste0(GCM,"_",scen), mo_var = paste0(mo,"_",var)) @@ -292,9 +460,11 @@ load("ESR_EBS/midCent_N.Rdata") } } } + dat_mn_s_hind <- dat_mn_s_hind%>%mutate( gcmscen = paste0(GCM,"_",scen), season_var = paste0(season,"_",var)) + dat_mn_m_hind <- dat_mn_m_hind%>%mutate( gcmscen = paste0(GCM,"_",scen), mo_var = paste0(mo,"_",var)) @@ -305,25 +475,32 @@ load("ESR_EBS/midCent_N.Rdata") dat_sub<- dat%>%filter(year%in%subyear, year>2010)%>% mutate(yrFactor = factor(as.character(year),levels =subyear)) - # datIN <- dat%>%filter(scen%in%c("ssp126" ,"rcp45","rcp85")) - # dat_hindIN <- dat_hind - scensIN <- c("ssp126","ssp585") GCMsIN <- GCMs thinline <- 0.7 alpha_annual <- 0.6 alpha_blocks <- 1 - pvar2 <- c("temp_bottom5m","fracbelow2","pH_bottom5m") pseason <- c("Summer","Summer","Winter") + pvar <- c("temp_bottom5m","pH_bottom5m") pseason <- c("Summer","Winter") + pvar2 <- c("temp_surface5m","temp_bottom5m") pseason2 <- c("Summer","Summer") + + pvar3 <- c("temp_surface5m","temp_bottom5m","NCaS_integrated", + "NCaS_integrated","EupS_integrated","aice","fracbelow2") + pseason3 <- c("Summer","Summer","Spring","Fall","Fall","Spring","Summer") + season_varIN <- paste0(pseason,"_",pvar) season_varIN <- paste0(pseason2,"_",pvar2) - names(season_varIN) <- c(paste(pseason2,c("SST", "BT"))) + names(season_varIN) <- c(paste(pseason2,c("SST", "BT"))) + season_varIN <- paste0(pseason3,"_",pvar3) + names(season_varIN) <- c(paste(pseason2,c("SST", "BT","Neocalanus", + "Neocalanus","Euphausiid","Sea ice","Coldpool"))) + ylablkup <- melt(season_varIN)%>%rename(season_var = value) @@ -338,8 +515,13 @@ load("ESR_EBS/midCent_N.Rdata") # Now make climatology plots # ------------------------------------ - pp_BT <- plot_weekly( varIN = "temp_bottom5m", basinIN = "SEBS", - titleIN = "SEBS Bottom temperature") + pp_BT <- plot_weekly( datIN = dat, + dat_hindIN = dat_mn_hind, + datIN_sub = dat_sub, + datIN_mn_hind_sub = dat_mn_hind_sub, + useBiascorrected=FALSE, + varIN = "temp_bottom5m", basinIN = "SEBS", + titleIN = "SEBS Bottom temperature") pp_pH <- plot_weekly( varIN = "pH_bottom5m", basinIN = "SEBS", titleIN = "SEBS Bottom pH") pp_O2 <- plot_weekly( varIN = "oxygen_bottom5m",basinIN = "SEBS", @@ -356,24 +538,43 @@ load("ESR_EBS/midCent_N.Rdata") pp_CPN <- plot_weekly( varIN = "fracbelow2", basinIN = "NEBS", titleIN = "NEBS Cold pool proxy ( fraction < 2 oC)") + # Now make annual TS # ------------------------------------ - season_var1 <- c('Summer SST' ="Summer_temp_surface5m", - 'Summer BT' = "Summer_temp_bottom5m" ) - season_var2 <- c('Summer BT' ="Summer_temp_bottom5m", + season_var1 <- c('Summer SST (oC)' ="Summer_temp_surface5m", + 'Summer BT (oC)' = "Summer_temp_bottom5m" ) + season_var2 <- c('Summer BT (oC)' ="Summer_temp_bottom5m", 'Winter pH (bottom)' = "Winter_pH_bottom5m" ) - pp_NEBS2 <- plot_annual(basinIN = "NEBS",season_varIN = season_var2, + + season_var3 <- c('Summer BT (oC)' ="Summer_temp_bottom5m", + 'Summer coldpool' ="Summer_fracbelow2", + 'Winter pH (bottom)' = "Winter_pH_bottom5m", + 'Winter sea ice' = "Winter_aice" + ) + + + test <- plot_annual( datIN = dat_s, + datIN_hind = dat_mn_s_hind, + basinIN = "NEBS", + season_varIN = c('Summer SST' ="Summer_temp_surface5m"), + futline =.5,alpha_fut =.5,alpha_loess = .4) + pp_NEBS2 <- plot_annual( datIN = dat_s, + datIN_hind = dat_mn_s_hind, + basinIN = "NEBS",season_varIN = season_var2, futline =.5,alpha_fut =.5,alpha_loess = .4) - pp_NEBS <- plot_annual(basinIN = "NEBS",season_varIN = season_var1) pp_SEBS2 <- plot_annual(basinIN = "SEBS",season_varIN = season_var2) + pp_NEBS <- plot_annual(basinIN = "NEBS",season_varIN = season_var1) pp_SEBS <- plot_annual(basinIN = "SEBS",season_varIN = season_var1) + pp_NEBS3 <- plot_annual(basinIN = "NEBS",season_varIN = season_var3) + pp_SEBS3 <- plot_annual(basinIN = "SEBS",season_varIN = season_var3) + # Now make plot of warm~GWL # ------------------------------------ gwls <- make_GWLplot(ylablkupIN = ylablkup, cmipIN = cmip6, - #titleIN = "EBS Temperatures corresponding to Global Warming Levels\n\n", - datIN = dat_s,datIN_hind = ACLIM_seasonal_hind) + datIN = dat_s, + datIN_hind = dat_mn_s_hind) varlab2 <- data.frame(var= c("temp_surface5m","temp_bottom5m"), lab2 = c("SST","BT")) @@ -438,35 +639,42 @@ load("ESR_EBS/midCent_N.Rdata") mindelta = min(mn_val-mnVal_hist), maxdelta = max(mn_val-mnVal_hist)) - save(endofCent,file="ESR_EBS/endofCent.Rdata") - save(midCent,file="ESR_EBS/midCent.Rdata") - save(endofCentN,file="ESR_EBS/endofCent_N.Rdata") - save(midCentN,file="ESR_EBS/midCent_N.Rdata") + flout <- file.path("ESR_EBS",as.Date(now())) + if(!dir.exists(flout)) + dir.create(flout) + + if(update.figs){ + + save(endofCent, file = file.path(flout,"endofCent.Rdata")) + save(midCent, file = file.path(flout,"midCent.Rdata")) + save(endofCentN,file = file.path(flout,"endofCent_N.Rdata")) + save(midCentN, file = file.path(flout,"midCent_N.Rdata")) # Make figs directory: - if(!dir.exists("ESR_EBS/Figs")) dir.create("ESR_EBS/Figs") + if(!dir.exists(file.path(flout,"Figs"))) dir.create(file.path(flout,"Figs")) # save plots: # ------------------------------- sclr <-1 - save_png(pp_NEBS2$pp, file = "ESR_EBS/Figs/annualTS_NEBS.png",w = 6*sclr, h = 6*sclr) - save_png(pp_NEBS$pp, file = "ESR_EBS/Figs/ACLIM_Holsman_Fig2.png",w = 6*sclr, h = 6*sclr) - save_png(pp_SEBS2$pp, file = "ESR_EBS/Figs/annualTS.png",w = 6*sclr, h = 6*sclr) - save_png(pp_SEBS$pp, file = "ESR_EBS/Figs/ACLIM_Holsman_Fig1.png",w = 6*sclr, h = 6*sclr) + save_png(pp_NEBS2$pp, file = file.path(flout,"annualTS_NEBS.png"),w = 6*sclr, h = 6*sclr) + save_png(pp_NEBS$pp, file = file.path(flout,"ACLIM_Holsman_Fig2.png"),w = 6*sclr, h = 6*sclr) + save_png(pp_SEBS2$pp, file= file.path(flout,"annualTS.png"),w = 6*sclr, h = 6*sclr) + save_png(pp_SEBS$pp, file = = file.path(flout,"ACLIM_Holsman_Fig1.png"),w = 6*sclr, h = 6*sclr) sclr <-1 - save_png( gwls$pp, file = "ESR_EBS/Figs/ACLIM_Holsman_Fig3.png",w = 6*sclr, h = 6*sclr) + save_png( gwls$pp, file = file.path(flout,"ACLIM_Holsman_Fig3.png"),w = 6*sclr, h = 6*sclr) sclr <-1.3 - save_png( pp_BT, file = "ESR_EBS/Figs/ACLIM_Holsman_Fig4.png",w = 6*sclr, h = 6*sclr) - save_png( pp_pH, file = "ESR_EBS/Figs/nonBC_weeklyProj_pH.png",w = 6*sclr, h = 6*sclr) - save_png( pp_O2, file = "ESR_EBS/Figs/nonBC_weeklyProj_O2.png",w = 6*sclr, h = 6*sclr) + save_png( pp_BT, file = file.path(flout,"ACLIM_Holsman_Fig4.png"),w = 6*sclr, h = 6*sclr) + save_png( pp_pH, file = file.path(flout,"nonBC_weeklyProj_pH.png"),w = 6*sclr, h = 6*sclr) + save_png( pp_O2, file = file.path(flout,"nonBC_weeklyProj_O2.png"),w = 6*sclr, h = 6*sclr) save_png( pp_CP, file = "ESR_EBS/Figs/nonBC_weeklyProj_CP.png",w = 6*sclr, h = 6*sclr) - save_png( pp_BTN, file = "ESR_EBS/Figs/ACLIM_Holsman_Fig5.png",w = 6*sclr, h = 6*sclr) - save_png( pp_pHN, file = "ESR_EBS/Figs/nonBC_weeklyProj_pH_N.png",w = 6*sclr, h = 6*sclr) - save_png( pp_O2N, file = "ESR_EBS/Figs/nonBC_weeklyProj_O2_N.png",w = 6*sclr, h = 6*sclr) - save_png( pp_CPN, file = "ESR_EBS/Figs/nonBC_weeklyProj_CP_N.png",w = 6*sclr, h = 6*sclr) + save_png( pp_BTN, file = file.path(flout,"ACLIM_Holsman_Fig5.png"),w = 6*sclr, h = 6*sclr) + save_png( pp_pHN, file = file.path(flout,"nonBC_weeklyProj_pH_N.png"),w = 6*sclr, h = 6*sclr) + save_png( pp_O2N, file = file.path(flout,"nonBC_weeklyProj_O2_N.png"),w = 6*sclr, h = 6*sclr) + save_png( pp_CPN, file = file.path(flout,"nonBC_weeklyProj_CP_N.png"),w = 6*sclr, h = 6*sclr) + } # # # now set up the docs folder diff --git a/ESR_ACLIM.tex b/ESR_ACLIM.tex old mode 100644 new mode 100755 diff --git a/ESR_EBS/ACLIM_ESR.Rmd b/ESR_EBS/ACLIM_ESR.Rmd old mode 100644 new mode 100755 diff --git a/ESR_IPCCAR6.Rmd b/ESR_IPCCAR6.Rmd old mode 100644 new mode 100755 diff --git a/ESR_IPCCAR6.html b/ESR_IPCCAR6.html old mode 100644 new mode 100755 diff --git a/Figs/ACLIM_dir.jpg b/Figs/ACLIM_dir.jpg old mode 100644 new mode 100755 diff --git a/Figs/ACLIM_dir.png b/Figs/ACLIM_dir.png old mode 100644 new mode 100755 diff --git a/Figs/ACLIM_logo.jpg b/Figs/ACLIM_logo.jpg old mode 100644 new mode 100755 diff --git a/Figs/Cop_integrated.jpg b/Figs/Cop_integrated.jpg old mode 100644 new mode 100755 diff --git a/Figs/Cop_integrateddelta.jpg b/Figs/Cop_integrateddelta.jpg old mode 100644 new mode 100755 diff --git a/Figs/Data_dir.png b/Figs/Data_dir.png old mode 100644 new mode 100755 diff --git a/Figs/Fall_large_Zoop.jpg b/Figs/Fall_large_Zoop.jpg old mode 100644 new mode 100755 diff --git a/Figs/Fall_large_Zoop_bySSP.jpg b/Figs/Fall_large_Zoop_bySSP.jpg old mode 100644 new mode 100755 diff --git a/Figs/Hind_Fall_large_Zoop.jpg b/Figs/Hind_Fall_large_Zoop.jpg old mode 100644 new mode 100755 diff --git a/Figs/Hind_M2_SST.jpg b/Figs/Hind_M2_SST.jpg old mode 100644 new mode 100755 diff --git a/Figs/Hind_Sept_large_Zoop.jpg b/Figs/Hind_Sept_large_Zoop.jpg old mode 100644 new mode 100755 diff --git a/Figs/Hind_sub_grid_mn_BT_Aug1.jpg b/Figs/Hind_sub_grid_mn_BT_Aug1.jpg old mode 100644 new mode 100755 diff --git a/Figs/Holsmanetal2020_effectiveF.jpg b/Figs/Holsmanetal2020_effectiveF.jpg old mode 100644 new mode 100755 diff --git a/Figs/PhenShift_large_Zoop.jpg b/Figs/PhenShift_large_Zoop.jpg old mode 100644 new mode 100755 diff --git a/Figs/Sept_large_Zoop.jpg b/Figs/Sept_large_Zoop.jpg old mode 100644 new mode 100755 diff --git a/Figs/Strata_Kearney2021.png b/Figs/Strata_Kearney2021.png old mode 100644 new mode 100755 diff --git a/Figs/aice.jpg b/Figs/aice.jpg old mode 100644 new mode 100755 diff --git a/Figs/aicedelta.jpg b/Figs/aicedelta.jpg old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Ben_afplot.png b/Figs/bc_plots/Ben_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Ben_bcplot.png b/Figs/bc_plots/Ben_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Ben_sfplot.png b/Figs/bc_plots/Ben_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Cop_integrated_afplot.png b/Figs/bc_plots/Cop_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Cop_integrated_bcplot.png b/Figs/bc_plots/Cop_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Cop_integrated_sfplot.png b/Figs/bc_plots/Cop_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Cop_surface5m_afplot.png b/Figs/bc_plots/Cop_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Cop_surface5m_bcplot.png b/Figs/bc_plots/Cop_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Cop_surface5m_sfplot.png b/Figs/bc_plots/Cop_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/DetBen_afplot.png b/Figs/bc_plots/DetBen_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/DetBen_bcplot.png b/Figs/bc_plots/DetBen_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/DetBen_sfplot.png b/Figs/bc_plots/DetBen_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupO_integrated_afplot.png b/Figs/bc_plots/EupO_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupO_integrated_bcplot.png b/Figs/bc_plots/EupO_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupO_integrated_sfplot.png b/Figs/bc_plots/EupO_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupO_surface5m_afplot.png b/Figs/bc_plots/EupO_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupO_surface5m_bcplot.png b/Figs/bc_plots/EupO_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupO_surface5m_sfplot.png b/Figs/bc_plots/EupO_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupS_integrated_afplot.png b/Figs/bc_plots/EupS_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupS_integrated_bcplot.png b/Figs/bc_plots/EupS_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupS_integrated_sfplot.png b/Figs/bc_plots/EupS_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupS_surface5m_afplot.png b/Figs/bc_plots/EupS_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupS_surface5m_bcplot.png b/Figs/bc_plots/EupS_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/EupS_surface5m_sfplot.png b/Figs/bc_plots/EupS_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_bottom5m_afplot.png b/Figs/bc_plots/Fe_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_bottom5m_bcplot.png b/Figs/bc_plots/Fe_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_bottom5m_sfplot.png b/Figs/bc_plots/Fe_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_integrated_afplot.png b/Figs/bc_plots/Fe_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_integrated_bcplot.png b/Figs/bc_plots/Fe_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_integrated_sfplot.png b/Figs/bc_plots/Fe_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_surface5m_afplot.png b/Figs/bc_plots/Fe_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_surface5m_bcplot.png b/Figs/bc_plots/Fe_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Fe_surface5m_sfplot.png b/Figs/bc_plots/Fe_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Hsbl_afplot.png b/Figs/bc_plots/Hsbl_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Hsbl_bcplot.png b/Figs/bc_plots/Hsbl_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Hsbl_sfplot.png b/Figs/bc_plots/Hsbl_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IceNH4_afplot.png b/Figs/bc_plots/IceNH4_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IceNH4_bcplot.png b/Figs/bc_plots/IceNH4_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IceNH4_sfplot.png b/Figs/bc_plots/IceNH4_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IceNO3_afplot.png b/Figs/bc_plots/IceNO3_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IceNO3_bcplot.png b/Figs/bc_plots/IceNO3_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IceNO3_sfplot.png b/Figs/bc_plots/IceNO3_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IcePhL_afplot.png b/Figs/bc_plots/IcePhL_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IcePhL_bcplot.png b/Figs/bc_plots/IcePhL_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/IcePhL_sfplot.png b/Figs/bc_plots/IcePhL_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Jel_integrated_afplot.png b/Figs/bc_plots/Jel_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Jel_integrated_bcplot.png b/Figs/bc_plots/Jel_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Jel_integrated_sfplot.png b/Figs/bc_plots/Jel_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Jel_surface5m_afplot.png b/Figs/bc_plots/Jel_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Jel_surface5m_bcplot.png b/Figs/bc_plots/Jel_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/Jel_surface5m_sfplot.png b/Figs/bc_plots/Jel_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/MZL_integrated_afplot.png b/Figs/bc_plots/MZL_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/MZL_integrated_bcplot.png b/Figs/bc_plots/MZL_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/MZL_integrated_sfplot.png b/Figs/bc_plots/MZL_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/MZL_surface5m_afplot.png b/Figs/bc_plots/MZL_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/MZL_surface5m_bcplot.png b/Figs/bc_plots/MZL_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/MZL_surface5m_sfplot.png b/Figs/bc_plots/MZL_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaO_integrated_afplot.png b/Figs/bc_plots/NCaO_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaO_integrated_bcplot.png b/Figs/bc_plots/NCaO_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaO_integrated_sfplot.png b/Figs/bc_plots/NCaO_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaO_surface5m_afplot.png b/Figs/bc_plots/NCaO_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaO_surface5m_bcplot.png b/Figs/bc_plots/NCaO_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaO_surface5m_sfplot.png b/Figs/bc_plots/NCaO_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaS_integrated_afplot.png b/Figs/bc_plots/NCaS_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaS_integrated_bcplot.png b/Figs/bc_plots/NCaS_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaS_integrated_sfplot.png b/Figs/bc_plots/NCaS_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaS_surface5m_afplot.png b/Figs/bc_plots/NCaS_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaS_surface5m_bcplot.png b/Figs/bc_plots/NCaS_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NCaS_surface5m_sfplot.png b/Figs/bc_plots/NCaS_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_bottom5m_afplot.png b/Figs/bc_plots/NH4_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_bottom5m_bcplot.png b/Figs/bc_plots/NH4_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_bottom5m_sfplot.png b/Figs/bc_plots/NH4_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_depthavg_afplot.png b/Figs/bc_plots/NH4_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_depthavg_bcplot.png b/Figs/bc_plots/NH4_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_depthavg_sfplot.png b/Figs/bc_plots/NH4_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_integrated_afplot.png b/Figs/bc_plots/NH4_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_integrated_bcplot.png b/Figs/bc_plots/NH4_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_integrated_sfplot.png b/Figs/bc_plots/NH4_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_surface5m_afplot.png b/Figs/bc_plots/NH4_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_surface5m_bcplot.png b/Figs/bc_plots/NH4_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NH4_surface5m_sfplot.png b/Figs/bc_plots/NH4_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_bottom5m_afplot.png b/Figs/bc_plots/NO3_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_bottom5m_bcplot.png b/Figs/bc_plots/NO3_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_bottom5m_sfplot.png b/Figs/bc_plots/NO3_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_depthavg_afplot.png b/Figs/bc_plots/NO3_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_depthavg_bcplot.png b/Figs/bc_plots/NO3_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_depthavg_sfplot.png b/Figs/bc_plots/NO3_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_integrated_afplot.png b/Figs/bc_plots/NO3_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_integrated_bcplot.png b/Figs/bc_plots/NO3_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_integrated_sfplot.png b/Figs/bc_plots/NO3_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_surface5m_afplot.png b/Figs/bc_plots/NO3_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_surface5m_bcplot.png b/Figs/bc_plots/NO3_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/NO3_surface5m_sfplot.png b/Figs/bc_plots/NO3_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhL_integrated_afplot.png b/Figs/bc_plots/PhL_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhL_integrated_bcplot.png b/Figs/bc_plots/PhL_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhL_integrated_sfplot.png b/Figs/bc_plots/PhL_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhL_surface5m_afplot.png b/Figs/bc_plots/PhL_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhL_surface5m_bcplot.png b/Figs/bc_plots/PhL_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhL_surface5m_sfplot.png b/Figs/bc_plots/PhL_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhS_integrated_afplot.png b/Figs/bc_plots/PhS_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhS_integrated_bcplot.png b/Figs/bc_plots/PhS_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhS_integrated_sfplot.png b/Figs/bc_plots/PhS_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhS_surface5m_afplot.png b/Figs/bc_plots/PhS_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhS_surface5m_bcplot.png b/Figs/bc_plots/PhS_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/PhS_surface5m_sfplot.png b/Figs/bc_plots/PhS_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_bottom5m_afplot.png b/Figs/bc_plots/TIC_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_bottom5m_bcplot.png b/Figs/bc_plots/TIC_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_bottom5m_sfplot.png b/Figs/bc_plots/TIC_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_depthavg_afplot.png b/Figs/bc_plots/TIC_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_depthavg_bcplot.png b/Figs/bc_plots/TIC_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_depthavg_sfplot.png b/Figs/bc_plots/TIC_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_integrated_afplot.png b/Figs/bc_plots/TIC_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_integrated_bcplot.png b/Figs/bc_plots/TIC_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_integrated_sfplot.png b/Figs/bc_plots/TIC_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_surface5m_afplot.png b/Figs/bc_plots/TIC_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_surface5m_bcplot.png b/Figs/bc_plots/TIC_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/TIC_surface5m_sfplot.png b/Figs/bc_plots/TIC_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/aice_afplot.png b/Figs/bc_plots/aice_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/aice_bcplot.png b/Figs/bc_plots/aice_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/aice_sfplot.png b/Figs/bc_plots/aice_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_bottom5m_afplot.png b/Figs/bc_plots/alkalinity_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_bottom5m_bcplot.png b/Figs/bc_plots/alkalinity_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_bottom5m_sfplot.png b/Figs/bc_plots/alkalinity_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_depthavg_afplot.png b/Figs/bc_plots/alkalinity_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_depthavg_bcplot.png b/Figs/bc_plots/alkalinity_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_depthavg_sfplot.png b/Figs/bc_plots/alkalinity_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_integrated_afplot.png b/Figs/bc_plots/alkalinity_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_integrated_bcplot.png b/Figs/bc_plots/alkalinity_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_integrated_sfplot.png b/Figs/bc_plots/alkalinity_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_surface5m_afplot.png b/Figs/bc_plots/alkalinity_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_surface5m_bcplot.png b/Figs/bc_plots/alkalinity_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/alkalinity_surface5m_sfplot.png b/Figs/bc_plots/alkalinity_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_bottom5m_afplot.png b/Figs/bc_plots/arag_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_bottom5m_bcplot.png b/Figs/bc_plots/arag_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_bottom5m_sfplot.png b/Figs/bc_plots/arag_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_depthavg_afplot.png b/Figs/bc_plots/arag_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_depthavg_bcplot.png b/Figs/bc_plots/arag_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_depthavg_sfplot.png b/Figs/bc_plots/arag_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_integrated_afplot.png b/Figs/bc_plots/arag_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_integrated_bcplot.png b/Figs/bc_plots/arag_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_integrated_sfplot.png b/Figs/bc_plots/arag_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_surface5m_afplot.png b/Figs/bc_plots/arag_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_surface5m_bcplot.png b/Figs/bc_plots/arag_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/arag_surface5m_sfplot.png b/Figs/bc_plots/arag_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_bottom5m_afplot.png b/Figs/bc_plots/calcite_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_bottom5m_bcplot.png b/Figs/bc_plots/calcite_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_bottom5m_sfplot.png b/Figs/bc_plots/calcite_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_depthavg_afplot.png b/Figs/bc_plots/calcite_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_depthavg_bcplot.png b/Figs/bc_plots/calcite_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_depthavg_sfplot.png b/Figs/bc_plots/calcite_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_integrated_afplot.png b/Figs/bc_plots/calcite_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_integrated_bcplot.png b/Figs/bc_plots/calcite_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_integrated_sfplot.png b/Figs/bc_plots/calcite_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_surface5m_afplot.png b/Figs/bc_plots/calcite_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_surface5m_bcplot.png b/Figs/bc_plots/calcite_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/calcite_surface5m_sfplot.png b/Figs/bc_plots/calcite_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow0_afplot.png b/Figs/bc_plots/fracbelow0_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow0_bcplot.png b/Figs/bc_plots/fracbelow0_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow0_sfplot.png b/Figs/bc_plots/fracbelow0_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow1_afplot.png b/Figs/bc_plots/fracbelow1_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow1_bcplot.png b/Figs/bc_plots/fracbelow1_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow1_sfplot.png b/Figs/bc_plots/fracbelow1_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow2_afplot.png b/Figs/bc_plots/fracbelow2_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow2_bcplot.png b/Figs/bc_plots/fracbelow2_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/fracbelow2_sfplot.png b/Figs/bc_plots/fracbelow2_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/hice_afplot.png b/Figs/bc_plots/hice_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/hice_bcplot.png b/Figs/bc_plots/hice_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/hice_sfplot.png b/Figs/bc_plots/hice_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/largeZoop_integrated_afplot.png b/Figs/bc_plots/largeZoop_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/largeZoop_integrated_bcplot.png b/Figs/bc_plots/largeZoop_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/largeZoop_integrated_sfplot.png b/Figs/bc_plots/largeZoop_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_bottom5m_afplot.png b/Figs/bc_plots/oxygen_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_bottom5m_bcplot.png b/Figs/bc_plots/oxygen_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_bottom5m_sfplot.png b/Figs/bc_plots/oxygen_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_depthavg_afplot.png b/Figs/bc_plots/oxygen_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_depthavg_bcplot.png b/Figs/bc_plots/oxygen_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_depthavg_sfplot.png b/Figs/bc_plots/oxygen_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_integrated_afplot.png b/Figs/bc_plots/oxygen_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_integrated_bcplot.png b/Figs/bc_plots/oxygen_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_integrated_sfplot.png b/Figs/bc_plots/oxygen_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_surface5m_afplot.png b/Figs/bc_plots/oxygen_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_surface5m_bcplot.png b/Figs/bc_plots/oxygen_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/oxygen_surface5m_sfplot.png b/Figs/bc_plots/oxygen_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_bottom5m_afplot.png b/Figs/bc_plots/pH_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_bottom5m_bcplot.png b/Figs/bc_plots/pH_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_bottom5m_sfplot.png b/Figs/bc_plots/pH_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_depthavg_afplot.png b/Figs/bc_plots/pH_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_depthavg_bcplot.png b/Figs/bc_plots/pH_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_depthavg_sfplot.png b/Figs/bc_plots/pH_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_integrated_afplot.png b/Figs/bc_plots/pH_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_integrated_bcplot.png b/Figs/bc_plots/pH_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_integrated_sfplot.png b/Figs/bc_plots/pH_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_surface5m_afplot.png b/Figs/bc_plots/pH_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_surface5m_bcplot.png b/Figs/bc_plots/pH_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/pH_surface5m_sfplot.png b/Figs/bc_plots/pH_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/prod_PhL_integrated_afplot.png b/Figs/bc_plots/prod_PhL_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/prod_PhL_integrated_bcplot.png b/Figs/bc_plots/prod_PhL_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/prod_PhL_integrated_sfplot.png b/Figs/bc_plots/prod_PhL_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/prod_PhS_integrated_afplot.png b/Figs/bc_plots/prod_PhS_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/prod_PhS_integrated_bcplot.png b/Figs/bc_plots/prod_PhS_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/prod_PhS_integrated_sfplot.png b/Figs/bc_plots/prod_PhS_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/salt_surface5m_afplot.png b/Figs/bc_plots/salt_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/salt_surface5m_bcplot.png b/Figs/bc_plots/salt_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/salt_surface5m_sfplot.png b/Figs/bc_plots/salt_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/shflux_afplot.png b/Figs/bc_plots/shflux_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/shflux_bcplot.png b/Figs/bc_plots/shflux_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/shflux_sfplot.png b/Figs/bc_plots/shflux_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/ssflux_afplot.png b/Figs/bc_plots/ssflux_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/ssflux_bcplot.png b/Figs/bc_plots/ssflux_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/ssflux_sfplot.png b/Figs/bc_plots/ssflux_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_bottom5m_afplot.png b/Figs/bc_plots/temp_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_bottom5m_bcplot.png b/Figs/bc_plots/temp_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_bottom5m_sfplot.png b/Figs/bc_plots/temp_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_depthavg_afplot.png b/Figs/bc_plots/temp_depthavg_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_depthavg_bcplot.png b/Figs/bc_plots/temp_depthavg_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_depthavg_sfplot.png b/Figs/bc_plots/temp_depthavg_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_integrated_afplot.png b/Figs/bc_plots/temp_integrated_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_integrated_bcplot.png b/Figs/bc_plots/temp_integrated_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_integrated_sfplot.png b/Figs/bc_plots/temp_integrated_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_surface5m_afplot.png b/Figs/bc_plots/temp_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_surface5m_bcplot.png b/Figs/bc_plots/temp_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/temp_surface5m_sfplot.png b/Figs/bc_plots/temp_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/uEast_bottom5m_afplot.png b/Figs/bc_plots/uEast_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/uEast_bottom5m_bcplot.png b/Figs/bc_plots/uEast_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/uEast_bottom5m_sfplot.png b/Figs/bc_plots/uEast_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/uEast_surface5m_afplot.png b/Figs/bc_plots/uEast_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/uEast_surface5m_bcplot.png b/Figs/bc_plots/uEast_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/uEast_surface5m_sfplot.png b/Figs/bc_plots/uEast_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/vNorth_bottom5m_afplot.png b/Figs/bc_plots/vNorth_bottom5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/vNorth_bottom5m_bcplot.png b/Figs/bc_plots/vNorth_bottom5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/vNorth_bottom5m_sfplot.png b/Figs/bc_plots/vNorth_bottom5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/vNorth_surface5m_afplot.png b/Figs/bc_plots/vNorth_surface5m_afplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/vNorth_surface5m_bcplot.png b/Figs/bc_plots/vNorth_surface5m_bcplot.png old mode 100644 new mode 100755 diff --git a/Figs/bc_plots/vNorth_surface5m_sfplot.png b/Figs/bc_plots/vNorth_surface5m_sfplot.png old mode 100644 new mode 100755 diff --git a/Figs/biascorrected_temp.png b/Figs/biascorrected_temp.png old mode 100644 new mode 100755 diff --git a/Figs/biascorrected_temp2.png b/Figs/biascorrected_temp2.png old mode 100644 new mode 100755 diff --git a/Figs/catalog.jpg b/Figs/catalog.jpg old mode 100644 new mode 100755 diff --git a/Figs/clone.jpg b/Figs/clone.jpg old mode 100644 new mode 100755 diff --git a/Figs/cluster_NEBS.jpg b/Figs/cluster_NEBS.jpg old mode 100644 new mode 100755 diff --git a/Figs/cluster_SEBS.jpg b/Figs/cluster_SEBS.jpg old mode 100644 new mode 100755 diff --git a/Figs/compare_scaled2raw_2022.png b/Figs/compare_scaled2raw_2022.png old mode 100644 new mode 100755 diff --git a/Figs/compare_scaled2raw_2022_all.png b/Figs/compare_scaled2raw_2022_all.png old mode 100644 new mode 100755 diff --git a/Figs/compare_scaled2raw_2022_all_zoop.png b/Figs/compare_scaled2raw_2022_all_zoop.png old mode 100644 new mode 100755 diff --git a/Figs/data tree.pptx b/Figs/data tree.pptx old mode 100644 new mode 100755 diff --git a/Figs/data_dir.jpg b/Figs/data_dir.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/.DS_Store b/Figs/energetics copy/.DS_Store old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/basin.jpg b/Figs/energetics copy/basin.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_G_ggd.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_R_Act_ggd.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_fTc.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_fTr.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_metabolic_ratio.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_val.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_cod_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_G_ggd.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_R_Act_ggd.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_fTc.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_fTr.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_metabolic_ratio.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_val.jpg b/Figs/energetics copy/mn_hindcast_BT_Pacific_halibut_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_G_ggd.jpg b/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_R_Act_ggd.jpg b/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_fTc.jpg b/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_fTr.jpg b/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_val.jpg b/Figs/energetics copy/mn_hindcast_BT_Walley_pollock_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/strata.jpg b/Figs/energetics copy/strata.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_G_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_R_Act_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_fTc.jpg b/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_fTr.jpg b/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_metabolic_ratio.jpg b/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_val.jpg b/Figs/energetics copy/ts_hindvsforecast_Arrowtooth_flounder_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_G_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_R_Act_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_fTc.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_fTr.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_metabolic_ratio.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_val.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_cod_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_G_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_R_Act_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_fTc.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_fTr.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_metabolic_ratio.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_val.jpg b/Figs/energetics copy/ts_hindvsforecast_Pacific_halibut_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Sablefish_G_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Sablefish_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Sablefish_R_Act_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Sablefish_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Sablefish_fTc.jpg b/Figs/energetics copy/ts_hindvsforecast_Sablefish_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Sablefish_fTr.jpg b/Figs/energetics copy/ts_hindvsforecast_Sablefish_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Sablefish_metabolic_ratio.jpg b/Figs/energetics copy/ts_hindvsforecast_Sablefish_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Sablefish_val.jpg b/Figs/energetics copy/ts_hindvsforecast_Sablefish_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_G_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_R_Act_ggd.jpg b/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_fTc.jpg b/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_fTr.jpg b/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_metabolic_ratio.jpg b/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_val.jpg b/Figs/energetics copy/ts_hindvsforecast_Walley_pollock_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/.DS_Store b/Figs/energetics/.DS_Store old mode 100644 new mode 100755 diff --git a/Figs/energetics/basin.jpg b/Figs/energetics/basin.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Arrowtooth_flounder_fTc.jpg b/Figs/energetics/mn_hindcast_BT_Arrowtooth_flounder_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Arrowtooth_flounder_val.jpg b/Figs/energetics/mn_hindcast_BT_Arrowtooth_flounder_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_cod_G_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_cod_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_cod_R_Act_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_cod_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_cod_fTc.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_cod_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_cod_fTr.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_cod_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_cod_metabolic_ratio.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_cod_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_cod_val.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_cod_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_halibut_G_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_halibut_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_halibut_R_Act_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_halibut_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_halibut_fTc.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_halibut_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_halibut_fTr.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_halibut_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_halibut_metabolic_ratio.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_halibut_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Pacific_halibut_val.jpg b/Figs/energetics/mn_hindcast_BT_Pacific_halibut_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Sablefish_G_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Sablefish_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Sablefish_R_Act_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Sablefish_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Sablefish_fTc.jpg b/Figs/energetics/mn_hindcast_BT_Sablefish_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Sablefish_fTr.jpg b/Figs/energetics/mn_hindcast_BT_Sablefish_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Sablefish_metabolic_ratio.jpg b/Figs/energetics/mn_hindcast_BT_Sablefish_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Sablefish_val.jpg b/Figs/energetics/mn_hindcast_BT_Sablefish_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Walley_pollock_G_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Walley_pollock_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Walley_pollock_R_Act_ggd.jpg b/Figs/energetics/mn_hindcast_BT_Walley_pollock_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Walley_pollock_fTc.jpg b/Figs/energetics/mn_hindcast_BT_Walley_pollock_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Walley_pollock_fTr.jpg b/Figs/energetics/mn_hindcast_BT_Walley_pollock_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Walley_pollock_metabolic_ratio.jpg b/Figs/energetics/mn_hindcast_BT_Walley_pollock_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/mn_hindcast_BT_Walley_pollock_val.jpg b/Figs/energetics/mn_hindcast_BT_Walley_pollock_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/strata.jpg b/Figs/energetics/strata.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_G_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_R_Act_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_fTc.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_fTc_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_fTc_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_fTr.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_metabolic_ratio.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_val.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_val_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Arrowtooth_flounder_val_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_G_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_G_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_G_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_R_Act_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_R_Act_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_R_Act_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTc.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTc_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTc_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTr.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTr_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_fTr_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_metabolic_ratio.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_metabolic_ratio_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_metabolic_ratio_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_val.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_cod_val_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_cod_val_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_G_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_G_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_G_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_R_Act_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_R_Act_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_R_Act_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTc.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTc_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTc_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTr.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTr_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_fTr_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_metabolic_ratio.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_metabolic_ratio_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_metabolic_ratio_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_val.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Pacific_halibut_val_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Pacific_halibut_val_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_G_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_G_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_G_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_R_Act_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_R_Act_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_R_Act_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_fTc.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_fTc_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_fTc_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_fTr.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_fTr_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_fTr_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_metabolic_ratio.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_metabolic_ratio_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_metabolic_ratio_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_val.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Sablefish_val_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Sablefish_val_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_G_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_G_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_G_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_G_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_R_Act_ggd.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_R_Act_ggd.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_R_Act_ggd_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_R_Act_ggd_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTc.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTc.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTc_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTc_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTr.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTr.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTr_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_fTr_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_metabolic_ratio.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_metabolic_ratio.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_metabolic_ratio_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_metabolic_ratio_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_val.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_val.jpg old mode 100644 new mode 100755 diff --git a/Figs/energetics/ts_hindvsforecast_Walley_pollock_val_ratioNvsS.jpg b/Figs/energetics/ts_hindvsforecast_Walley_pollock_val_ratioNvsS.jpg old mode 100644 new mode 100755 diff --git a/Figs/filestructure.jpg b/Figs/filestructure.jpg old mode 100644 new mode 100755 diff --git a/Figs/filestructure2.jpg b/Figs/filestructure2.jpg old mode 100644 new mode 100755 diff --git a/Figs/hind_weekly_byreg.jpg b/Figs/hind_weekly_byreg.jpg old mode 100644 new mode 100755 diff --git a/Figs/hind_weekly_bystrata.jpg b/Figs/hind_weekly_bystrata.jpg old mode 100644 new mode 100755 diff --git a/Figs/logos1.jpg b/Figs/logos1.jpg old mode 100644 new mode 100755 diff --git a/Figs/logos2.jpg b/Figs/logos2.jpg old mode 100644 new mode 100755 diff --git a/Figs/minimal_coldpool.jpg b/Figs/minimal_coldpool.jpg old mode 100644 new mode 100755 diff --git a/Figs/mn_BT.jpg b/Figs/mn_BT.jpg old mode 100644 new mode 100755 diff --git a/Figs/mn_hindcast_BT.jpg b/Figs/mn_hindcast_BT.jpg old mode 100644 new mode 100755 diff --git a/Figs/mn_hindcast_mhw.jpg b/Figs/mn_hindcast_mhw.jpg old mode 100644 new mode 100755 diff --git a/Figs/stations.jpg b/Figs/stations.jpg old mode 100644 new mode 100755 diff --git a/Figs/stations_NS.jpg b/Figs/stations_NS.jpg old mode 100644 new mode 100755 diff --git a/Figs/sub_grid_mn_BT_Aug1.jpg b/Figs/sub_grid_mn_BT_Aug1.jpg old mode 100644 new mode 100755 diff --git a/Figs/weekly_byreg.jpg b/Figs/weekly_byreg.jpg old mode 100644 new mode 100755 diff --git a/Figs/weekly_bystrata.jpg b/Figs/weekly_bystrata.jpg old mode 100644 new mode 100755 diff --git a/Figs/zoop_raw.jpg b/Figs/zoop_raw.jpg old mode 100644 new mode 100755 diff --git a/Figs/zoop_recentered_scaled.jpg b/Figs/zoop_recentered_scaled.jpg old mode 100644 new mode 100755 diff --git a/GettingStarted_Bering10K_ROMSNPZ copy.Rmd b/GettingStarted_Bering10K_ROMSNPZ copy.Rmd new file mode 100755 index 0000000..6a87af9 --- /dev/null +++ b/GettingStarted_Bering10K_ROMSNPZ copy.Rmd @@ -0,0 +1,2021 @@ +--- +title: "Getting Started with Bering10K Level 2 & 3 indices" +author: K. Holsman and K. Aydin (Tutorial), A. Hermann, K. Kearney, W. Cheng, I. Ortiz (Bering10K) +output: + pdf_document: + fig_caption: yes + fig_height: 4 + fig_width: 5 + highlight: tango + keep_tex: yes + latex_engine: xelatex + toc: TRUE + word_document: + fig_caption: yes + fig_width: 4 + keep_md: yes + header-includes: + - \usepackage{inputenc} + - \usepackage{unicode-math} + - \pagenumbering{gobble} + html_document: + df_print: kable + fig_caption: yes + theme: flatly + toc: true + toc_float: true +--- + +```{r startup, eval=TRUE, echo=FALSE, results='hide',message=FALSE} + + #source("R/make.R") # loads packages, data, setup, etc. + knitr::opts_chunk$set(echo = T, fig.align="center") + thisYr <- format(Sys.time(), "%Y") + today <- format(Sys.time(), "%b %d, %Y") + + # -------------------------------------- + # SETUP WORKSPACE + + tmstp <- format(Sys.time(), "%Y_%m_%d") + main <- getwd() #"~/GitHub_new/ACLIM2" +``` + +```{r startup2, eval=TRUE, echo=TRUE, results='hide',message=FALSE} + # loads packages, data, setup, etc. + suppressWarnings(source("R/make.R")) +``` + + + + + + + +![The ACLIM2 Repository [**github.com/kholsman/ACLIM2**](https://github.com/kholsman/ACLIM2 "ACLIM2 Repo") is maintained by **[Kirstin Holsman](mailto:kirstin.holsman@noaa.gov)**, Alaska Fisheries Science Center, NOAA Fisheries, Seattle WA. Multiple programs and projects have supported the production and sharing of the suite of Bering10K hindcasts and projections. *Last updated: `r today`*](Figs/logos2.jpg){ width=100%} + + +# 1. Overview {.tabset} + +This repository contains R code and Rdata files for working with netcdf-format data generated from the [**downscaled ROMSNPZ modeling**](https://beringnpz.github.io/roms-bering-sea) of the ROMSNPZ Bering Sea Ocean Modeling team; Drs. Hermann, Cheng, Kearney, Pilcher,Ortiz, and Aydin. The code and R resources described in this tutorial are publicly available through the [**ACLIM2 github repository**](https://github.com/kholsman/ACLIM2) maintained by [Kirstin Holsman](mailto:kirstin.holsman@noaa.gov) as part of NOAA's [**ACLIM project**](https://www.fisheries.noaa.gov/alaska/ecosystems/alaska-climate-integrated-modeling-project) for the Bering Sea. *See [Hollowed et al. 2020](https://www.frontiersin.org/articles/10.3389/fmars.2019.00775/full) for more information about the ACLIM project.* + + +## 1.1. Resources + +We **strongly recommend** reviewing the following documentation before using the data in order to understand the origin of the indices and their present level of skill and validation, which varies considerably across indices and in space and time: + + * [**The Bering10K Dataset documentation (pdf)**](https://zenodo.org/record/4586950/files/Bering10K_dataset_documentation.pdf): A pdf describing the dataset, including full model descriptions, inputs for specific results, and a tutorial for working directly with the ROMS native grid (Level 1 outputs). + + * [**Bering10K Simulaton Variables (xlsx)**](https://zenodo.org/record/4586950/files/Bering10K_simulation_variables.xlsx?download=1): A spreadsheet listing all simulations and the archived output variables associated with each, updated periodically as new simulations are run or new variables are made available. + + * A [**collection**](https://beringnpz.github.io/roms-bering-sea/B10K-dataset-docs/) of Bering10K ROMSNPZ model documentation (including the above files) is maintained by [Kelly Kearney](mailto:kelly.kearney@noaa.gov) and will be regularly updated with new documentation and publications. + + +## 1.2 Guildlines for use and citation of the data + +The data described here are published and publicly available for use, except as explicitly noted. However, for novel uses of the data, it is **strongly recommended** that you consult with and consider including at least one author from the ROMSNPZ team (Drs. Hermann, Cheng, Kearney, Pilcher, Aydin, Ortiz). There are multiple spatial and temporal caveats that are best described in discussions with the authors of these data and inclusion as co-authors will facilitate appropriate application and interpretation. + +### 1.2.1. The Bering 10K Model (v. H16) with 10 depth layers + +The H16 model is the original BSIERP era 10 depth layer model with a 10 Km grid. This version was used in ACLIM1.0 to dynamically downscaled 3 global scale general circulation models (GCMs) under two CMIP ([Coupled Model Intercomparison Project](https://www.wcrp-climate.org/wgcm-cmip)]) phase 5 representative carbon pathways (RCP): RCP 4.5 or "moderate global carbon mitigation" and RCP 8.5 "high baseline global carbon emissions". Details of the model and projections can be found in: + +* **Hindcast (1979-2012; updated to 2018 during ACLIM 1.0):** + + Hermann, A. J., G. A. Gibson, N. A. Bond, E. N. Curchitser, K. Hedstrom, W. Cheng, M. Wang, E. D. Cokelet, P. J. Stabeno, and K. Aydin. 2016. Projected future biophysical states of the Bering Sea. Deep Sea Research Part II: Topical Studies in Oceanography 134:30–47. [doi:10.1016/j.dsr2.2015.11.001](http://dx.doi.org/10.1016/j.dsr2.2015.11.001 "doi:10.1016/j.dsr2.2015.11.001") + +* **Projections of the H16 10 layer model using CMIP5 scenarios:** + + Hermann, A. J., G. A. Gibson, W. Cheng, I. Ortiz, K. Aydin, M. Wang, A. B. Hollowed, K. K. Holsman, and S. Sathyendranath. 2019. Projected biophysical conditions of the Bering Sea to 2100 under multiple emission scenarios. ICES Journal of Marine Science 76:1280–1304. [doi:10.1093/icesjms/fsz043](https://academic.oup.com/icesjms/article/76/5/1280/5477847?login=true "doi:10.1093/icesjms/fsz043") + +### 1.2.2. The Bering 10K Model (v. K20) with 30 depth layers and other advancements + +The Bering10K model was subsequently updated by Kearney et al. 2020 (30 layer and other NPZ updates) and Pilcher et al .2019 (OA and O2 dynamics) and this version is used for the projections in ACLIM2.0 under the most recent CMIP phase 6. + +* **Hindcast (1979-2020 hindcast with OA dynamics used in ACLIM 2.0):** + + Kearney, K., A. Hermann, W. Cheng, I. Ortiz, and K. Aydin. 2020. A coupled pelagic-benthic-sympagic biogeochemical model for the Bering Sea: documentation and validation of the BESTNPZ model (v2019.08.23) within a high-resolution regional ocean model. Geoscientific Model Development 13:597–650. [doi:10.5194/gmd-13-597-2020](https://doi.org/10.5194/gmd-13-597-2020) + + Pilcher, D. J., D. M. Naiman, J. N. Cross, A. J. Hermann, S. A. Siedlecki, G. A. Gibson, and J. T. Mathis. 2019. Modeled Effect of Coastal Biogeochemical Processes, Climate Variability, and Ocean Acidification on Aragonite Saturation State in the Bering Sea. Frontiers in Marine Science 5:1–18. [doi: 10.3389/fmars.2018.00508](https://www.frontiersin.org/articles/10.3389/fmars.2018.00508/full) + +# 2. Installation {.tabset} + +## 2.1 Minimal Install + +A minimal R install (for Sections 3.2 and 4.1 only) requires installing the `ncdf4`, `devtools` libraries (available on CRAN), and `thredds` R library through its github site: + +``` {r install_light, eval = FALSE,echo =T} + install.packages("devtools") + install.packages("ncdf4") + devtools::install_github("bocinsky/thredds") +``` + +Note that each of these has multiple sub-dependent libraries and may take several minutes to install. *The full install below includes installation of these packages, so you don't need to perform this step if you perform the full install.* + +## 2.2 Full install + +The full install consists of the full directory structure in the ACLIM2 Repo; this includes a substantial set of resource files including shape files and data for performing Bering Sea spatial analysis in R. This will eventually become a library package, but currently requires manual downloading of the full directory structure from github. The full install may take up to **1GB of disk space** (initial download ~12MB). + +### Option 1: Clone the repository + +If you have git installed and can work with it, this is the preferred method as it preserves all directory structure and can aid in future updating. Use this from a **terminal command line, not in R**, to clone the full ACLIM2 directory and subdirectories: + +```{bash, eval = FALSE,echo =T} + git clone https://github.com/kholsman/ACLIM2.git +``` + +### Option 2: Download the repository +Download the full zip archive directly from the [**ACLIM2 Repo**](https://github.com/kholsman/ACLIM2) using this link: [**https://github.com/kholsman/ACLIM2/archive/main.zip**](https://github.com/kholsman/ACLIM2/archive/main.zip), and unzip its contents while preserving directory structure. ***Important:*** +if downloading from zip, please **rename the root folder** from `ACLIM2-main` (in the zipfile) to `ACLIM2` (name used in cloned copies) after unzipping, for consistency in the following examples. + + +### Option 3: Use R to download the repository + +This set of commands, run within R, downloads the ACLIM2 repository and unpacks it, with the ACLIM2 directory structrue being located in the specified `download_path`. This also performs the folder renaming mentioned in Option 2. + +```{r gitdwnld, eval = FALSE,echo =T} + # Specify the download directory + main_nm <- "ACLIM2" + + # Note: Edit download_path for preference + download_path <- path.expand("~") + dest_fldr <- file.path(download_path,main_nm) + + url <- "https://github.com/kholsman/ACLIM2/archive/main.zip" + dest_file <- file.path(download_path,paste0(main_nm,".zip")) + download.file(url=url, destfile=dest_file) + + # unzip the .zip file + setwd(download_path) + unzip (dest_file, exdir = download_path,overwrite = T) + + #rename the unzipped folder from ACLIM2-main to ACLIM2 + file.rename(paste0(main_nm,"-main"), main_nm) + setwd(main_nm) +``` + +## 2.3 Set up envionment and get shapefiles (full install) + +The remainder of this tutorial was tested in RStudio. This may work in "plain" R, but is untested. If you are using RStudio, open `ACLIM2.Rproj` in Rstudio. If using R, use `setwd()` to get to the main ACLIM2 directory. Then run: + +``` {r setup_main,include=TRUE, eval = TRUE,echo = T, results='hide',message=FALSE} + # -------------------------------------- + # SETUP WORKSPACE + tmstp <- format(Sys.time(), "%Y_%m_%d") + main <- getwd() #"~/GitHub_new/ACLIM2 + suppressWarnings(source("R/make.R")) + suppressWarnings(source("R/sub_scripts/load_maps.R")) # skip this for faster load + # -------------------------------------- +``` + +The `R/make.R` command will install missing libraries (including those listed under the minimal install) and download and process multiple shapefiles for geographic analysis, it takes several minutes depending on bandwidth. + + + +# 3. Get ROMSNPZ data {.tabset} + +The ROMSNPZ team has been working with [Roland Schweitzer](mailto:roland.schweitzer@noaa.gov) and [Peggy Sullivan](mailto:peggy.sullivan@noaa.gov) to develop the ACLIM Live Access Server (LAS) to publicly host the published CMIP5 hindcasts and downscaled projections. This server is in beta testing phase and can be accessed at the following links: + +* [LAS custom ROMSNPZ data exploration, query, mapping, and plotting tool](https://data.pmel.noaa.gov/aclim/las/ "Live Access Server") + +* [ERDAPP ACLIM data access tool](https://data.pmel.noaa.gov/aclim/erddap/) + +* [THREDDS ACLIM direct data access](https://data.pmel.noaa.gov/aclim/thredds/) + +Currently, the public data includes hindcasts & CMIP5 climate projections. + +## 3.1 Available data + + * `Level1` : (full grid, native ROMS coordinates, full suite of variables). + * `Level2` : (full grid, rotated to lat lon from the native ROMSNPZ grid, weekly averages) + * `Bottom 5m` : subset of variables from the bottom 5 m of the water column + * `Surface 5m` : subset of variables for the surface 5 m of the water column + * `Integrated`: watercolumn integrated averages or totals for various variables + * `Level3`: two post-processed datasets + * `ACLIMsurveyrep-x.nc.`: Survey replicated (variables "sampled" at the average location and date that each groundfish survey is sampled)*(Note that the resampling stations need to be removed before creating bottom temperature maps)* + * `ACLIMregion-xnc.`:weekly variables averaged for each survey strata *(Note that area (km2) weighting should be used to combine values across multiple strata)* + +For all files the general naming convention of the folders is: +`B10K-[ROMSNPZ version]_[CMIP]_[GCM]_[carbon scenario]`. For example, the CMIP5 set of indices was downscaled using the H16 (Hermann et al. 2016) version of the ROMSNPZ. Three models were used to force boundary conditions( MIROC, CESM, and GFDL) under 2 carbon scenarios RCP 8.5 and RCP 4.5. So to see an individual trajectory we might look in the level3 (timeseries indices) folder under `B10K-H16_CMIP5_CESM_rcp45`, which would be the B10K version H16 of the CMIP5 CESM model under RCP4.5. + +## 3.2 Access using minimal installation + +The [ACLIM Thredds server](https://data.pmel.noaa.gov/aclim/thredds/) provides a directory structure and filenames/paths for individual hindcasts and projections. The latest hindcast, using the naming scheme described above, is `B10K-K20_CORECFS`. Clicking through the directory shows organization by Level (Levels 1-3), possibly a subdirectory for variable type (depends on Level), then finally a catalog page with metadata and the OPENDAP address. + +![Thredds Catalog page.](Figs/catalog.jpg){ width=100% } + +The OPENDAP address (ending in .nc) is used to open a connection between R and the nc files associated with that data: + +```{r minimal, include=TRUE, eval=F ,echo = TRUE, results='hide',message=FALSE} + # Only required libraries for direct extraction - works in plain R + library(ncdf4) + library(thredds) + + # Note: Still ironing out inconsistencies in naming scheme for datasets - + # browse to metadata on thredds server to check current names. + + # PMEL thredds server (for all available data) + url_base <- "https://data.pmel.noaa.gov/aclim/thredds/" + + # List available runs for whole server + tds_list_datasets(url_base) + + # Dataset address for hindcast Level2 data + dataset <- "B10K-K20_CORECFS/Level2.html" + + # List available data for Level2 hindcast + tds_list_datasets(paste(url_base,dataset,sep="")) + + # Opendap address for bottom 5 meter layer + opendap <- "dodsC/Level2/B10K-K20_CORECFS_bottom5m.nc" + + # Open ncdf4 connection with dataset + nc_handle <- nc_open(paste(url_base,opendap,sep="")) + + # Show metadata from this dataset + nc_handle + + # Close the connection + nc_close(nc_handle) + +``` + +## 3.3 Access using ACLIM package + +The below code will extract variables from the Level 2 and Level 3 netcdf files (`.nc`) and save them as compressed `.Rdata` files on your local `r Rdata_path` folder. + +### 3.3.1 Setup up the R worksace + +First let's get the workspace set up, will we step through an example downloading the hindcast and a single projection (CMIP5 MIROC rcp8.5) but you can loop the code below to download the full set of CMIP5 projections. + +```{r thredds,include=TRUE, eval = TRUE,echo = TRUE, results='hide',message=FALSE} + + # -------------------------------------- + # SETUP WORKSPACE + # rm(list=ls()) + tmstp <- format(Sys.time(), "%Y_%m_%d") + main <- getwd() #"~/GitHub_new/ACLIM2 + source("R/make.R") + # -------------------------------------- + +``` + +Let's take a look at the available online datasets: + +```{r preview,include=T, eval=T, echo=T} + + # preview the datasets on the server: + url_list <- tds_list_datasets(thredds_url = ACLIM_data_url) + + #display the full set of datasets: + cat(paste(url_list$dataset,"\n")) + +``` + + + +### 3.3.2 Download Level 2 data + +First we will explore the Level 2 bottom temperature data on the [ACLIM Thredds server](https://data.pmel.noaa.gov/aclim/thredds/) using the H16 hindcast and the H16 (CMIP5) projection for MIROC under rcp8.5. The first step is to get the data urls: + +```{r thredds_getURLs, include=T,eval=T,echo=T} + + # define the simulation to download: + cmip <- "CMIP5" # Coupled Model Intercomparison Phase + GCM <- "MIROC" # Global Circulation Model + rcp <- "rcp85" # future carbon scenario + mod <- "B10K-H16" # ROMSNPZ model + hind <- "CORECFS" # Hindcast + + # define the projection simulation: + proj <- paste0(mod,"_",cmip,"_",GCM,"_",rcp) + hind <- paste0(mod,"_",hind) + + # get the url for the projection and hindcast datasets: + proj_url <- url_list[url_list$dataset == paste0(proj,"/"),]$path + hind_url <- url_list[url_list$dataset == paste0(hind,"/"),]$path + + # preview the projection and hindcast data and data catalogs (Level 1, 2, and 3): + proj_datasets <- tds_list_datasets(thredds_url = proj_url) + hind_datasets <- tds_list_datasets(thredds_url = hind_url) + + # get url for the projection and hindcast Level 2 and Level 3 catalogs + proj_l2_cat <- proj_datasets[proj_datasets$dataset == "Level 2/",]$path + proj_l3_cat <- proj_datasets[proj_datasets$dataset == "Level 3/",]$path + hind_l2_cat <- hind_datasets[hind_datasets$dataset == "Level 2/",]$path + hind_l3_cat <- hind_datasets[hind_datasets$dataset == "Level 3/",]$path + hind_l2_cat +``` + + +Now that we have the URLs let's take a look at the available Level2 datasets: + +* `Bottom 5m` : bottom water temperature at 5 meters +* `Surface 5m` : surface water temperature in the first 5 meters +* `Integrated` : Integrated water column averages for various NPZ variables + +```{r thredds_l2_url, include=T,eval=T,echo=T} + + # preview the projection and hindcast Level 2 datasets: + proj_l2_datasets <- tds_list_datasets(proj_l2_cat) + hind_l2_datasets <- tds_list_datasets(hind_l2_cat) + proj_l2_datasets$dataset + + # get url for bottom temperature: + proj_l2_BT_url <- proj_l2_datasets[proj_l2_datasets$dataset == "Bottom 5m",]$path + hind_l2_BT_url <- hind_l2_datasets[hind_l2_datasets$dataset == "Bottom 5m",]$path + proj_l2_BT_url + +``` + +We can't preview the Level 3 datasets in the same way but they are identical to those in the google drive and include two datasets + +* `ACLIMsurveyrep_B10K-H16_CMIP5_CESM_BIO_rcp85.nc` : NMFS Groundfish summer NBS and EBS survey replicated values for 60+ variables +* `ACLIMregion_B10K-H16_CMIP5_CESM_BIO_rcp85.nc` : weekly strata averages for 60+ variables + +```{r vars, include=T,echo=T,eval=F} + + weekly_vars # list of possible variables in the ACLIMregion_ files + +``` + +Now we can download a subset of the Level2 data (full 10KM Lat Lon re-gridded data), here with an example of sampling on Aug 1 of each year: + +```{r thredds_l2, include=T,echo=T,eval=F} + + # Currently available Level 2 variables + dl <- proj_l2_datasets$dataset # datasets + + # variable list + svl <- list( + 'Bottom 5m' = "temp", + 'Surface 5m' = "temp", + 'Integrated' = c("EupS","Cop","NCaS") ) + + + # preview the variables, timesteps, and lat lon in each dataset: + l2_info <- scan_l2(ds_list = dl,sim_list = "B10K-H16_CORECFS" ) + + names(l2_info) + l2_info[["Bottom 5m"]]$vars + l2_info[["Surface 5m"]]$vars + l2_info[["Integrated"]]$vars + max(l2_info[["Integrated"]]$time_steps) + l2_info[["Integrated"]]$years + + + # Simulation list: + # --> --> Tinker:add additional projection scenarios here + sl <- c(hind, proj) + + # Currently available Level 2 variables + dl <- proj_l2_datasets$dataset # datasets + + # variables to pull from each data set + svl <- list( + 'Bottom 5m' = "temp", + 'Surface 5m' = "temp", + 'Integrated' = c("EupS","Cop","NCaS") ) + + + # Let's sample the model years as close to Aug 1 as the model timesteps run: + # --> --> Tinker - try a different date + tr <- c("-08-1 12:00:00 GMT") + + # grab nc files from the aclim server and convert to rdatafiles with the ID Aug1 + get_l2( + ID = "_Aug1", + overwrite = T, + ds_list = dl, + trIN = tr, + sub_varlist = svl, + sim_list = sl ) + +``` + +### 3.3.3 Download Level 3 data + +Now let's grab some of the Level 3 data and store it in the `r Rdata_path` folder. This is comparatively faster because Level 3 files are already post-processed to be in the ACLIM indices format and are relatively small: + +```{r thredds_l3, include=T,echo=T,eval=F} + + # Simulation list: + # --> --> Tinker:add additional projection scenarios here + sl <- c(hind, proj) + + # variable list + # --> --> Tinker:add additional variables to varlist + vl <- c( + "temp_bottom5m", # bottom temperature, + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Shelf euphausiids + + # convert nc files into a long data.frame for each variable + # three options are: + # ------------------------------------ + + # opt 1: access nc files remotely (fast, less local storage needed) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list = sl) + + # opt 2: download nc files then access locallly: + get_l3(web_nc = TRUE, download_nc = T, + local_path = file.path(local_fl,"aclim_thredds"), + varlist = vl,sim_list = sl) + + # opt 3: access existing nc files locally: + get_l3(web_nc = F, download_nc = F, + local_path = file.path(local_fl,"aclim_thredds"), + varlist = vl,sim_list = sl) + +``` + +### 3.3.4 Download Level 3 CMIP6 (ACLIM only for now) + +Go to the shared google drive and dowload the CMIP6 data into your ACLIM2 local folder: + +[00_ACLIM_shared>02_Data>Newest>roms_for_aclim](https://drive.google.com/drive/folders/1ljACM6cgMD7M14lzvozZyTP4tMBnf_S4) +and put in your local folder under: +`Data/in/roms_for_aclim` + +![](Figs/filestructure2.jpg) + + +# 4. Explore indices & plot the data {.tabset} + +## 4.1. Data exploration with the minimal installation + +Let's look at some data from the Level 2 bottom temperature records, using the threadds and ncdf4 libraries: + +```{r minimal_cp, include=TRUE, eval=F ,echo = TRUE, results='hide',message=FALSE} + + library(ncdf4) + library(thredds) + + # Open connection to Level 2 bottom 5 meter layer + url_base <- "https://data.pmel.noaa.gov/aclim/thredds/" + opendap <- "dodsC/Level2/B10K-K20_CORECFS_bottom5m.nc" + nc <- nc_open(paste(url_base,opendap,sep="")) + + # Examination of the nc object shows variables such as temperature (temp) + # float temp[xi_rho,eta_rho,ocean_time] + # long_name: time-averaged potential temperature, bottom 5m mean + # units: Celsius + # time: ocean_time + # coordinates: lon_rho lat_rho ocean_time + # field: temperature, scalar, series + # _FillValue: 9.99999993381581e+36 + # cell_methods: s_rho: mean + + # temp has three dimensions - xi_rho, eta_rho, and ocean_time + # Now we make vectors of each axis. + xi_axis <- seq(1,182) # Hardcoded axis length + eta_axis <- seq(1,258) # Hardcoded axis length + + # time units in GMT: seconds since 1900-01-01 00:00:00 + t_axis <- ncvar_get(nc,"ocean_time") + time_axis <- as.POSIXct(t_axis, origin = "1900-01-01", tz = "GMT") + + # Make two dates to find in the data + date1 <- ISOdate(year=2010, month=7, day=1, hour = 12, tz = "GMT") + date2 <- ISOdate(year=2019, month=7, day=1, hour = 12, tz = "GMT") + + # Which time index is closest to those dates? + timerec1 <- which.min(abs(time_axis - date1)) + timerec2 <- which.min(abs(time_axis - date2)) + + # Center time of the closest weekly average + time_axis[timerec1] + time_axis[timerec2] + + # Get full xi, eta grid (count=-1) for two time slices + # Get one record starting at desired timerec. + # Careful (easy to grab too much data, if count and start are missing + # it will grab all the data). + temp1 <- ncvar_get(nc, "temp", start=c(1,1,timerec1), count=c(-1,-1,1)) + temp2 <- ncvar_get(nc, "temp", start=c(1,1,timerec2), count=c(-1,-1,1)) + + # Plot comparison (not checking scale here) + par(mfrow=c(1,2)) + image(temp1) + image(temp2) + + # Get lat/lon for better mapping - getting whole variable + lats <- ncvar_get(nc,"lat_rho") + lons <- ncvar_get(nc,"lon_rho") + + # Visualizing the coordinate transformation + plot(lons,lats) + + # Let's flag water <2 degrees C + par(mfrow=c(1,2)) + plot(lons,lats,col=ifelse(temp1<2,"blue","green"),main="2010") + plot(lons,lats,col=ifelse(temp2<2,"blue","green"),main="2019") + + # Close the connection + nc_close(nc) + +``` +![Bottom temperature <2 degrees C (blue) and >=2 degrees C (green).](Figs/minimal_coldpool.jpg){ width=100%} + +## 4.2. Level 3 indices {.tabset} + +Level 3 indices can be used to generate seasonal, monthly, and annual indices (like those reported in [Reum et al. 2020)](https://www.frontiersin.org/articles/10.3389/fmars.2020.00124/full), [Holsman et al. 2020)](http://dx.doi.org/10.1038/s41467-020-18300-3). In the section below we explore these indices in more detail using R, including using (2) above to generate weekly, monthly, and seasonal indices (e.g. Fall Zooplankton) for use in biological models. In section 3 below we explore these indices in more detail using R, including using (2) above to generate weekly, monthly, and seasonal indices (e.g. Fall Zooplankton) for use in biological models. The following examples show how to analyze and plot the ACLIM indices from the .Rdata files created in the previous step 3. Please be sure to coordinate with ROMSNPZ modeling team members to ensure data is applied appropriately. + +### 4.2.1 Explore Level 3 data catalog + +Once the base files and setup are loaded you can explore the index types. Recall that in each scenario folder there are two indices saved within the `Level3` subfolders: + +1) `ACLIMsurveyrep_B10K-x.nc` contains summer groundfish trawl "survey replicated" indices (using mean date and lat lon) *(Note that the resampling stations need to be removed before creating bottom temperature maps)* +2) `ACLIMregion_B10K-x.nc`: contains weekly "strata" values *(Note that area weighting should be used to combine values across multiple strata)* + +First run the below set of code to set up the workspace: + +```{r explore, eval=T, echo=T,results='hide',message=FALSE} + + # -------------------------------------- + # SETUP WORKSPACE + tmstp <- format(Sys.time(), "%Y_%m_%d") + main <- getwd() #"~/GitHub_new/ACLIM2 + source("R/make.R") + # -------------------------------------- + + # list of the scenario x GCM downscaled ACLIM indices + for(k in aclim) + cat(paste(k,"\n")) + + embargoed # not yet public or published + public # published runs (CMIP5) + + # get some info about a scenario: + all_info1 + all_info2 + + # variables in each of the two files: + srvy_vars + weekly_vars + + #summary tables for variables + srvy_var_def + weekly_var_def + + # explore stations in the survey replicated data: + head(station_info) + + +``` + +### 4.2.2 Level 3: Spatial indices (survey replicated) + +Let's start b exploring the survey replicated values for each variable. Previous steps generated the Rdata files that are stored in the `ACLIMsurveyrep_B10K-[version_CMIPx_GCM_RCP].Rdata` in each corresponding simulation folder. + +![Survey replicated stations, N and S.](Figs/stations_NS.jpg){ width=50%} +![Survey replicated stations.](Figs/stations.jpg){ width=50%} + +The code segment below will recreate the above figures.*Note that if this is the first time through it may take 3-5 mins to load the spatial packages and download the files from the web (first time through only).* +```{r readncfiles_srvy, eval=F, echo=T, results='hide'} + + # if load_gis is set to FALSE in R/setup.R (default) + # we will need to load the gis layers and packages + # if this is the first time through this would be a good time + # to grab a coffee... + + source("R/sub_scripts/load_maps.R") + + # first convert the station_info object into a shapefile for mapping: + station_sf <- convert2shp(station_info) + station_sf$stratum <- factor(station_sf$stratum) + + # plot the stations: + p <- plot_stations_basemap(sfIN = station_sf, + fillIN = "subregion", + colorIN = "subregion") + + scale_color_viridis_d(begin = .2,end=.6) + + scale_fill_viridis_d(begin = .2,end=.6) + + if(update.figs){ + p + ggsave(file=file.path(main,"Figs/stations_NS.jpg"),width=5,height=5) + } + + p2 <- plot_stations_basemap(sfIN = station_sf,fillIN = "stratum",colorIN = "stratum") + + scale_color_viridis_d() + + scale_fill_viridis_d() + + if(update.figs){ + p2 + ggsave(file=file.path(main,"Figs/stations.jpg"),width=5,height=5)} +``` + + +# 5. Hindcasts {.tabset} + +There are two model versions of hindcasts available for comparison. The Hermann et al. 2016 H16 10 depth layer model and the Kearney et al. 2020 30 depth layer model. Both are resolved spatially at a ~10km grid cell. + +## 5.1. Level 3 hindcasts {.tabset} + +Level 3 hindcast products inculde survey replicated station data and strata averaged weekly values. The code below will explore these in more detail. + +### 5.1.1. Level 3 hindcasts: spatial patterns + +Now let's explore the survey replicated data in more detail and use to plot bottom temperature. + +```{r explore_srvy1, eval=F, echo=T, results='hide',message=FALSE} + # run this line if load_gis is set to F in R/setup.R: + source("R/sub_scripts/load_maps.R") + + # preview the l3 data for the hindcast: + tt <- all_info1%>%filter(name =="B10K-K20_CORECFS") + tt <- seq(as.numeric(substring(tt$Start,1,4)), + as.numeric(substring(tt$End,1,4)),10) + + # now create plots of average BT during four time periods + time_seg <- list( '1970-1980' = c(1970:1980), + '1980-1990' = c(1980:1990), + '1990-2000' = c(1990:2000), + '2000-2010' = c(2000:2010), + '2010-2020' = c(2010:2020)) + + # lists the possible variables + srvy_vars # lists the possible variables + + # specify the variables to plot + vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + + # assign the simulation to download + # --> Tinker: try selecting a different set of models to compare + sim <-"B10K-K20_CORECFS" + + # open a "region" or strata specific nc file + fl <- file.path(sim,paste0(srvy_txt,sim,".Rdata")) + + # create local rdata files (opt 1) + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list =sim ) + + # load object 'ACLIMsurveyrep' + load(file.path(main,Rdata_path,fl)) + + + # Collate mean values across timeperiods and simulations + # ------------------------------------------------------- + ms <- c("B10K-H16_CORECFS","B10K-K20_CORECFS" ) + + # Loop over model set + for(sim in ms){ + fl <- file.path(sim,paste0(srvy_txt,sim,".Rdata")) + + if(!file.exists( file.path(Rdata_path,fl)) ) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list =sim ) + } + + # get the mean values for the time blocks from the rdata versions + # will throw "implicit NA" errors that can be ignored + mn_var_all <- get_mn_rd(modset = ms, + names = c("H16","K20") , + varUSE = "temp_bottom5m") + # --> Tinker: varUSE = "EupS_integrated") + + # convert results to a shapefile + mn_var_sf <- convert2shp(mn_var_all%>%filter(!is.na(mnval))) + lab_t <- "Bering10K CORECFS hindcast" + + p_hind_3 <- plot_stations_basemap(sfIN = mn_var_sf, + fillIN = "mnval", + colorIN = "mnval", + sizeIN=.3) + + facet_grid(simulation~time_period)+ + scale_color_viridis_c()+ + scale_fill_viridis_c()+ + guides( + color = guide_legend(title="Bottom T (degC)"), + fill = guide_legend(title="Bottom T (degC)")) + + ggtitle(lab_t) + + # This is slow but it works (repeat dev.new() twice if in Rstudio)... + dev.new() + p_hind_3 + + if(update.figs) + ggsave(file=file.path(main,"Figs/mn_hindcast_BT.jpg"),width=8,height=6) +``` + + +![Decadal averages of bottom temperature from the two hindcast models.](Figs/mn_hindcast_BT.jpg){ width=100% } +Now let's look at the Marine Heatwave conditions in 2018 and compare that to the average conditions prior to 2010: + +```{r MHW_plot, eval=F, echo=T} + # now create plots of average BT during four time periods + time_seg <- list( '1970-2010' = c(1970:2010), + '2018-2018' = c(2018:2018)) + + # assign the simulation to download + sim <- "B10K-K20_CORECFS" + + # open a "region" or strata specific nc file + fl <- file.path(sim,paste0(srvy_txt,sim,".Rdata")) + + # load object 'ACLIMsurveyrep' + load(file.path(main,Rdata_path,fl)) + + # get the mean values for the time blocks from the rdata versions + mn_var_all <- get_mn_rd(modset = "B10K-K20_CORECFS", + varUSE = "temp_bottom5m") + + # convert results to a shapefile + mn_var_sf <- convert2shp(mn_var_all%>%filter(!is.na(mnval))) + lab_t <- "Bering10K CORECFS hindcast" + + p_mhw <- plot_stations_basemap(sfIN = mn_var_sf, + fillIN = "mnval", + colorIN = "mnval", + sizeIN=.3) + + facet_grid(simulation~time_period)+ + scale_color_viridis_c()+ + scale_fill_viridis_c()+ + guides( + color = guide_legend(title="Bottom T (degC)"), + fill = guide_legend(title="Bottom T (degC)")) + + ggtitle(lab_t) + + # This is slow but it works (repeat dev.new() twice if in Rstudio)... + dev.new(width=4,height=3) + p_mhw + + if(update.figs) + ggsave(file=file.path(main,"Figs/mn_hindcast_mhw.jpg"),width=4,height=3) +``` +![Decadal averages of bottom temperature from the two hindcast models.](Figs/mn_hindcast_mhw.jpg){ width=100% } + +### 5.1.2. Level 3 hindcasts: Weekly strata averages + +The next set of indices to will explore are the weekly strata-specific values for each variable.These are stored in the `ACLIMregion_B10K-[version_CMIPx_GCM_RCP].nc` in each scenario folder. + +```{r hind_weekly, eval=F, echo=T} + + + # View an individual variable (e.g., Bottom Temp) + # ------------------------------------------------------- + weekly_vars + + # assign the simulation to download + sim <- "B10K-K20_CORECFS" + + # define a "region" or strata specific nc file + fl <- file.path(sim,paste0(reg_txt,sim,".Rdata")) + + + vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + + # create local rdata files (opt 1) + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list = sim) + + + # load object 'ACLIMregion' for bottom temperature + load(file.path(main,Rdata_path,fl)) + tmp_var <- ACLIMregion%>%filter(var == "temp_bottom5m") + + # now plot the data: + p4_hind <- ggplot(data = tmp_var) + + geom_line(aes(x=time,y=val,color= strata),alpha=.8)+ + facet_grid(basin~.)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(sim,tmp_var$var[1]))+ + theme_minimal() + p4_hind + + if(update.figs) + ggsave(file=file.path(main,"Figs/hind_weekly_bystrata.jpg"),width=8,height=5) + + + # To get the average value for a set of strata, weight the val by the area: + mn_NEBS <- getAVGnSUM(strataIN = NEBS_strata, dataIN = tmp_var) + mn_NEBS$basin = "NEBS" + mn_SEBS <-getAVGnSUM(strataIN = SEBS_strata, dataIN = tmp_var) + mn_SEBS$basin = "SEBS" + + p5_hind <- ggplot(data = rbind(mn_NEBS,mn_SEBS)) + + geom_line(aes(x=time,y=mn_val,color=basin),alpha=.8)+ + geom_smooth(aes(x=time,y=mn_val,color=basin), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.4,end=.8)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(sim,mn_NEBS$var[1]))+ + + theme_minimal() + p5_hind + if(update.figs) + ggsave(file=file.path(main,"Figs/hind_weekly_byreg.jpg"),width=8,height=5) + + +``` + +![Weekly indices by stratum](Figs/hind_weekly_bystrata.jpg){ width=90% } + +![Weekly indices by sub-region](Figs/hind_weekly_byreg.jpg){ width=90% } + +### 5.1.3. Level 3 hindcasts: Seasonal averages +Now using a similar approach get the seasonal mean values for a variable: +```{r seasonal averages, eval=F, include=T,echo=T} + + # assign the simulation to download + sim <- "B10K-K20_CORECFS" + + + # Set up seasons (this follows Holsman et al. 2020) + seasons <- data.frame(mo = 1:12, + season =factor("", + levels=c("Winter","Spring","Summer","Fall"))) + seasons$season[1:3] <- "Winter" + seasons$season[4:6] <- "Spring" + seasons$season[7:9] <- "Summer" + seasons$season[10:12] <- "Fall" + + + vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + + # create local rdata files (opt 1) + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list = sim) + + # open a "region" or strata specific file + fl <- file.path(sim,paste0(reg_txt,sim,".Rdata")) + load(file.path(main,Rdata_path,fl)) + + # get large zooplankton as the sum of euph and NCaS + tmp_var <- ACLIMregion%>% + filter(var%in%vl[c(2,3)])%>% + group_by(time,strata,strata_area_km2,basin)%>% + group_by(time, + strata, + strata_area_km2, + basin, + units)%>% + summarise(val =sum(val))%>% + mutate(var = "Zoop_integrated", + long_name ="Total On-shelf + large zooplankton concentration, + integrated over depth (NCa, Eup)") + + rm(ACLIMregion) + head(tmp_var) + + # define some columns for year mo and julian day + tmp_var$yr <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$year + 1900 + tmp_var$mo <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$mon + 1 + tmp_var$jday <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$yday + 1 + tmp_var$season <- seasons[tmp_var$mo,2] + + # To get the average value for a set of strata, weight the val by the area: (slow...) + mn_NEBS_season <- getAVGnSUM( + strataIN = NEBS_strata, + dataIN = tmp_var, + tblock=c("yr","season")) + mn_NEBS_season$basin = "NEBS" + + mn_SEBS_season <- getAVGnSUM( + strataIN = SEBS_strata, + dataIN = tmp_var, + tblock=c("yr","season")) + mn_SEBS_season$basin = "SEBS" + + plot_data <- rbind(mn_NEBS_season,mn_SEBS_season) + + # plot Fall values: + p6_hind <- ggplot(data = plot_data%>%filter(season=="Fall") ) + + geom_line( aes(x = yr,y = mn_val,color=basin),alpha=.8)+ + geom_smooth( aes(x = yr,y = mn_val,color=basin), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.4,end=.8)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(sim,"Fall",mn_NEBS_season$var[1]))+ + theme_minimal() + p6_hind + + + if(update.figs) + ggsave(file=file.path(main,"Figs/Hind_Fall_large_Zoop.jpg"),width=8,height=5) + +``` + +![Large fall zooplankton integrated concentration](Figs/Hind_Fall_large_Zoop.jpg){ width=75% } + +### 5.1.4. Level 3 hindcasts: Monthly averages + +Using the same approach we can get monthly averages for a given variable: + +```{r monthly averages hind, eval=F, include=T,echo=T} + + # To get the average value for a set of strata, weight the val by the area: (slow...) + mn_NEBS_season <- getAVGnSUM( + strataIN = NEBS_strata, + dataIN = tmp_var, + tblock = c("yr","mo")) + mn_NEBS_season$basin = "NEBS" + + mn_SEBS_season <- getAVGnSUM( + strataIN = SEBS_strata, + dataIN = tmp_var, + tblock=c("yr","mo")) + mn_SEBS_season$basin = "SEBS" + + plot_data <- rbind(mn_NEBS_season,mn_SEBS_season) + + # plot Fall values: + p7_hind <- ggplot(data = plot_data%>%filter(mo==9) ) + + geom_line( aes(x = yr,y = mn_val,color=basin),alpha=.8)+ + geom_smooth( aes(x = yr,y = mn_val,color=basin), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.4,end=.8)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(aclim[2],"Sept.",mn_NEBS_season$var[1]))+ + theme_minimal() + dev.new() + p7_hind + + if(update.figs) + ggsave(file=file.path(main,"Figs/Hind_Sept_large_Zoop.jpg"),width=8,height=5) +``` + + +![September large zooplankton integrated concentration](Figs/Hind_Sept_large_Zoop.jpg){ width=75% } + +## 5.2. Level 2 hindcasts{.tabset} + +Level 2 data can be explored in the same way as the above indices but we will focus in the section below on a simple spatial plot and temporal index. The advantage of Level2 inidces is in the spatial resolution and values outside of the survey area. + +### 5.2.1. Level 2 hindcasts: Custom spatial indices + +As we did in section 5.1.1. let's create spatial plots of hindcast time periods for Aug 1 of each year: + +```{r explore_L2_space hind, eval=F, echo=T} + # run this line if load_gis is set to F in R/setup.R: + source("R/sub_scripts/load_maps.R") + + # now create plots of average BT during four time periods + time_seg <- list( '1970-1980' = c(1970:1980), + '1980-1990' = c(1980:1990), + '1990-2000' = c(1990:2000), + '2000-2010' = c(2000:2010), + '2010-2020' = c(2010:2020)) + + # preview the datasets on the server: + tds_list_datasets(thredds_url = ACLIM_data_url) + + # assign the simulation to download + # --> Tinker: try selecting a different set of models to compare + sim <- "B10K-K20_CORECFS" + #ms <- c("B10K-H16_CORECFS","B10K-K20_CORECFS" ) + + # Currently available Level 2 variables + dl <- proj_l2_datasets$dataset # datasets + + svl <- list( + 'Bottom 5m' = "temp", + 'Surface 5m' = "temp", + 'Integrated' = c("EupS","Cop","NCaS") ) + + # Let's sample the model years as close to Aug 1 as the model timesteps run: + tr <- c("-08-1 12:00:00 GMT") + + # the full grid is large and takes a longtime to plot, so let's subsample the grid every 4 cells + + IDin <- "_Aug1_subgrid" + var_use <- "_bottom5m_temp" + + # open a "region" or strata specific nc file + fl <- file.path(main,Rdata_path,sim,"Level2", + paste0(sim,var_use,IDin,".Rdata")) + + # load data from level 2 nc files (approx <10sec) + startTime = Sys.time() + if(!file.exists(file.path(Rdata_path,fl))){ + get_l2( + ID = "_1990_subgrid", + overwrite = T, + xi_rangeIN = seq(1,182,10), + eta_rangeIN = seq(1,258,10), + ds_list = dl[1], # must be same length as sub_varlist + trIN = tr, + yearsIN = 1990, + sub_varlist = list('Bottom 5m' = "temp" ), + sim_list = sim ) + } + endTime = Sys.time() + endTime - startTime + + # load data from level 2 nc files for all years and vars (yearsIN = NULL by default) + # NOTE: THIS IS SLOOOOOW..~ 2 min + startTime2 = Sys.time() + if(!file.exists(file.path(Rdata_path,fl))){ + get_l2( + ID = IDin, + overwrite = T, + xi_rangeIN = seq(1,182,10), + eta_rangeIN = seq(1,258,10), + ds_list = dl, + trIN = tr, + sub_varlist = svl, + sim_list = sim ) + } + endTime2 = Sys.time() + endTime2 - startTime2 + + # load R data file + load(fl) # temp + + # there are smarter ways to do this;looping because + # we don't want to mess it up but this is slow... + i <-1 + data_long <- data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F + ) + + for(i in 2:dim(temp$val)[3]) + data_long <- rbind(data_long, + data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F) + ) + + + # get the mean values for the time blocks from the rdata versions + # may throw "implicit NA" errors that can be ignored + tmp_var <-data_long # get mean var val for each time segment + j<-0 + for(i in 1:length(time_seg)){ + if(length( which(as.numeric(tmp_var$year)%in%time_seg[[i]] ))>0){ + j <- j +1 + mn_tmp_var <- tmp_var%>% + filter(year%in%time_seg[[i]],!is.na(val))%>% + group_by(latitude, longitude)%>% + summarise(mnval = mean(val,rm.na=T)) + + mn_tmp_var$time_period <- factor(names(time_seg)[i],levels=names(time_seg)) + + if(j == 1) mn_var <- mn_tmp_var + if(j > 1) mn_var <- rbind(mn_var,mn_tmp_var) + rm(mn_tmp_var) + } + } + + # convert results to a shapefile + L2_sf <- convert2shp(mn_var%>%filter(!is.na(mnval))) + + p9_hind <- plot_stations_basemap(sfIN = L2_sf, + fillIN = "mnval", + colorIN = "mnval", + sizeIN=.6) + + #facet_wrap(.~time_period,nrow=2,ncol=3)+ + facet_grid(.~time_period)+ + scale_color_viridis_c()+ + scale_fill_viridis_c()+ + guides( + color = guide_legend(title="Bottom T (degC)"), + fill = guide_legend(title="Bottom T (degC)")) + + ggtitle(paste(sim,var_use,IDin)) + + # This is slow but it works (repeat dev.new() twice if in Rstudio)... + dev.new() + p9_hind + + if(update.figs) + ggsave(file=file.path(main,"Figs/Hind_sub_grid_mn_BT_Aug1.jpg"),width=8,height=4) + + # graphics.off() + +``` + + +![Aug 1 Bottom temperature from Level 2 dataset](Figs/Hind_sub_grid_mn_BT_Aug1.jpg){ width=100% } + + +### 5.2.2. Level 2 hindcasts: M2 mooring comparison + +As final hindcast comparison, let's look a surface temperature from observations vs the H16 and K20 model versions of the hindcast: + + +```{r M2 Mooring hind, eval=F, echo=T} + # M2_lat <- (56.87°N, -164.06°W) + # 56.877 -164.06 xi = 99 eta= 62 + IDin <- "_2013_M2" + var_use <- "_surface5m_temp" + + # get data from M2 data page: + pmelM2_url <-"https://www.ncei.noaa.gov/data/oceans/ncei/ocads/data/0157599/" + yr_dat <- "M2_164W_57N_Apr2019_May2019.csv" + yr_dat <- "M2_164W_57N_May2013_Sep2013.csv" + + # preview the datasets on the server: + temp <- tempfile() + download.file(paste0(pmelM2_url,yr_dat),temp) + #M2data <- read.csv(temp,skip=4,stringsAsFactors = F) + M2data <- read.csv(temp,skip=0,stringsAsFactors = F) + + unlink(temp) + + # convert date and time to t + M2data$t <-as.POSIXct(paste0(M2data$Date," ",M2data$Time,":00"),"%m/%d/%Y %H:%M:%S", + origin = "1900-01-01 00:00:00", + tz = "GMT") + + # open a "region" or strata specific nc file + fl <- file.path(main,Rdata_path,sim,"Level2", + paste0(sim,var_use,IDin,".Rdata")) + + # assign the simulation to download + sim <- "B10K-K20_CORECFS" + + # Let's sample the model years as close to Aug 1 as the model timesteps run: + #tr <- c("-08-1 12:00:00 GMT") + tr <- substring(M2data$t,5,20) + # the full grid is large and takes a longtime to plot, so let's subsample the grid every 4 cells + + + # load data from level 2 nc files (grab a coffee, takes a few mins) + if(!file.exists(file.path(Rdata_path,fl))){ + get_l2( + ID = IDin, + overwrite = T, + xi_rangeIN = 99, + eta_rangeIN = 62, + ds_list = dl[2], # must be same length as sub_varlist + trIN = tr, + yearsIN = 2013, + sub_varlist = list('Surface 5m' = "temp" ), + sim_list = c("B10K-H16_CORECFS","B10K-K20_CORECFS" ) ) + } + + # load R data file + # open a "region" or strata specific nc file + sim <- "B10K-H16_CORECFS" + fl <- file.path(main,Rdata_path,sim,"Level2", + paste0(sim,var_use,IDin,".Rdata")) + load(fl) # temp + + # there are smarter ways to do this;looping because + # we don't want to mess it up but this is slow... + i <-1 + data_long <- data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + sim = sim, + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F + ) + + for(i in 2:dim(temp$val)[3]) + data_long <- rbind(data_long, + data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + sim = sim, + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F) + ) + # open a "region" or strata specific nc file + sim <- "B10K-K20_CORECFS" + fl2 <- file.path(main,Rdata_path,sim,"Level2", + paste0(sim,var_use,IDin,".Rdata")) + load(fl2) # temp + for(i in 1:dim(temp$val)[3]) + data_long <- rbind(data_long, + data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + sim = sim, + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F) + ) + + plotM2_dat <- M2data%>%dplyr::select(SST = SST..C.,Date = t) + plotM2_dat$sim <- factor("Obs",levels=c("Obs","B10K-H16_CORECFS","B10K-K20_CORECFS")) + plotM2_dat <- plotM2_dat%>%filter(SST>-99) + plotroms_dat <- data_long%>%dplyr::select(SST = val,Date = time,sim) + plotroms_dat$sim <- factor(plotroms_dat$sim,levels=c("Obs","B10K-H16_CORECFS","B10K-K20_CORECFS")) + plotdat <- rbind(plotM2_dat,plotroms_dat) + + p10_hind <- ggplot(plotdat) + + geom_line( aes(x=Date,y=SST,color=sim),alpha=.8)+ + # geom_smooth( aes(x = Date,y = SST,color=sim), + # formula = y ~ x, se = T)+ + scale_color_viridis_d(begin=.9,end=.2)+ + ylab(tmp_var$units[1])+ + ggtitle( "Bering M2 Mooring: 2013 SST")+ + theme_minimal() + + # This is slow but it works (repeat dev.new() twice if in Rstudio)... + dev.new() + p10_hind + + if(update.figs) + ggsave(file=file.path(main,"Figs/Hind_M2_SST.jpg"),width=8,height=4) + + # graphics.off() + +``` + +![M2 mooring SST in 2013.](Figs/Hind_M2_SST.jpg){width=90%} + +# 6. Projections {.tabset} + +The ACLIM project utilizes the full "suite" of Bering10K model hindcasts and projections, summarized in the following table. These represent downscaled models hindcast and projections whereby boundary conditions of the high resolution Bering10K model are forced by the coarser resolution General Circulation Models (GCM) run under Coupled Model Intercomparison Project (CMIP) phase 5 (5th IPCC Assessment Report) or phase 6 (6th IPCC Assessment Report; "AR") global carbon mitigation scenarios. Hindcasts are similarly forced at the boundaries from global scale climate reanalysis CORE and CFS products (see sections 1-5). For full details see the [Kearney 2021 Tech. Memo](https://beringnpz.github.io/roms-bering-sea/assets/DRAFT_NOAA-TM-AFSC-415.pdf). + +## Table 1: Summary of ROMSNPZ downscaled model runs +CMIP| GCM |Scenario |Def |Years |Model |Source|Status +--|--|------|--------|--------- | ---------------|----------|------|------| +||CORECFS |Reanalysis| Hindcast |1970 - 2018|H16 |IEA/ACLIM |Public +||CORECFS |Reanalysis | Hindcast |1970 - 2020|K20 |MAPP/IEA/ACLIM|Public +5 | GFDL |RCP 4.5 | Med. mitigation |2006 - 2099|H16 |ACLIM/FATE |Public +5 | GFDL |RCP 8.5 | High baseline |2006 - 2099|H16 |ACLIM/FATE |Public +5 | GFDL |RCP 8.5bio*| High baseline |2006 - 2099|H16 |ACLIM/FATE |Public +5 | MIROC |RCP 4.5 | Med. mitigation |2006 - 2099|H16 |ACLIM/FATE |Public +5 | MIROC |RCP 8.5 | High baseline |2006 - 2099|H16 |ACLIM/FATE |Public +5 | CESM |RCP 4.5 | Med. mitigation |2006 - 2099|H16 |ACLIM/FATE |Public +5 | CESM |RCP 8.5 | High baseline |2006 - 2080|H16 |ACLIM/FATE |Public +5 | CESM |RCP 8.5bio*| High baseline |2006 - 2099|H16 |ACLIM/FATE |Public +6| CESM |SSP585 | High baseline |2014 - 2099|K20P19 |ACLIM2/RTAP|Embargo +6| CESM |SSP126 | High Mitigation |2014 - 2099|K20P19 |ACLIM2/RTAP|Embargo +6| CESM |Historical | Historical |1980 - 2014|K20P19 |ACLIM2/RTAP|Embargo +6| GFDL |SSP585 | High baseline |2014 - 2099|K20P19 |ACLIM2/RTAP|Embargo +6| GFDL |SSP126 | High Mitigation |2014 - 2099|K20P19 |ACLIM2/RTAP|Embargo +6| GFDL |Historical | Historical |1980 - 2014|K20P19 |ACLIM2/RTAP|Embargo +6| MIROC |SSP585 | High baseline |2014 - 2099|K20P19 |ACLIM2/RTAP|Embargo +6| MIROC |SSP126 | High Mitigation |2014 - 2099|K20P19 |ACLIM2/RTAP|Embargo +6| MIROC |Historical | Historical |1980 - 2014|K20P19 |ACLIM2/RTAP|Embargo +*"bio" = nutrient forcing on boundary conditions + +## 6.1. Level 3 projections {.tabset} + +### 6.1.1. Level 3 projections: spatial patterns + +Now let's explore the survey replicated data in more detail and use to plot bottom temperature. + +```{r explore_srvy, eval=F, echo=T} + + # now create plots of average BT during four time periods + time_seg <- list( '2010-2020' = c(2010:2020), + '2021-2040' = c(2021:2040), + '2041-2060' = c(2041:2060), + '2061-2080' = c(2061:2080), + '2081-2099' = c(2081:2099)) + + # lists the possible variables + srvy_vars + + # specify the variables to plot + vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + + # View possible simulations: + head(aclim) + + # assign the simulation to download + # --> Tinker: try selecting a different set of models to compare + sim <-"B10K-H16_CMIP5_MIROC_rcp85" + sim <-"B10K-H16_CMIP5_CESM_rcp85" + + # open a "region" or strata specific nc file + fl <- file.path(sim,paste0(srvy_txt,sim,".Rdata")) + + # create local rdata files + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list =sim ) + + # load object 'ACLIMsurveyrep' + load(file.path(main,Rdata_path,fl)) + + + # Collate mean values across timeperiods and simulations + # ------------------------------------------------------- + m_set <- c(9,7,8) + ms <- aclim[m_set] + + # Loop over model set + for(sim in ms){ + fl <- file.path(sim,paste0(srvy_txt,sim,".Rdata")) + + # download & convert .nc files that are not already in Rdata folder + if(!file.exists( file.path(Rdata_path,fl)) ) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list =sim ) + + + } + + # get the mean values for the time blocks from the rdata versions + # will throw "implicit NA" errors that can be ignored + mn_var_all <- get_mn_rd(modset = ms ,varUSE="temp_bottom5m") + + # convert results to a shapefile + mn_var_sf <- convert2shp(mn_var_all%>%filter(!is.na(mnval))) + lab_t <- ms[2]%>%stringr::str_remove("([^-])") + + p3 <- plot_stations_basemap(sfIN = mn_var_sf, + fillIN = "mnval", + colorIN = "mnval", + sizeIN=.3) + + facet_grid(simulation~time_period)+ + scale_color_viridis_c()+ + scale_fill_viridis_c()+ + guides( + color = guide_legend(title="Bottom T (degC)"), + fill = guide_legend(title="Bottom T (degC)")) + + ggtitle(lab_t) + + # This is slow but it works (repeat dev.new() twice if in Rstudio)... + dev.new() + p3 + + if(update.figs) + ggsave(file=file.path(main,"Figs/mn_BT.jpg"),width=8,height=6) + + # graphics.off() + +``` + + +![Bottom temperature projections from the hindcast (top row) versus differing rcp 4.5 (top row) and rcp 8.5 (bottom row)](Figs/mn_BT.jpg) + +### 6.1.2. Level 3 projections: Weekly strata averages + +The next set of indices to will explore are the weekly strata-specific values for each variable.These are stored in the `ACLIMregion_B10K-[version_CMIPx_GCM_RCP].nc` in each scenario folder. + +```{r readncfiles_weekly, eval=F, echo=T} + + + # View an individual variable (e.g., Bottom Temp) + # ------------------------------------------------------- + weekly_vars + aclim + sim <-"B10K-H16_CMIP5_MIROC_rcp85" + + # open a "region" or strata specific nc file + fl <- file.path(sim,paste0(reg_txt,sim,".Rdata")) + + var_use <- "temp_bottom5m" + # tinker: var_use <- "Cop_integrated" + + vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + + # create local rdata files (opt 1) + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list = sim) + + # load object 'ACLIMregion' + load(file.path(main,Rdata_path,fl)) + tmp_var <- ACLIMregion%>%filter(var == var_use) + + # now plot the data: + + p4 <- ggplot(data = tmp_var) + + geom_line(aes(x=time,y=val,color= strata),alpha=.8)+ + facet_grid(basin~.)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(sim,tmp_var$var[1]))+ + theme_minimal() + p4 + if(update.figs) ggsave(file=file.path(main,"Figs/weekly_bystrata.jpg"),width=8,height=5) + + + # To get the average value for a set of strata, weight the val by the area: + mn_NEBS <- getAVGnSUM(strataIN = NEBS_strata, dataIN = tmp_var) + mn_NEBS$basin = "NEBS" + mn_SEBS <-getAVGnSUM(strataIN = SEBS_strata, dataIN = tmp_var) + mn_SEBS$basin = "SEBS" + + p5 <- ggplot(data = rbind(mn_NEBS,mn_SEBS)) + + geom_line(aes(x=time,y=mn_val,color=basin),alpha=.8)+ + geom_smooth(aes(x=time,y=mn_val,color=basin), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.4,end=.8)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(sim,mn_NEBS$var[1]))+ + + theme_minimal() + p5 + if(update.figs) + ggsave(file=file.path(main,"Figs/weekly_byreg.jpg"),width=8,height=5) + + +``` + +![Weekly indices by sub-region](Figs/weekly_bystrata.jpg){ width=90% } + +![Weekly indices by sub-region](Figs/weekly_byreg.jpg){ width=90% } + +### 6.1.3. Level 3 projections: Seasonal averages + +Now using a similar approach get the monthly mean values for a variable: +```{r seasonal averages proj, eval=F, include=T,echo=T} + + sim <-"B10K-H16_CMIP5_MIROC_rcp85" + + # Set up seasons (this follows Holsman et al. 2020) + seasons <- data.frame(mo = 1:12, + season =factor("", + levels=c("Winter","Spring","Summer","Fall"))) + seasons$season[1:3] <- "Winter" + seasons$season[4:6] <- "Spring" + seasons$season[7:9] <- "Summer" + seasons$season[10:12] <- "Fall" + + + vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + + # open a "region" or strata specific file + fl <- file.path(sim,paste0(reg_txt,sim,".Rdata")) + + # create local rdata files (opt 1) + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = TRUE, download_nc = F, + varlist = vl,sim_list = sim) + + load(file.path(main,Rdata_path,fl)) + + # get large zooplankton as the sum of euph and NCaS + tmp_var <- ACLIMregion%>% + filter(var%in%vl[c(2,3)])%>% + group_by(time,strata,strata_area_km2,basin)%>% + group_by(time, + strata, + strata_area_km2, + basin, + units)%>% + summarise(val =sum(val))%>% + mutate(var = "Zoop_integrated", + long_name ="Total On-shelf + large zooplankton concentration, + integrated over depth (NCa, Eup)") + + rm(ACLIMregion) + head(tmp_var) + + tmp_var$yr <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$year + 1900 + tmp_var$mo <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$mon + 1 + tmp_var$jday <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$yday + 1 + tmp_var$season <- seasons[tmp_var$mo,2] + + # To get the average value for a set of strata, weight the val by the area: (slow...) + mn_NEBS_season <- getAVGnSUM( + strataIN = NEBS_strata, + dataIN = tmp_var, + tblock=c("yr","season")) + mn_NEBS_season$basin = "NEBS" + mn_SEBS_season <- getAVGnSUM( + strataIN = SEBS_strata, + dataIN = tmp_var, + tblock=c("yr","season")) + mn_SEBS_season$basin = "SEBS" + + plot_data <- rbind(mn_NEBS_season,mn_SEBS_season) + + # plot Fall values: + p6 <- ggplot(data = plot_data%>%filter(season=="Fall") ) + + geom_line( aes(x = yr,y = mn_val,color=basin),alpha=.8)+ + geom_smooth( aes(x = yr,y = mn_val,color=basin), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.4,end=.8)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(sim,"Fall",mn_NEBS_season$var[1]))+ + theme_minimal() + p6 + + + if(update.figs) + ggsave(file=file.path(main,"Figs/Fall_large_Zoop.jpg"),width=8,height=5) + +``` + +![Large fall zooplankton integrated concentration](Figs/Fall_large_Zoop.jpg){ width=90% } +Now using a similar approach get the monthly mean values for a variable across CMIP6 ssps: + +```{r seasonal averages proj ssp, eval=F, include=T,echo=T} + +sim_set <-c("B10K-K20_CORECFS", + "B10K-K20P19_CMIP6_miroc_historical", + "B10K-K20P19_CMIP6_miroc_ssp126", + "B10K-K20P19_CMIP6_miroc_ssp585") + +# Set up seasons (this follows Holsman et al. 2020) +seasons <- data.frame(mo = 1:12, + season =factor("", + levels=c("Winter","Spring","Summer","Fall"))) +seasons$season[1:3] <- "Winter" +seasons$season[4:6] <- "Spring" +seasons$season[7:9] <- "Summer" +seasons$season[10:12] <- "Fall" + + +vl <- c( + "temp_bottom5m", + "NCaS_integrated", # Large Cop + "Cop_integrated", # Small Cop + "EupS_integrated") # Euphausiids + +ii<-0 +# open a "region" or strata specific file +for(sim in sim_set){ + ii <- ii + 1 + fl <- file.path(sim,paste0(reg_txt,sim,".Rdata")) + + # get local files from CMIP6 google drive folder copied to local Data/in + if(!file.exists(file.path(Rdata_path,fl))) + get_l3(web_nc = FALSE, download_nc = F, + local_path = file.path(local_fl,"roms_for_aclim"), + varlist = vl,sim_list = sim) + load(file.path(main,Rdata_path,fl)) + + # get large zooplankton as the sum of euph and NCaS + tmp_var <- ACLIMregion%>% + filter(var%in%vl[c(2,3)])%>% + group_by(time,strata,strata_area_km2,basin)%>% + group_by(time, + strata, + strata_area_km2, + basin, + units)%>% + summarise(val =sum(val))%>% + mutate(var = "Zoop_integrated", + long_name ="Total On-shelf + large zooplankton concentration, + integrated over depth (NCa, Eup)") + rm(fl) + rm(ACLIMregion) + head(tmp_var) + + tmp_var$yr <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$year + 1900 + tmp_var$mo <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$mon + 1 + tmp_var$jday <- strptime(as.Date(tmp_var$time), + format="%Y-%m-%d")$yday + 1 + tmp_var$season <- seasons[tmp_var$mo,2] + + tmp_var$sim <- sim + if(ii == 1) + plot_data <- tmp_var + if(ii > 1) + plot_data <- rbind(plot_data, tmp_var) + rm(tmp_var) + +} + + # # To get the average value for a set of strata by week, weight the val by the area: + # mn_NEBS <- getAVGnSUM( bysim = T, + # strataIN = NEBS_strata, + # dataIN = plot_data) + # mn_NEBS$basin = "NEBS" + # + # mn_SEBS <-getAVGnSUM( bysim = T, + # strataIN = SEBS_strata, + # dataIN = plot_data) + # mn_SEBS$basin = "SEBS" + # + +# To get the average value for a set of strata, weight the val by the area: (slow...) +mn_NEBS_season <- getAVGnSUM( + bysim = T, + strataIN = NEBS_strata, + dataIN = plot_data, + tblock=c("yr","season")) +mn_NEBS_season$basin = "NEBS" + +mn_SEBS_season <- getAVGnSUM( + bysim = T, + strataIN = SEBS_strata, + dataIN = plot_data, + tblock=c("yr","season")) +mn_SEBS_season$basin = "SEBS" + +plot_data_2 <- rbind(mn_NEBS_season,mn_SEBS_season) + +# plot Fall values: +p6v2 <- ggplot(data = plot_data_2%>%filter(season=="Fall") ) + + geom_line( aes(x = yr,y = mn_val,color=sim),alpha=.8)+ + geom_smooth( aes(x = yr,y = mn_val,color=sim), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.2,end=.8)+ + ylab(plot_data_2$units[1])+ + ggtitle( paste(sim,"Fall",mn_NEBS_season$var[1]))+ + theme_minimal() +p6v2 + + +if(update.figs) + ggsave(file=file.path(main,"Figs/Fall_large_Zoop_bySSP.jpg"),width=8,height=5) +``` + +These results demonstrate the importance and challenge of bias correcting projections to hindcasts or historical runs. + +![September large zooplankton integrated concentration](Figs/Fall_large_Zoop_bySSP.jpg){ width=90% } + +### 6.1.4. Level 3 Projections: Monthly averages +Using the same approach we can get monthly averages for a given variable: + +```{r monthly averages, eval=F, include=T,echo=T} + + # To get the average value for a set of strata, weight the val by the area: (slow...) + mn_NEBS_season <- getAVGnSUM( + strataIN = NEBS_strata, + dataIN = tmp_var, + tblock = c("yr","mo")) + mn_NEBS_season$basin = "NEBS" + + mn_SEBS_season <- getAVGnSUM( + strataIN = SEBS_strata, + dataIN = tmp_var, + tblock=c("yr","mo")) + mn_SEBS_season$basin = "SEBS" + + plot_data <- rbind(mn_NEBS_season,mn_SEBS_season) + + # plot Fall values: + p7 <- ggplot(data = plot_data%>%filter(mo==9) ) + + geom_line( aes(x = yr,y = mn_val,color=basin),alpha=.8)+ + geom_smooth( aes(x = yr,y = mn_val,color=basin), + formula = y ~ x, se = T)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.4,end=.8)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(aclim[2],"Sept.",mn_NEBS_season$var[1]))+ + theme_minimal() + print(p7) + + if(update.figs) + ggsave(file=file.path(main,"Figs/Sept_large_Zoop.jpg"),width=8,height=5) +``` + +![September large zooplankton integrated concentration](Figs/Sept_large_Zoop.jpg){ width=90% } + +Finally we can use this approach to plot the monthly averages and look for phenological shifts: +```{r phenology, eval=F, include=T,echo=T} + + # or average in 4 time slices by mo: + # now create plots of average BT during four time periods + time_seg <- list( '2010-2020' = c(2010:2020), + '2021-2040' = c(2021:2040), + '2041-2060' = c(2041:2060), + '2061-2080' = c(2061:2080), + '2081-2099' = c(2081:2099)) + + plot_data$ts <-names(time_seg)[1] + for(tt in 1:length((time_seg))) + plot_data$ts[plot_data$yr%in%(time_seg[[tt]][1]:time_seg[[tt]][2])]<-names(time_seg)[tt] + + plot_data2 <- plot_data%>% + group_by(var,mo,units,long_name,basin, ts)%>% + summarize(mn_val2 = mean(mn_val)) + + # now plot phenological shift: + p8 <- ggplot(data = plot_data2 ) + + geom_line( aes(x = mo,y = mn_val2,color=ts),alpha=.8,size=0)+ + geom_smooth( aes(x = mo,y = mn_val2,color=ts), + formula = y ~ x, se = F)+ + facet_grid(basin~.)+ + scale_color_viridis_d(begin=.9,end=.2)+ + ylab(tmp_var$units[1])+ + ggtitle( paste(aclim[2],mn_NEBS_season$var[1]))+ + theme_minimal() + p8 + if(update.figs) + ggsave(file=file.path(main,"Figs/PhenShift_large_Zoop.jpg"),width=8,height=5) + +``` + +![September large zooplankton integrated concentration](Figs/PhenShift_large_Zoop.jpg){ width=90% } + +## 6.2. Level 2 projections{.tabset} + +Level 2 data can be explored in the same way as the above indices but we will focus in the section below on a simple spatial plot and temporal index. The advantage of Level2 inidces is in the spatial resolution and values outside of the survey area. + +### 6.2.1 Level 2 projections: Custom spatial indices + +```{r explore_L2_space, eval=F, echo=T} + + # define four time periods + time_seg <- list( '2010-2020' = c(2000:2020), + '2021-2040' = c(2021:2040), + '2041-2060' = c(2041:2060), + '2061-2080' = c(2061:2080), + '2081-2099' = c(2081:2099)) + + # View an individual variable (e.g., Bottom Temp) + # ------------------------------------------------------- + head(srvy_vars) + head(aclim) + + # assign the simulation to download + # --> --> Tinker: try selecting a different set of models to compare + sim <-"B10K-H16_CMIP5_MIROC_rcp85" + + svl <- list( + 'Bottom 5m' = "temp", + 'Surface 5m' = "temp", + 'Integrated' = c("EupS","Cop","NCaS") ) + + # Currently available Level 2 variables + dl <- proj_l2_datasets$dataset # datasets + + + # Let's sample the model years as close to Aug 1 as the model timesteps run: + tr <- c("-08-1 12:00:00 GMT") + + # the full grid is large and takes a longtime to plot, so let's subsample the grid every 4 cells + + IDin <- "_Aug1_subgrid" + var_use <- "_bottom5m_temp" + + # open a "region" or strata specific nc file + fl <- file.path(main,Rdata_path,sim,"Level2", + paste0(sim,var_use,IDin,".Rdata")) + + # load object 'ACLIMsurveyrep' + if(!file.exists(file.path(Rdata_path,fl))) + get_l2( + ID = IDin, + xi_rangeIN = seq(1,182,10), + eta_rangeIN = seq(1,258,10), + ds_list = dl, + trIN = tr, + sub_varlist = svl, + sim_list = sim ) + + # load R data file + load(fl) # temp + + # there are smarter ways to do this;looping because + # we don't want to mess it up but this is slow... + i <-1 + data_long <- data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F + ) + for(i in 2:dim(temp$val)[3]) + data_long <- rbind(data_long, + data.frame(latitude = as.vector(temp$lat), + longitude = as.vector(temp$lon), + val = as.vector(temp$val[,,i]), + time = temp$time[i], + year = substr( temp$time[i],1,4),stringsAsFactors = F) + ) + + + # get the mean values for the time blocks from the rdata versions + # will throw "implicit NA" errors that can be ignored + tmp_var <-data_long # get mean var val for each time segment + j<-0 + for(i in 1:length(time_seg)){ + if(length( which(as.numeric(tmp_var$year)%in%time_seg[[i]] ))>0){ + j <- j +1 + mn_tmp_var <- tmp_var%>% + filter(year%in%time_seg[[i]],!is.na(val))%>% + group_by(latitude, longitude)%>% + summarise(mnval = mean(val,rm.na=T)) + + mn_tmp_var$time_period = factor(names(time_seg)[i],levels=names(time_seg)) + if(j == 1) mn_var <- mn_tmp_var + if(j > 1) mn_var <- rbind(mn_var,mn_tmp_var) + rm(mn_tmp_var) + } + } + + # convert results to a shapefile + L2_sf <- convert2shp(mn_var%>%filter(!is.na(mnval))) + + p9 <- plot_stations_basemap(sfIN = L2_sf, + fillIN = "mnval", + colorIN = "mnval", + sizeIN=.6) + + facet_grid(.~time_period)+ + scale_color_viridis_c()+ + scale_fill_viridis_c()+ + guides( + color = guide_legend(title="Bottom T (degC)"), + fill = guide_legend(title="Bottom T (degC)")) + + ggtitle(paste(sim,var_use,IDin)) + + # This is slow but it works (repeat dev.new() twice if in Rstudio)... + dev.new() + p9 + + if(update.figs) + ggsave(file=file.path(main,"Figs/sub_grid_mn_BT_Aug1.jpg"),width=8,height=6) + + # graphics.off() + +``` + + +![Aug 1 Bottom temperature from Level 2 dataset](Figs/sub_grid_mn_BT_Aug1.jpg){ width=100% } + + + + + + + + + + + + + +# 7. Funding and acknowledgments + +Multiple NOAA programs provided support for ACLIM and Bering Seasons projects including Fisheries and the Environment (FATE), Stock Assessment Analytical Methods (SAAM) Science and Technology North Pacific Climate Regimes and Ecosystem Productivity, the Integrated Ecosystem Assessment Program (IEA), the NOAA Modeling, Analysis, Predictions and Projections (MAPP) Program, the NOAA Economics and Social Analysis Division, NOAA Research Transition Acceleration Program (RTAP), the Alaska Fisheries Science Center (ASFC), the Office of Oceanic and Atmospheric Research (OAR) and the National Marine Fisheries Service (NMFS). Additional support was provided through the North Pacific Research Board (NPRB). + +This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government. + +# 8. Helpful links and further reading {.tabset} + +## 8.1 Citations for GCMs and carbon scenarios + +### CMIP3 (BSIERP global climate model runs) +Meehl, G. A., C. Covey, T. Delworth, M. Latif, B. McAvaney, J. F. B. Mitchell, R. J. Stouffer, and K. E. Taylor, 2007: The WCRP CMIP3 multimodel dataset: A new era in climate change research. Bull. Amer. Meteor. Soc., 88, 1383–1394. + +### CMIP5 (ACLIM global climate model runs) +Taylor, K. E., R. J. Stouffer, and G. A. Meehl, 2012:Anoverview of CMIP5 and the experiment design. Bull. Amer. Meteor. Soc., 93, 485–498. + +### CMIP6 and SSPs (ACLIM2 global climate model runs) +ONeill, B. C., C. Tebaldi, D. P. van Vuuren, V. Eyring, P. Friedlingstein, G. Hurtt, R. Knutti, E. Kriegler, J.-F. Lamarque, J. Lowe, G. A. Meehl, R. Moss, K. Riahi, and B. M. Sanderson. 2016. The Scenario Model Intercomparison Project (ScenarioMIP) for CMIP6. Geoscientific Model Development 9:3461–3482. + + + +## 8.2 Weblinks for further reading + +* Explore annual indices of downscaled projections for the EBS: [**ACLIM indices**](https://kholsman.shinyapps.io/aclim/ "ACLIM Shiny tool") + +* To view climate change projections from CMIP5 (eventually CMIP6):[**ESRL climate change portal **](https://www.esrl.noaa.gov/psd/ipcc/ocn/ "ESRL climate change portal") + + +## 8.3 Additional information on Hindcast and Projection Models (needs updating) + +### CORE-CFSR (1976-2020) + +This is the hindcast for the Bering Sea and is a combination of the reconstructed climatology from the [**CLIVAR**](http://portal.aoos.org/bering-sea.php#module-metadata/5626a0b6-7d79-11e3-ac17-00219bfe5678/0756e6c2-a8e2-40af-aa3d-22051ed68067) Co-ordinated Ocean-Ice Reference Experiments (CORE) Climate Model (1969-2006) the [**NCEP**](http://portal.aoos.org/bering-sea.php#module-metadata/f8cb79f6-7d59-11e3-a6ee-00219bfe5678/2deb2eca-f3f5-4eda-a132-112468711de7) Climate Forecast System Reanalysis is a set of re-forecasts carried out by NOAA's National Center for Environmental Prediction (NCEP). See [**CFS-R**](http://cfs.ncep.noaa.gov/cfsr/) for more info. + +### [CCCMA](http://www.cccma.ec.gc.ca/diagnostics/cgcm3/cgcm3.shtml)(2006-2039; AR4 SRES A1B) + +Developed by the Canadian Centre for Climate Modelling and Analysis, this is also known as the CGCM3/T47 model. This model showed the greatest warming over time compared to other models tested by PMEL. See more data the [**AOOS:CCCMA portal**](http://portal.aoos.org/bering-sea.php#module-metadata/4f706756-7d57-11e3-bce5-00219bfe5678/ffa1bcc1-288d-4f8e-912e-500a618b241a). + +### [ECHOG](http://www-pcmdi.llnl.gov/ipcc/model_documentation/ECHO-G.pdf)(2006-2039; AR4 SRES A1B) +The ECHO-G model from the Max Planck Institute in Germany This model showed the least warming over time compared to other models tested by PMEL. See more data the AOOS:ECHO-G portal. + +### [GFDL](http://www.gfdl.noaa.gov/earth-system-model) (2006-2100; AR5 RCP 4.5, 8.5, SSP126,SSP585) + +The NOAA Geophysical Fluid Dynamics Laboratory [**GFDL**](http://www.gfdl.noaa.gov) has lead development of the first Earth System Models (ESMs), which like physical climate models, are based on an atmospheric circulation model coupled with an oceanic circulation model, with representations of land, sea ice and iceberg dynamics; ESMs additionally incorporate interactive biogeochemistry, including the carbon cycle. The ESM2M model used in this project is an evolution of the prototype EMS2.1 model, where pressure-based vertical coordinates are used along the developmental path of GFDL's Modular Ocean Model version 4.1 and where the land model is more adavanced (LM3) than in the previous ESM2.1 + +### [MIROC](www.cger.nies.go.jp/publications/report/i073/I073.pdf)(2006-2039; AR4 SRES A1B; 2006-2100 RCP4.5, RCP8.5, SSP585, SSP126) + +The Model for Interdisciplinary Research on Climate (MIROC)-M model developed by a consortium of agencies in Japan []. Compared to other models tested by PMEL, MIROC-M was intermediate in degree of warming over the Bering Sea shelf for the first half of the 21st century. See more data the AOOS:MIROC portal. + + + + + + + + +```{r makeReadME, echo=FALSE,eval=F, include =F} + + # copy and paste this into R window (won't work within markdown) + rmd2md(rmd_fl = "GettingStarted_Bering10K_ROMSNPZ",md_fl = "README") + +``` + + +```{R downloadMOX, include=FALSE, echo=FALSE, eval=FALSE} + + # -------------------------------------- + # SETUP WORKSPACE + + tmstp <- format(Sys.time(), "%Y_%m_%d") + main <- getwd() #"~/GitHub_new/ACLIM2" + + # loads packages, data, setup, etc. + source("R/make.R") + + # -------------------------------------- + + ### To re download data from mox (Kirstin) switch "redownload_level3_mox" to TRUE in setup.R + + # Accessing ROMSNPZ on mox (hyak UW) + # If you have a UW ID and are authorized on + # hyak (can do this through myUW.com, under settings>computing): + + remote_main <- "/gscratch/bumblereem/roms_for_public" + remotefolder <- paste0("kkari@mox.hyak.uw.edu:",remote_main) + fldr_mox <- read.csv("Data/in/fldr_mox_list.csv",header=F,stringsAsFactors=F) + + if(redownload_level3_mox){ + if(dir.exists(remote_main)){ + #copy current folder to archived, delete folder, and make new empty one + system (paste0("cp -R ", + localfolder," ", + localfolder,"/../../archived/", + remote_fl,tmstp)) + + txt<- paste0( "rm -r ",localfolder) + system(txt) + dir.create(localfolder) + + } + # This file downloads the .nc level 3 indices from MOX to the local drive + #in terminal: + # open new screen (ctrl A+D to exit; screen -r to return screen -ls to see list) + ## screen + ## ssh kkari@mox.hyak.uw.edu + ## password : J bday + Josie’s dog (cap S on both) +!! + ## ls ../../bumblereem/roms_for_public #publically available files + ## ls ../../bumblereem/roms_for_public/B10K-K20_CORECFS/Level3 + + # open terminal (faster) and copy the last line or run it in system + + cat((paste0("rsync -avz --progress --include='**/Level*/*ACLIM*.nc' --include='*/' --exclude='*' ",remotefolder," ",local_fl))) + cat( (paste0("rsync -avz --progress --include='**/Level3/*coldpool*.nc' --include='*/' --exclude='*' ",remotefolder," ",local_fl))) + cat( (paste0("rsync -avz --progress --include='**/Level3/*forecast*.nc' --include='*/' --exclude='*' ",remotefolder," ",local_fl))) + + # ------------------------------------- + # IN TERMINAL: + # ------------------------------------- + # copy paste into local terminal (from cat above) + rsync -avz --progress --include='**/Level*/*ACLIM*.nc' --include='*/' --exclude='*' kkari@mox.hyak.uw.edu:/gscratch/bumblereem/roms_for_public /Users/kholsman/GitHub_new/ACLIM2/Data/in/Newest + + rsync -avz --progress --include='**/Level3/*coldpool*.nc' --include='*/' --exclude='*' kkari@mox.hyak.uw.edu:/gscratch/bumblereem/roms_for_public /Users/kholsman/GitHub_new/ACLIM2/Data/in/Newest + + rsync -avz --progress --include='**/Level3/*forecast*.nc' --include='*/' --exclude='*' kkari@mox.hyak.uw.edu:/gscratch/bumblereem/roms_for_public /Users/kholsman/GitHub_new/ACLIM2/Data/in/Newest + .xlsx + rsync -avz --progress --include='*Bering10K_simulation_variables*.xlsx' --include='*/' --exclude='*' kkari@mox.hyak.uw.edu:/gscratch/bumblereem/roms_for_public /Users/kholsman/GitHub_new/ACLIM2/Data/in/Newest + rsync -avz --progress --include='*AFSC_groundfish_survey*.xlsx' --include='*/' --exclude='*' kkari@mox.hyak.uw.edu:/gscratch/bumblereem/roms_for_public /Users/kholsman/GitHub_new/ACLIM2/Data/in/Newest + + # ------------------------------------- + # + # ------------------------------------- + + # Now rename the roms_for_public to roms_for_aclim + + remote_fl + file.rename(file.path(local_fl,remote_fl),localfolder) + + # # R doesn't like this (use copy paste into terminal above) + # system( (paste0("rsync -avz --dry-run --include='**/Level*/*ACLIM*.nc' --include='*/' --exclude='*' ",remotefolder," ",localfolder)) ) + # + # # system( (paste0("rsync -avz --progress ",remotefolder," ",localfolder))) + # + # system( (paste0("rsync -avz --progress --include='**/Level*/*ACLIM*.nc' --include='*/' --exclude='*' ",remotefolder," ",localfolder))) + + + } + +``` + + diff --git a/GettingStarted_Bering10K_ROMSNPZ.Rmd b/GettingStarted_Bering10K_ROMSNPZ.Rmd old mode 100644 new mode 100755 diff --git a/GettingStarted_Bering10K_ROMSNPZ.html b/GettingStarted_Bering10K_ROMSNPZ.html old mode 100644 new mode 100755 diff --git a/GettingStarted_Bering10K_ROMSNPZ.md b/GettingStarted_Bering10K_ROMSNPZ.md old mode 100644 new mode 100755 diff --git a/GettingStarted_Bering10K_ROMSNPZ.pdf b/GettingStarted_Bering10K_ROMSNPZ.pdf old mode 100644 new mode 100755 diff --git a/GettingStarted_Bering10K_ROMSNPZ.tex b/GettingStarted_Bering10K_ROMSNPZ.tex old mode 100644 new mode 100755 diff --git a/R/.DS_Store b/R/.DS_Store old mode 100644 new mode 100755 index d10fe6c..32b9cf3 Binary files a/R/.DS_Store and b/R/.DS_Store differ diff --git a/R/load_data.R b/R/load_data.R old mode 100644 new mode 100755 diff --git a/R/load_functions.R b/R/load_functions.R old mode 100644 new mode 100755 diff --git a/R/make.R b/R/make.R old mode 100644 new mode 100755 diff --git a/R/packages.R b/R/packages.R old mode 100644 new mode 100755 diff --git a/R/setup.R b/R/setup.R old mode 100644 new mode 100755 index 2269145..35a5da6 --- a/R/setup.R +++ b/R/setup.R @@ -52,8 +52,11 @@ # Rdata_path <- file.path(file.path("Data/in", subfldrR),remote_fl) # if(.Platform$OS.type == "unix") { - data_path <- file.path("/Volumes/LaCie/romsnpz",remote_fl) - Rdata_path <- file.path(file.path("/Volumes/LaCie/romsnpz", subfldrR),remote_fl) + # data_path <- file.path("/Volumes/LaCie/romsnpz",remote_fl) + # Rdata_path <- file.path(file.path("/Volumes/LaCie/romsnpz", subfldrR),remote_fl) + data_path <- file.path("data/in",remote_fl) + Rdata_path <- file.path(file.path("data/in", subfldrR),remote_fl) + if(!dir.exists(file.path(file.path("data/in", subfldrR)))) dir.create(file.path(file.path("data/in", subfldrR))) } if(.Platform$OS.type == "windows") { @@ -132,8 +135,6 @@ "B10K-H16_CMIP5_GFDL_rcp85" , "B10K-H16_CMIP5_MIROC_rcp45" , "B10K-H16_CMIP5_MIROC_rcp85" , - "B10K-H16_CORECFS" , - "B10K-K20_CORECFS" , "B10K-K20P19_CMIP6_cesm_historical" , "B10K-K20P19_CMIP6_cesm_ssp126" , "B10K-K20P19_CMIP6_cesm_ssp585" , @@ -171,11 +172,11 @@ cat("------------------------------\n") cat("------------------------------\n") cat("\n") - cat(paste("The following datasets are public, please cite as Hermann et al. 2019 (v.H16) and Kearney et al. 2020 (v.K20) :\n")) + cat(paste("The following datasets use the B10K-H16_CORECFS hindcast and are public, please cite as Hermann et al. 2019 (v.H16) :\n")) for(k in public) cat(paste(k,"\n")) cat("\n") - cat(paste("The following datasets are still under embargo, please do not share outside of ACLIM:\n")) + cat(paste("The following datasets use the B10K-K20_CORECFS hindcast and are public, please reach out to A. Hermann, K. Kearney, W. Cheng, and D. Pilcher for more info, please cite as Kearney et al. 2020 and Pilcher et al. (2021) for v.K20 hindcast), Hermann et al. (2021), and Cheng et al. 2021 (for CMIP6 projections). \n")) for(k in embargoed) cat(paste(k,"\n")) diff --git a/R/shiny_aclim/.DS_Store b/R/shiny_aclim/.DS_Store old mode 100644 new mode 100755 diff --git a/R/shiny_aclim/ACLIM2_indices/.Rapp.history b/R/shiny_aclim/ACLIM2_indices/.Rapp.history old mode 100644 new mode 100755 diff --git a/R/shiny_aclim/ACLIM2_indices/ACLIM2_indices.Rproj b/R/shiny_aclim/ACLIM2_indices/ACLIM2_indices.Rproj old mode 100644 new mode 100755 diff --git a/R/shiny_aclim/ACLIM2_indices/app.R b/R/shiny_aclim/ACLIM2_indices/app.R old mode 100644 new mode 100755 diff --git a/R/shiny_aclim/ACLIM2_indices/rsconnect/._shinyapps.io b/R/shiny_aclim/ACLIM2_indices/rsconnect/._shinyapps.io deleted file mode 100644 index 169e65d..0000000 Binary files a/R/shiny_aclim/ACLIM2_indices/rsconnect/._shinyapps.io and /dev/null differ diff --git a/R/shiny_aclim/ACLIM2_indices/rsconnect/shinyapps.io/._kkh2022 b/R/shiny_aclim/ACLIM2_indices/rsconnect/shinyapps.io/._kkh2022 deleted file mode 100644 index 169e65d..0000000 Binary files a/R/shiny_aclim/ACLIM2_indices/rsconnect/shinyapps.io/._kkh2022 and /dev/null differ diff --git a/R/shiny_aclim/ACLIM2_indices/rsconnect/shinyapps.io/kkh2022/ACLIM2_indices.dcf b/R/shiny_aclim/ACLIM2_indices/rsconnect/shinyapps.io/kkh2022/ACLIM2_indices.dcf old mode 100644 new mode 100755 diff --git a/R/shiny_aclim/HCR_viewer/._rsconnect b/R/shiny_aclim/HCR_viewer/._rsconnect deleted file mode 100644 index 169e65d..0000000 Binary files a/R/shiny_aclim/HCR_viewer/._rsconnect and /dev/null differ diff --git a/R/shiny_aclim/HCR_viewer/HCR.R b/R/shiny_aclim/HCR_viewer/HCR.R old mode 100644 new mode 100755 diff --git a/R/shiny_aclim/HCR_viewer/app.R b/R/shiny_aclim/HCR_viewer/app.R old mode 100644 new mode 100755 index 0e7144b..74ee23a --- a/R/shiny_aclim/HCR_viewer/app.R +++ b/R/shiny_aclim/HCR_viewer/app.R @@ -9,7 +9,7 @@ library(shiny) library(plotly) -library(heatmaply) +#library(heatmaply) library("shiny" ) library("timevis") library("plotly") diff --git a/R/shiny_aclim/HCR_viewer/rsconnect/._shinyapps.io b/R/shiny_aclim/HCR_viewer/rsconnect/._shinyapps.io deleted file mode 100644 index 169e65d..0000000 Binary files a/R/shiny_aclim/HCR_viewer/rsconnect/._shinyapps.io and /dev/null differ diff --git a/R/shiny_aclim/HCR_viewer/rsconnect/shinyapps.io/._kkh2022 b/R/shiny_aclim/HCR_viewer/rsconnect/shinyapps.io/._kkh2022 deleted file mode 100644 index 169e65d..0000000 Binary files a/R/shiny_aclim/HCR_viewer/rsconnect/shinyapps.io/._kkh2022 and /dev/null differ diff --git a/R/shiny_aclim/HCR_viewer/rsconnect/shinyapps.io/kkh2022/HCR_viewer.dcf b/R/shiny_aclim/HCR_viewer/rsconnect/shinyapps.io/kkh2022/HCR_viewer.dcf old mode 100644 new mode 100755 diff --git a/R/sub_fun/GGPLOT_THEMES.R b/R/sub_fun/GGPLOT_THEMES.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/ScaleIT.R b/R/sub_fun/ScaleIT.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/aclim_list_services.R b/R/sub_fun/aclim_list_services.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/bias_correct_new_station.R b/R/sub_fun/bias_correct_new_station.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/bias_correct_new_strata.R b/R/sub_fun/bias_correct_new_strata.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/clip_spdt.R b/R/sub_fun/clip_spdt.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/convert2df.R b/R/sub_fun/convert2df.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/convert2df_coldpool.R b/R/sub_fun/convert2df_coldpool.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/convert2df_forecast.R b/R/sub_fun/convert2df_forecast.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/convert2shp.R b/R/sub_fun/convert2shp.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/dir.remove.R b/R/sub_fun/dir.remove.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/gam_biascorrection.R b/R/sub_fun/gam_biascorrection.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/getAVGnSUM.R b/R/sub_fun/getAVGnSUM.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/getINDICES_strata.R b/R/sub_fun/getINDICES_strata.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/getINDICES_survey.R b/R/sub_fun/getINDICES_survey.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/getNE_winds.R b/R/sub_fun/getNE_winds.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/getZip.R b/R/sub_fun/getZip.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_MHW.R b/R/sub_fun/get_MHW.R new file mode 100755 index 0000000..51266c1 --- /dev/null +++ b/R/sub_fun/get_MHW.R @@ -0,0 +1,112 @@ +#' +#' +#' +#'get_MHW.R +#' +#'K. Holsman +#'ACLIM2 code +#' +#'Generates MHW from ROMSNPZ Level 3 weekly data +#'2024 +#' + +get_MHW <- function(datIN = df_NEBS_BT$dat, + ref_yearsIN = ref_years, + hindsim = "ACLIMregion_B10K-K20P19_CORECFS"){ + + dfnew <- datIN + + decades <- seq(1960,2110,10) + quarters <- seq(1900,2150,25) + time_df <- data.frame( + year = c(1970:2100), + decade = NA, + quarter = NA) + + for(tt in 1:length(decades)){ + rr <- which(time_df$year=decades[tt]) + time_df$decade[rr] <- decades[tt] + } + for(tt in 1:length(quarters)){ + rr <- which(time_df$year=quarters[tt]) + time_df$quarter[rr] <- quarters[tt] + } + climatology <- dfnew%>% + filter(year%in%ref_yearsIN, sim==hindsim)%>% + select(year,season,mo, wk, basin, var,val_use)%>% + unique()%>%group_by(wk, basin, var)%>% + summarise(mnval = mean(val_use,na.rm=T), + sdval = sd(val_use,na.rm=T))%>% + mutate(Category1 = mnval+sdval, + Category2 = mnval+2*sdval, + Category3 = mnval+3*sdval, + Category4 = mnval+4*sdval, + Category5 = mnval+5*sdval)%>% + mutate(Category_neg1 = mnval-sdval, + Category_neg2 = mnval-2*sdval, + Category_neg3 = mnval-3*sdval, + Category_neg4 = mnval-4*sdval, + Category_neg5 = mnval-5*sdval) + + dfnew<- dfnew%>%left_join(time_df)%>% + # now join with climatology + left_join(climatology)%>% + # now find the plotdata + rowwise()%>%mutate( + plotdat1 = max(Category1,val_use), + plotdat2 = max(Category2,val_use), + plotdat3 = max(Category3,val_use), + plotdat4 = max(Category4,val_use), + plotdat5 = max(Category5,val_use), + + plotdatNeg1 = min(Category_neg1,val_use), + plotdatNeg2 = min(Category_neg2,val_use), + plotdatNeg3 = min(Category_neg3,val_use), + plotdatNeg4 = min(Category_neg4,val_use), + plotdatNeg5 = min(Category_neg5,val_use))%>% + mutate(cat5 = ifelse(val_use>=Category5,val_use,0), + cat4 = ifelse(val_use>=Category4&val_use=Category3&val_use=Category2&val_use=Category1&val_useCategory_neg5,val_use,0), + catNeg3 = ifelse(val_use<=Category_neg3&val_use>Category_neg4,val_use,0), + catNeg2 = ifelse(val_use<=Category_neg2&val_use>Category_neg3,val_use,0), + catNeg1 = ifelse(val_use<=Category_neg1&val_use>Category_neg2,val_use,0) + )%>% + ungroup()%>%data.frame() + + MHW_decade = dfnew%>%group_by(decade, sim, scen, GCM,basin,var)%>% + summarize(tot = length(cat1), + sumcat1 = length(which(cat1>0)),Category1 = round(sumcat1/tot,4), + sumcat2 = length(which(cat2>0)),Category2 = round(sumcat2/tot,4), + sumcat3 = length(which(cat3>0)),Category3 = round(sumcat3/tot,4), + sumcat4 = length(which(cat4>0)),Category4 = round(sumcat4/tot,4), + sumcat5 = length(which(cat5>0)),Category5 = round(sumcat5/tot,4), + + sumcatNeg1 = length(which(catNeg1>0)),CategoryNeg1 = round(sumcatNeg1/tot,4), + sumcatNeg2 = length(which(catNeg2>0)),CategoryNeg2 = round(sumcatNeg2/tot,4), + sumcatNeg3 = length(which(catNeg3>0)),CategoryNeg3 = round(sumcatNeg3/tot,4), + sumcatNeg4 = length(which(catNeg4>0)),CategoryNeg4 = round(sumcatNeg4/tot,4), + sumcatNeg5 = length(which(catNeg5>0)),CategoryNeg5 = round(sumcatNeg5/tot,4) + )%>%data.frame() + + MHW_quarter= dfnew%>%group_by(quarter, sim, scen, GCM,basin,var)%>% + summarize(tot = length(cat1), + sumcat1 = length(which(cat1>0)),Category1 = round(sumcat1/tot,4), + sumcat2 = length(which(cat2>0)),Category2 = round(sumcat2/tot,4), + sumcat3 = length(which(cat3>0)),Category3 = round(sumcat3/tot,4), + sumcat4 = length(which(cat4>0)),Category4 = round(sumcat4/tot,4), + sumcat5 = length(which(cat5>0)),Category5 = round(sumcat5/tot,4), + + sumcatNeg1 = length(which(catNeg1>0)),CategoryNeg1 = round(sumcatNeg1/tot,4), + sumcatNeg2 = length(which(catNeg2>0)),CategoryNeg2 = round(sumcatNeg2/tot,4), + sumcatNeg3 = length(which(catNeg3>0)),CategoryNeg3 = round(sumcatNeg3/tot,4), + sumcatNeg4 = length(which(catNeg4>0)),CategoryNeg4 = round(sumcatNeg4/tot,4), + sumcatNeg5 = length(which(catNeg5>0)),CategoryNeg5 = round(sumcatNeg5/tot,4) + )%>%data.frame() + + return(list(MHW = dfnew, MHW_decade = MHW_decade, MHW_quarter = MHW_quarter)) +} + diff --git a/R/sub_fun/get_bc_mean.R b/R/sub_fun/get_bc_mean.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_l2.R b/R/sub_fun/get_l2.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_l3.R b/R/sub_fun/get_l3.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_l3_forecasts.R b/R/sub_fun/get_l3_forecasts.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_level2.R b/R/sub_fun/get_level2.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_mn_rd.R b/R/sub_fun/get_mn_rd.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_mn_srvy_var.R b/R/sub_fun/get_mn_srvy_var.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/get_var.R b/R/sub_fun/get_var.R old mode 100644 new mode 100755 index 72e0090..60c00c5 --- a/R/sub_fun/get_var.R +++ b/R/sub_fun/get_var.R @@ -11,13 +11,15 @@ #' -get_var<- function( +get_var <- function( typeIN = "annual", #ACLIM2 Index Type" plotvar = "temp_bottom5m", #variable to plot + alphaIN = c(0.6,.1), adjIN = "val_delta", plothist = T, ifmissingyrs = 5, stitchDateIN = stitchDate, + strataIN = NULL, monthIN = NULL, #"Month weekIN = NULL, #"Week" SeasonIN = NULL, #,"Season",selected=seasons,choices=seasons, multiple=T), @@ -91,7 +93,8 @@ get_var<- function( #dhind<-dhind%>%ungroup()%>%group_by(all_of(c("var",groupbyIN)))%>%ungroup() sellist <- c(groupbyIN,"var","basin", "jday","mnDate","val_raw","mn_val","sd_val", "sim","gcmcmip","GCM", "GCM2","scen","sim_type") - + + sellist <- sellist[sellist%in%names(dhind)] hind <- dhind%>%dplyr::filter(var ==plotvar,basin==plotbasin,GCM2 =="hind")%>% dplyr::select(all_of(c(sellist,"mnVal_hind")))%>% @@ -153,6 +156,8 @@ get_var<- function( plotdatout <- plotdatout%>%dplyr::filter(mo%in% monthIN) if(!is.null(weekIN)) plotdatout <- plotdatout%>%dplyr::filter(wk%in% weekIN) + # if(!is.null(strataIN)) + # plotdatout <- plotdatout%>%dplyr::filter(strata%in%strataIN) if(!is.null(jday_rangeIN)) plotdatout <- plotdatout%>%dplyr::filter(dplyr::between(jday, jday_rangeIN[1], jday_rangeIN[2])) @@ -166,8 +171,8 @@ get_var<- function( dat <- plotdatout%>%ungroup() pp<- ggplot(dat)+ - geom_line(aes(x=mnDate,y=val_use,color= GCM_scen,linetype = basin),alpha = 0.6,show.legend = FALSE)+ - geom_smooth(aes(x=mnDate,y=val_use,color= GCM_scen,fill=GCM_scen_sim,linetype = basin),alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + geom_line(aes(x=mnDate,y=val_use,color= GCM_scen,linetype = basin),alpha = alphaIN[1],show.legend = FALSE)+ + geom_smooth(aes(x=mnDate,y=val_use,color= GCM_scen,fill=GCM_scen_sim,linetype = basin),alpha=alphaIN[2],method="loess",formula='y ~ x',span = .5)+ theme_minimal() + labs(x="Date", subtitle = "", @@ -176,6 +181,11 @@ get_var<- function( scale_color_discrete() eval(parse(text = paste0("pp <-pp+facet_grid(",facet_rowIN,"~",facet_colIN,")") )) - return(list(dat=plotdatout%>%select(-mn_val)%>%ungroup()%>%relocate(all_of(c(groupbyIN,"basin","var","val_use","sd_val", - "val_raw"))), plot=pp)) + outlist <- c(groupbyIN,"basin","var","val_use","sd_val","val_raw") + for(cc in outlist[!outlist%in%names(plotdatout)]){ + message(cat(cc," is missing from outdat, adding as NA\n")) + eval(parse(text = paste0("plotdatout$",cc," <- NA") )) + } + + return(list(dat=plotdatout%>%select(-mn_val)%>%ungroup()%>%relocate(all_of(outlist))%>%data.frame(), plot=pp)) } diff --git a/R/sub_fun/get_var_old.R b/R/sub_fun/get_var_old.R new file mode 100644 index 0000000..dfa5d77 --- /dev/null +++ b/R/sub_fun/get_var_old.R @@ -0,0 +1,188 @@ +#' +#' +#' +#'get_var_ophind.R +#' + +#' +#' +#' +#'get_var +#' + + +get_var_old<- function( + typeIN = "annual", #ACLIM2 Index Type" + plotvar = "temp_bottom5m", #variable to plot + alphaIN = c(0.6,.1), + adjIN = "val_delta", + plothist = T, + ifmissingyrs = 5, + stitchDateIN = stitchDate, + monthIN = NULL, #"Month + weekIN = NULL, #"Week" + SeasonIN = NULL, #,"Season",selected=seasons,choices=seasons, multiple=T), + jday_rangeIN = NULL, #c(0,365), # + CMIPIN = "K20P19_CMIP6", + bcIN = c("raw","bias corrected"),# "bias corrected or raw", + GCMIN = NULL, # + scenIN = NULL, + plotbasin = c("SEBS"), + facet_rowIN = "bc", #choices=c("bc","basin","scen") + facet_colIN = "scen", # ,"col",selected=c("scen"),choices=c("bc","basin","scen"), multiple=F), + removeyr1 = T #"Remove first year of projection ( burn in)" +){ + scenINuse <- scenIN + + for(c in 1:length(CMIPIN)){ + load(paste0("Data/out/",CMIPIN[c],"/allEBS_means/ACLIM_",typeIN,"_hind_mn.Rdata")) + load(paste0("Data/out/",CMIPIN[c],"/allEBS_means/ACLIM_",typeIN,"_hist_mn.Rdata")) + load(paste0("Data/out/",CMIPIN[c],"/allEBS_means/ACLIM_",typeIN,"_fut_mn.Rdata")) + + eval(parse(text = paste0("dhindIN <- ACLIM_",typeIN,"_hind"))) + eval(parse(text = paste0("dhistIN <- ACLIM_",typeIN,"_hist"))) + eval(parse(text = paste0("dfut <- ACLIM_",typeIN,"_fut"))) + + groupbyIN <- c("year") + + if(typeIN == "monthly"){ + cat("monthly\n") + months <- unique(c(dhindIN$mo)) + seasons <- unique(c(dhindIN$season)) + groupbyIN <- c("year","season","mo") + print(groupbyIN) + } + + if(typeIN == "seasonal"){ + cat("seasonal\n") + seasons <- unique(c(dhindIN$season)) + groupbyIN <- c("year","season") + } + + if(typeIN == "weekly"){ + cat("weekly\n") + weeks <- unique(c(dhindIN$wk)) + months <- unique(c(dhindIN$mo)) + seasons <- unique(c(dhindIN$season)) + groupbyIN <- c("year","season","mo","wk") + } + + if(removeyr1){ + yrin <- sort(unique(dfut$year))[1] + dfut <- dfut%>%dplyr::filter(year>yrin) + } + CMIP <- CMIPIN[c] + if(is.null(scenIN)) + scenINuse <- unique(dfut$RCP) + + for(s in 1:length(scenINuse)){ + + if(s ==1){ + dhind <- dhindIN%>% + dplyr::mutate(scen = scenINuse[s],gcmcmip="hind",GCM ="hind",GCM2="hind") + dhist <- dhistIN%>% + dplyr::mutate(scen = scenINuse[s],gcmcmip="hist",GCM2="hist") + } + if(s>1){ + dhind <- rbind(dhind,dhindIN%>%dplyr::mutate(scen = scenINuse[s],gcmcmip="hind",GCM ="hind",GCM2="hind")) + dhist <- rbind(dhist,dhistIN%>%dplyr::mutate(scen = scenINuse[s],gcmcmip="hist",GCM2="hist")) + } + } + + #dhind<-dhind%>%ungroup()%>%group_by(all_of(c("var",groupbyIN)))%>%ungroup() + sellist <- c(groupbyIN,"var","basin", "jday","mnDate","val_raw","mn_val","sd_val", "sim","gcmcmip","GCM", + "GCM2","scen","sim_type") + + sellist <- sellist[sellist%in%names(dhind)] + + hind <- dhind%>%dplyr::filter(var ==plotvar,basin==plotbasin,GCM2 =="hind")%>% + dplyr::select(all_of(c(sellist,"mnVal_hind")))%>% + mutate(val_delta = mn_val,val_biascorrected=mn_val) + hist <- dhist%>%dplyr::filter(var ==plotvar,basin==plotbasin)%>% + dplyr::select(all_of(sellist))%>% + mutate(mnVal_hind=NA,val_delta = mn_val,val_biascorrected=mn_val) + + fut <- dfut%>%dplyr::filter(var ==plotvar,basin==plotbasin)%>%mutate(GCM2 = GCM,scen=RCP)%>% + dplyr::select(all_of(c(sellist,"mnVal_hind","val_delta","val_biascorrected"))) + + # get raw values + fut <- fut%>%mutate(val_use=mn_val) + hist <- hist%>%mutate(val_use=mn_val) + hind <- hind%>%mutate(val_use=mn_val) + plotdat <- rbind(hind,hist,fut)%>%dplyr::mutate(bc = "raw") + + # get adjusted values + hind_bc <- hind%>%dplyr::mutate(val_use = mn_val, bc="bias corrected") + eval(parse(text = paste0("fut_bc <- fut%>%dplyr::mutate(val_use = ",adjIN,",bc='bias corrected')") )) + fut_bc <-rbind(hind_bc,fut_bc) + + plotdat <- rbind(plotdat,fut_bc) + plotdat$bc <- factor(plotdat$bc, levels =c("raw","bias corrected")) + plotdat$GCM_scen <- paste0(plotdat$GCM,"_",plotdat$scen) + plotdat$GCM_scen_sim <- paste0(plotdat$GCM,"_",plotdat$scen,"_",plotdat$sim_type) + plotdat$GCM2_scen_sim <- paste0(plotdat$GCM2,"_",plotdat$scen,"_",plotdat$sim_type) + plotdat$CMIP <- CMIPIN[c] + + if(c ==1 ){ + plotdatout <- plotdat + }else{ + plotdatout <- rbind(plotdatout,plotdat) + } + rm(plotdat) + } + if(is.null(scenIN)) + scenINuse <- unique(plotdatout$scen) + + if(is.null(GCMIN)) + GCMIN <- unique(plotdatout$GCM) + + gcmlist<- GCMIN + if(!grep("hind",GCMIN)>0) + gcmlist<- c("hind",GCMIN) + + if(plothist) + gcmlist<- unique(c("hind","hist",GCMIN)) + + + plotdatout <- plotdatout%>%dplyr::filter( + scen%in%scenINuse, + GCM%in%gcmlist, + bc%in%bcIN) + + if(!is.null(SeasonIN)) + plotdatout <- plotdatout%>%dplyr::filter(season%in% SeasonIN) + if(!is.null(monthIN)) + plotdatout <- plotdatout%>%dplyr::filter(mo%in% monthIN) + if(!is.null(weekIN)) + plotdatout <- plotdatout%>%dplyr::filter(wk%in% weekIN) + if(!is.null(jday_rangeIN)) + plotdatout <- plotdatout%>%dplyr::filter(dplyr::between(jday, jday_rangeIN[1], jday_rangeIN[2])) + + if(!plothist) + plotdatout<- plotdatout%>%dplyr::filter(gcmcmip!="hist") + # units <- plotdatout$units[1] + plotdatout$type <- typeIN + + nyrs <- length(unique(plotdatout$year)) + spanIN <- 5/nyrs + dat <- plotdatout%>%ungroup() + + pp<- ggplot(dat)+ + geom_line(aes(x=mnDate,y=val_use,color= GCM_scen,linetype = basin),alpha = alphaIN[1],show.legend = FALSE)+ + geom_smooth(aes(x=mnDate,y=val_use,color= GCM_scen,fill=GCM_scen_sim,linetype = basin),alpha=alphaIN[2],method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Date", + subtitle = "", + legend = "", + title = paste(plotvar,"(",plotbasin,",",typeIN,")"))+ + scale_color_discrete() + eval(parse(text = paste0("pp <-pp+facet_grid(",facet_rowIN,"~",facet_colIN,")") )) + + outlist <- c(groupbyIN,"basin","var","val_use","sd_val","val_raw") + for(cc in outlist[!outlist%in%names(plotdatout)]){ + message(cat(cc," is missing from outdat, adding as NA\n")) + eval(parse(text = paste0("plotdatout$",cc," <- NA") )) + } + + return(list(dat=plotdatout%>%select(-mn_val)%>%ungroup()%>%relocate(all_of(outlist))%>%data.frame(), plot=pp)) +} diff --git a/R/sub_fun/get_var_ophind.R b/R/sub_fun/get_var_ophind.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/info.R b/R/sub_fun/info.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/makeACLIM2_BC_Indices_new.R b/R/sub_fun/makeACLIM2_BC_Indices_new.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/makeACLIM2_Indices_new_operational.R b/R/sub_fun/makeACLIM2_Indices_new_operational.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/makeACLIM2_L4_Indices.R b/R/sub_fun/makeACLIM2_L4_Indices.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/makeDat_fut.R b/R/sub_fun/makeDat_fut.R old mode 100644 new mode 100755 index 1387e45..514417e --- a/R/sub_fun/makeDat_fut.R +++ b/R/sub_fun/makeDat_fut.R @@ -3,6 +3,7 @@ #' #' makeDat_fut.R #' + makeDat_fut <- function( datIN = fut, hinddatIN = hind, NAVal = "mean", @@ -20,28 +21,29 @@ makeDat_fut <- function( datIN = fut, if(is.null(NAVal)){ myfun <- function(x){ return(x) - }} + }} if(NAVal == "mean"){ - myfun <- function(x){ x2 <- rev(x[1:last_nyrs_avg]) if(any(is.na(x))) x[is.na(x)] <- mean(x2, na.rm=T) return(x) - }} + }} + if(NAVal == "last"){ myfun <- function(x){ if(any(is.na(x))) x[is.na(x)] <- rev(x[!is.na(x)])[1] return(x) - }} + }} if(NAVal == "5Yrmean"){ myfun <- function(x){ if(any(is.na(x))) x[is.na(x)] <- mean(rev(x[!is.na(x)])[1:5]) return(x) - }} + }} + eval(parse(text = paste0("datIN <- datIN%>%dplyr::rename(VAL = ",value2use,")") )) eval(parse(text = paste0("datIN <- datIN%>%dplyr::rename(covuse = ",value2use_scaled,")"))) eval(parse(text = paste0("hinddatIN <- hinddatIN%>%dplyr::rename(VAL = ",value2use,")") )) diff --git a/R/sub_fun/makeDat_hind.R b/R/sub_fun/makeDat_hind.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/make_GWLplot.R b/R/sub_fun/make_GWLplot.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/make_indices_srvyrep_station.R b/R/sub_fun/make_indices_srvyrep_station.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/make_indices_strata.R b/R/sub_fun/make_indices_strata.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/misc.R b/R/sub_fun/misc.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/plotNEBS_productivity.R b/R/sub_fun/plotNEBS_productivity.R old mode 100644 new mode 100755 index 10d3ac7..a856462 --- a/R/sub_fun/plotNEBS_productivity.R +++ b/R/sub_fun/plotNEBS_productivity.R @@ -40,15 +40,19 @@ plotNEBS_productivity<- function(datIN=ACLIM_weekly_hind,angleIN=90, geom_line(aes(x=mnDate,y = mn_val,color=basin),size=1.1)+ facet_grid(basin~.)+theme_minimal() - datIN2 <- datIN%>%filter(year<2020)%>%group_by(var,units,sim,basin,type,sim_type,year,season)%>% + datIN2 <- datIN%>%filter(year<2020)%>% + group_by(var,sim,basin,type,sim_type,year,season)%>% summarize(mnVal = mean(mn_val,na.rm=T)) - mn <- datIN%>%filter(year<2001)%>%group_by(var,units,sim,basin,type,sim_type,season)%>% + mn <- datIN%>%filter(year<2001)%>% + group_by(var,sim,basin,type,sim_type,season)%>% summarize(mnVal = mean(mn_val,na.rm=T)) p2 <-ggplot(datIN2)+ - geom_line(aes(x=year,y = mnVal,color=basin),size=1.1)+ylab(datIN2$units[1])+ - geom_hline(data=mn,aes(yintercept=mnVal, color=basin),linetype="solid",size=.8)+ + geom_line(aes(x=year,y = mnVal,color=basin),size=1.1)+ + ylab(varlistIN$units)+ + geom_hline(data=mn,aes(yintercept=mnVal, color=basin), + linetype="solid",size=.8)+ facet_grid(season~basin)+theme_minimal()+ theme(axis.text.x = element_text(angle = angleIN))+ scale_fill_viridis_d(end = .5, begin =.2)+ @@ -69,10 +73,10 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, varlistIN$longname dat1 <- datIN%>% filter(var%in%varlistIN$name, basin%in%basinIN, year <2020)%>% - select(var,units,basin,sim, year, season,mn_val, GCM,gcmcmip, scen, CMIP,sim_type,type)%>% + select(var,basin,sim, year, season,mn_val, GCM,gcmcmip, scen, CMIP,sim_type,type)%>% mutate(val = mn_val)%>%rename(val_biascorrected=mn_val) dat2 <- datIN_fut%>%filter(var%in%varlistIN$name, basin%in%basinIN, year >2014)%>% - select(var,units,basin,sim, year, season,val_biascorrected, GCM,gcmcmip, scen, CMIP,sim_type,type,val_delta)%>% + select(var,basin,sim, year, season,val_biascorrected, GCM,gcmcmip, scen, CMIP,sim_type,type,val_delta)%>% rename(val=val_delta ) #rename(val=val_biascorrected ) # var_defIN <- var_defIN%>%rename(var=name) @@ -96,19 +100,8 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, } - - # datIN2 <- dat%>%group_by(var,units,sim,basin,type,GCM, scen, CMIP,sim_type,year,season)%>% - # summarize(mnVal = mean(val,na.rm=T))%>%mutate(GCM = factor(GCM, levels =c("hind","gfdl","miroc","cesm"))) - # mn <- dat1%>%filter(year<2001)%>%group_by(var,units,sim,basin,type,GCM, scen, CMIP,sim_type,season)%>% - # summarize(mnVal = mean(val,na.rm=T)) - # mn <- dat%>% - # filter(var%in%varlistIN$name, basin%in%basinIN,year<2001)%>% - # group_by(var,units,sim,basin,type,sim_type,season)%>% - # summarize(mnVal = mean(mn_val,na.rm=T))%>%mutate(scen="hind") - # - mn_all <- dat%>% - group_by(var,units,basin,type,scen, CMIP,sim_type,year,season)%>% + group_by(var,basin,type,scen, CMIP,sim_type,year,season)%>% summarize(mnVal = mean(val,na.rm=T), sdVal = sd(val, na.rm = T), n = length(val))%>% @@ -118,7 +111,7 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, upper2 = mnVal+1.95*seVal, lower2 = mnVal-1.95*seVal) - mn_all_mn <- mn_all%>%group_by(var,units,basin,type,scen, CMIP,sim_type,season)%>% + mn_all_mn <- mn_all%>%group_by(var,basin,type,scen, CMIP,sim_type,season)%>% filter(scen=="hind")%>% summarize(mnVal = mean(mnVal, na.rm = T), upper = mean(upper, na.rm = T), @@ -132,7 +125,7 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, return(out) } mn_allGCM <- dat%>%mutate(sub_sim = mfun(sim))%>% - group_by(var,units,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,year,season,sub_sim)%>% + group_by(var,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,year,season,sub_sim)%>% summarize(mnVal = mean(val,na.rm=T), sdVal = sd(val, na.rm = T), n = length(val))%>% @@ -144,7 +137,7 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, mn_allGCM_mn <- mn_allGCM%>% - group_by(var,units,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,season,sub_sim)%>% + group_by(var,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,season,sub_sim)%>% filter(scen=="hind")%>% mutate(seVal = sdVal/sqrt(n), upper = mnVal+1.95*seVal, @@ -173,11 +166,11 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, # } p1 <-ggplot()+ #geom_line(data=datIN2%>%filter(GCM=="hind"),aes(x=year,y = mnVal,color=scen),size=.8,alpha=.8)+ - ylab(dat$units[1])+ + ylab(varlistIN$units)+ geom_ribbon(data = mn_all%>%filter(scen=="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen),alpha = alphaIN)+ geom_hline(data = mn_all_mn%>%filter(scen=="hind"), aes(yintercept = mnVal, color = scen),linetype="solid",size=.8)+ geom_line(data = mn_all%>%filter(scen=="hind"), aes(x = year,y = mnVal,color = scen),size=1)+ - ylab(dat$units[1])+ + ylab(varlistIN$units)+ facet_grid(season~basin,scales="free_y")+ theme_minimal()+ #ggtitle(varlistIN)+ @@ -189,13 +182,13 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, caption = "ACLIM2 2023") p2 <-ggplot()+ #geom_line(data=datIN2%>%filter(GCM=="hind"),aes(x=year,y = mnVal,color=scen),size=.8,alpha=.8)+ - ylab(dat$units[1])+ + ylab(varlistIN$units)+ geom_hline(data = mn_all_mn, aes(yintercept = mnVal, color = scen),linetype="solid",size=.8)+ geom_ribbon(data = mn_all%>%filter(scen!="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen),alpha = alphaIN)+ geom_line(data = mn_all%>%filter(scen!="hind"), aes(x = year,y = mnVal,color = scen),size=1)+ geom_ribbon(data = mn_all%>%filter(scen=="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen),alpha = alphaIN)+ geom_line(data = mn_all%>%filter(scen=="hind"), aes(x = year,y = mnVal,color = scen),size=1)+ - ylab(dat$units[1])+ + ylab(varlistIN$units)+ facet_grid(season~basin,scales="free_y")+ theme_minimal()+ #ggtitle(varlistIN)+ @@ -205,18 +198,16 @@ plotNEBS_productivity_fut<- function(datIN=ACLIM_weekly_hind, labs(title = paste(varlistIN$name,", Delta corrected"), subtitle = varlistIN$longname, caption = "ACLIM2 2023") + p3 <-ggplot()+ - #geom_line(data=datIN2%>%filter(GCM=="hind"),aes(x=year,y = mnVal,color=scen),size=.8,alpha=.8)+ - ylab(dat$units[1])+ geom_hline(data = mn_allGCM_mn, aes(yintercept = mnVal, color = scen),linetype="solid",size=.8)+ geom_ribbon(data = mn_allGCM%>%filter(scen!="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen,linetype=GCM),alpha = alphaIN)+ geom_ribbon(data = mn_allGCM%>%filter(scen=="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen,linetype=GCM),alpha = alphaIN)+ geom_line(data = mn_allGCM%>%filter(scen!="hind"), aes(x = year,y = mnVal,color = scen,linetype=GCM),size=1)+ geom_line(data = mn_allGCM%>%filter(scen=="hind"), aes(x = year,y = mnVal,color = scen,linetype=GCM),size=1)+ - ylab(dat$units[1])+ + ylab(varlistIN$units)+ facet_grid(season~basin,scales="free_y")+ theme_minimal()+ - #ggtitle(varlistIN)+ theme(axis.text.x = element_text(angle = angleIN))+ scale_fill_viridis_d(end = .2, begin =.7)+ scale_color_viridis_d(end = .2, begin =.7)+ @@ -236,10 +227,10 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, varlistIN$longname dat1 <- datIN%>% filter(var%in%varlistIN$name, basin%in%basinIN, year <2020)%>% - select(var,units,basin,sim, year, season,mn_val, GCM,gcmcmip, scen, CMIP,sim_type,type)%>% + select(var,basin,sim, year, season,mn_val, GCM,gcmcmip, scen, CMIP,sim_type,type)%>% mutate(val_delta = mn_val)%>%rename(val=mn_val) dat2 <- datIN_fut%>%filter(var%in%varlistIN$name, basin%in%basinIN, year >2014)%>% - select(var,units,basin,sim, year, season,val_biascorrected, GCM,gcmcmip, scen, CMIP,sim_type,type,val_delta)%>% + select(var,basin,sim, year, season,val_biascorrected, GCM,gcmcmip, scen, CMIP,sim_type,type,val_delta)%>% rename(val=val_biascorrected ) #rename(val=val_biascorrected ) # var_defIN <- var_defIN%>%rename(var=name) @@ -266,7 +257,7 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, mn_all <- dat%>% - group_by(var,units,basin,type,scen, CMIP,sim_type,year,season)%>% + group_by(var,basin,type,scen, CMIP,sim_type,year,season)%>% summarize(mnVal = mean(val,na.rm=T), sdVal = sd(val, na.rm = T), n = length(val))%>% @@ -276,7 +267,7 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, upper2 = mnVal+1.95*seVal, lower2 = mnVal-1.95*seVal) - mn_all_mn <- mn_all%>%group_by(var,units,basin,type,scen, CMIP,sim_type,season)%>% + mn_all_mn <- mn_all%>%group_by(var,basin,type,scen, CMIP,sim_type,season)%>% filter(scen=="hind")%>% summarize(mnVal = mean(mnVal, na.rm = T), upper = mean(upper, na.rm = T), @@ -290,7 +281,7 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, return(out) } mn_allGCM <- dat%>%mutate(sub_sim = mfun(sim))%>% - group_by(var,units,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,year,season,sub_sim)%>% + group_by(var,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,year,season,sub_sim)%>% summarize(mnVal = mean(val,na.rm=T), sdVal = sd(val, na.rm = T), n = length(val))%>% @@ -302,7 +293,7 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, mn_allGCM_mn <- mn_allGCM%>% - group_by(var,units,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,season,sub_sim)%>% + group_by(var,basin,type,scen,gcmcmip,GCM, CMIP,sim_type,season,sub_sim)%>% filter(scen=="hind")%>% mutate(seVal = sdVal/sqrt(n), upper = mnVal+1.95*seVal, @@ -330,15 +321,12 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, # # } p1 <-ggplot()+ - #geom_line(data=datIN2%>%filter(GCM=="hind"),aes(x=year,y = mnVal,color=scen),size=.8,alpha=.8)+ - ylab(dat$units[1])+ geom_ribbon(data = mn_all%>%filter(scen=="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen),alpha = alphaIN)+ geom_hline(data = mn_all_mn%>%filter(scen=="hind"), aes(yintercept = mnVal, color = scen),linetype="solid",size=.8)+ geom_line(data = mn_all%>%filter(scen=="hind"), aes(x = year,y = mnVal,color = scen),size=1)+ ylab(dat$units[1])+ facet_grid(season~basin,scales="free_y")+ theme_minimal()+ - #ggtitle(varlistIN)+ theme(axis.text.x = element_text(angle = angleIN))+ scale_fill_viridis_d(end = .2, begin =.7)+ scale_color_viridis_d(end = .2, begin =.7)+ @@ -346,8 +334,6 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, subtitle = varlistIN$longname, caption = "ACLIM2 2023") p2 <-ggplot()+ - #geom_line(data=datIN2%>%filter(GCM=="hind"),aes(x=year,y = mnVal,color=scen),size=.8,alpha=.8)+ - ylab(dat$units[1])+ geom_hline(data = mn_all_mn, aes(yintercept = mnVal, color = scen),linetype="solid",size=.8)+ geom_ribbon(data = mn_all%>%filter(scen!="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen),alpha = alphaIN)+ geom_line(data = mn_all%>%filter(scen!="hind"), aes(x = year,y = mnVal,color = scen),size=1)+ @@ -363,9 +349,8 @@ plotNEBS_productivity_futBC<- function(datIN=ACLIM_weekly_hind, labs(title = paste(varlistIN$name,", Bias corrected"), subtitle = varlistIN$longname, caption = "ACLIM2 2023") + p3 <-ggplot()+ - #geom_line(data=datIN2%>%filter(GCM=="hind"),aes(x=year,y = mnVal,color=scen),size=.8,alpha=.8)+ - ylab(dat$units[1])+ geom_hline(data = mn_allGCM_mn, aes(yintercept = mnVal, color = scen),linetype="solid",size=.8)+ geom_ribbon(data = mn_allGCM%>%filter(scen!="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen,linetype=GCM),alpha = alphaIN)+ geom_ribbon(data = mn_allGCM%>%filter(scen=="hind"), aes(x = year, ymin = lower,ymax = upper, fill = scen,linetype=GCM),alpha = alphaIN)+ diff --git a/R/sub_fun/plotTS.R b/R/sub_fun/plotTS.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/plot_MHW.R b/R/sub_fun/plot_MHW.R new file mode 100644 index 0000000..6a0c449 --- /dev/null +++ b/R/sub_fun/plot_MHW.R @@ -0,0 +1,101 @@ +#' +#' Kirstin Holsman +#' ACLIM2 +#' plot_MHW.R +#' + +plot_MHW <- function( datIN, yr_range = c(1968,2026), subtitleIN, + titleIN, + alpha2 = .1, simIN = NULL, + scenIN = NULL,gcmIN = NULL){ + if(is.null(simIN)) + simIN <- unique(datIN$sim) + if(is.null(scenIN)) + scenIN <- unique(datIN$scen) + if(is.null(gcmIN)) + gcmIN <- unique(datIN$GCM) + minyr <- yr_range[1] + maxyr <- yr_range[2] + + subdat <- datIN%>%filter(year>minyr,year%unique() + mhw_cols <- RColorBrewer::brewer.pal(6,"YlOrRd")[2:6] + p <- ggplot(subdat)+ + geom_line(aes(x= mnDate,y = mnval),color="gray",alpha=1,linetype = "dashed")+ + geom_line(aes(x= mnDate,y = Category1),linetype = "dashed",color=mhw_cols[1],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category2),linetype = "dashed",color=mhw_cols[2],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category3),linetype = "dashed",color=mhw_cols[3],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category4),linetype = "dashed",color=mhw_cols[4],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category5),linetype = "dashed",color=mhw_cols[5],alpha=alpha2)+ + theme_minimal()+ + ggtitle(titleIN,subtitle = subtitleIN)+ + geom_line(aes(x= mnDate,y= val_use, color = GCM), alpha=.8)+ + geom_ribbon(data = subdat, aes(ymin = Category1, ymax = plotdat1, x=mnDate, fill = "Category 1"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category2, ymax = plotdat2, x=mnDate, fill = "Category 2"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category3, ymax = plotdat3, x=mnDate, fill = "Category 3"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category4, ymax = plotdat4, x=mnDate, fill = "Category 4"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category5, ymax = plotdat5, x=mnDate, fill = "Category 5"),color=NA)+ + + facet_grid(GCM~scen)+scale_color_viridis_d(begin =0,end =.6)+ + ylab(expression(""*degree*C))+ + scale_fill_manual(values = RColorBrewer::brewer.pal(6,"YlOrRd")[2:6], name="MHW") + p + return(p) +} + + +#' +#' Kirstin Holsman +#' ACLIM2 +#' plot_MHW.R +#' + +plot_anomly <- function( datIN, yr_range = c(1968,2026), subtitleIN, + titleIN, + alpha2 = .1, simIN = NULL, + scenIN = NULL,gcmIN = NULL){ + if(is.null(simIN)) + simIN <- unique(datIN$sim) + if(is.null(scenIN)) + scenIN <- unique(datIN$scen) + if(is.null(gcmIN)) + gcmIN <- unique(datIN$GCM) + minyr <- yr_range[1] + maxyr <- yr_range[2] + + subdat <- datIN%>%filter(year>minyr,year%unique() + mhw_cols <- RColorBrewer::brewer.pal(6,"YlOrRd")[2:6] + cold_cols <- RColorBrewer::brewer.pal(6,"Blues")[2:6] + p <- ggplot(subdat)+ + geom_line(aes(x= mnDate,y = mnval),color="gray",alpha=1,linetype = "dashed")+ + geom_line(aes(x= mnDate,y = Category1),linetype = "dashed",color=mhw_cols[1],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category2),linetype = "dashed",color=mhw_cols[2],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category3),linetype = "dashed",color=mhw_cols[3],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category4),linetype = "dashed",color=mhw_cols[4],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category5),linetype = "dashed",color=mhw_cols[5],alpha=alpha2)+ + + geom_line(aes(x= mnDate,y = Category_neg1),linetype = "dashed",color=cold_cols[1],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category_neg2),linetype = "dashed",color=cold_cols[2],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category_neg3),linetype = "dashed",color=cold_cols[3],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category_neg4),linetype = "dashed",color=cold_cols[4],alpha=alpha2)+ + geom_line(aes(x= mnDate,y = Category_neg5),linetype = "dashed",color=cold_cols[5],alpha=alpha2)+ + theme_minimal()+ + ggtitle(titleIN,subtitle = subtitleIN)+ + geom_line(aes(x= mnDate,y= val_use, color = GCM), alpha=.8)+ + geom_ribbon(data = subdat, aes(ymin = Category1, ymax = plotdat1, x=mnDate, fill = "a) Category 1"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category2, ymax = plotdat2, x=mnDate, fill = "b) Category 2"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category3, ymax = plotdat3, x=mnDate, fill = "c) Category 3"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category4, ymax = plotdat4, x=mnDate, fill = "d) Category 4"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category5, ymax = plotdat5, x=mnDate, fill = "e) Category 5"),color=NA)+ + + geom_ribbon(data = subdat, aes(ymin = Category_neg1, ymax = plotdatNeg1, x=mnDate, fill = "f) Category -1"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category_neg2, ymax = plotdatNeg2, x=mnDate, fill = "g) Category -2"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category_neg3, ymax = plotdatNeg3, x=mnDate, fill = "h) Category -3"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category_neg4, ymax = plotdatNeg4, x=mnDate, fill = "i) Category -4"),color=NA)+ + geom_ribbon(data = subdat, aes(ymin = Category_neg5, ymax = plotdatNeg5, x=mnDate, fill = "j) Category -5"),color=NA)+ + + facet_grid(GCM~scen)+scale_color_viridis_d(begin =0,end =.6)+ + ylab(expression(""*degree*C))+ + scale_fill_manual(values = c(mhw_cols,cold_cols), name="MHW") + p + return(p) +} \ No newline at end of file diff --git a/R/sub_fun/plot_annual.R b/R/sub_fun/plot_annual.R old mode 100644 new mode 100755 index f98c638..9aa8cf9 --- a/R/sub_fun/plot_annual.R +++ b/R/sub_fun/plot_annual.R @@ -7,10 +7,10 @@ #' plot_annual <-function( - datIN = dat_s, - datIN_hind = dat_mn_s_hind, - basinIN ="NEBS", - addloess = T, + datIN = dat_s, + datIN_hind = dat_mn_s_hind, + basinIN ="NEBS", + addloess = T, season_varIN = c('Summer SST' ="Summer_temp_surface5m", 'Summer BT' = "Summer_temp_bottom5m" ), smoothyr = 10, @@ -25,55 +25,59 @@ plot_annual <-function( pal <- colorRampPalette(RColorBrewer::brewer.pal(9,"Spectral")[5:9]) pal <- pal(length(allyears)) pal_sub <- pal[which(allyears%in%subyear)] - gg <- viridis::viridis(7)[2] + gg <- viridis::viridis(7)[2] pal <- RColorBrewer::brewer.pal(9,"Spectral")[c(7,1,8,2,9,3)] palg <- rep(gg,length(pal)) - varIN <- "temp_bottom5m" - varIN <- "pH_bottom5m" - ylab <- unique(dat%>%filter(var%in%varIN)%>%select(units )) - sub_title <- unique(dat%>%filter(var%in%varIN)%>%select(var )) + seasonIN <- c("Fall","Spring", "Summer", "Winter") scen_lab <- data.frame(scen= c("ssp126","ssp585"), lab = factor(c("High mitigation scenario (ssp126)","Low mitigation scenario (ssp585)"), levels = c("High mitigation scenario (ssp126)","Low mitigation scenario (ssp585)"))) var_lab <- melt(season_varIN)%>%rename(season_var=value) - var_lab$varlab <- rownames(var_lab) - var_lab$season_var <- factor(var_lab$season_var,levels = season_varIN) - var_lab$varlab <- factor(var_lab$varlab,levels = var_lab$varlab) + var_lab$varlab <- rownames(var_lab) + var_lab$season_var <- factor(var_lab$season_var,levels = season_varIN) + var_lab$varlab <- factor(var_lab$varlab,levels = var_lab$varlab) - fut <- datIN%>% filter(scen%in%scensIN,basin == basinIN, - season_var%in%season_varIN)%>% - left_join(scen_lab)%>%left_join(var_lab) - hind <- datIN_hind%>% filter(scen%in%scensIN,basin == basinIN, - season_var%in%season_varIN)%>% - left_join(scen_lab)%>%left_join(var_lab) + fut <- datIN%>% + filter(scen%in%scensIN, + basin == basinIN, + season_var%in%season_varIN)%>% + left_join(scen_lab)%>% + left_join(var_lab) + hind <- datIN_hind%>% + filter(scen%in%scensIN, + basin == basinIN, + season_var%in%season_varIN)%>% + left_join(scen_lab)%>%left_join(var_lab) + # + # varIN <- "temp_bottom5m" + # varIN <- "pH_bottom5m" + # ylab <- unique(dat%>%filter(var%in%varIN)%>%select(units )) - # pp<- ggplot()+ - # scale_color_manual(values = palg)+ - # guides(color = "none", size = "none")+ - # new_scale_color()+ + ylab <- unique(hind%>%filter(season_var%in%season_varIN)%>%select(var,units )) + sub_title <- unique(hind%>%filter(season_var%in%season_varIN)%>%select(var )) - # geom_smooth(data=fut,formula = "y~x", - # aes(x=year,y=val_biascorrected, fill = scen) - # ,alpha = .4, method = "loess")+ - # guides(color = "none", size = "none")+ - # new_scale_color()+ if(is.null(loesscol)) loesscol = gg - nyr<-length(unique(fut$year)) - pp <- ggplot()+ + + nyr <-length(unique(fut$year)) + pp <- ggplot()+ geom_line(data=fut, aes(x=year,y=val_biascorrected,color=gcmscen), alpha=alpha_fut,size=futline, show.legend = TRUE) + if(addloess){ pp <- pp +geom_smooth(data=fut, aes(x=year,y=val_biascorrected,fill=scen),color = loesscol, alpha = alpha_loess,size=loess_line, formula = 'y ~ x',span = smoothyr/nyr, method="loess") } + + + pp <- pp+ geom_line(data=hind, aes(x=year,y=mn_val),color=gg, alpha=alpha_annual,size=thinline, show.legend = FALSE)+ @@ -81,23 +85,23 @@ plot_annual <-function( aes(x=year,y=mnVal_hind),color=gg, alpha=alpha_annual,size=thinline, show.legend = FALSE)+ geom_line(data=hind, - aes(x=year,y=mnVal_hind+sdVal_hind),color=gg,linetype="dashed", - alpha=alpha_annual,size=thinline*.9, show.legend = FALSE)+ + aes(x=year,y=mnVal_hind+sdVal_hind),color=gg, + alpha=alpha_annual,size=thinline*.5, show.legend = FALSE)+ geom_line(data=hind, - aes(x=year,y=mnVal_hind-sdVal_hind),color=gg,linetype="dashed", - alpha=alpha_annual,size=thinline*.9, show.legend = FALSE)+ + aes(x=year,y=mnVal_hind-sdVal_hind),color=gg, + alpha=alpha_annual,size=thinline*.5, show.legend = FALSE)+ geom_line(data=fut, aes(x=year,y=mnVal_hind),color=gg, alpha=alpha_annual,size=thinline, show.legend = FALSE)+ geom_line(data=fut, - aes(x=year,y=mnVal_hind+sdVal_hind),color=gg,linetype="dashed", - alpha=alpha_annual,size=thinline*.9, show.legend = FALSE)+ + aes(x=year,y=mnVal_hind+sdVal_hind),color=gg, + alpha=alpha_annual,size=thinline*.5, show.legend = FALSE)+ geom_line(data=fut, - aes(x=year,y=mnVal_hind-sdVal_hind),color=gg,linetype="dashed", - alpha=alpha_annual,size=thinline*.9, show.legend = FALSE)+ + aes(x=year,y=mnVal_hind-sdVal_hind),color=gg, + alpha=alpha_annual,size=thinline*.5, show.legend = FALSE)+ scale_color_manual(values = pal)+ scale_fill_manual(values = pal[c(5,4)])+ - ylab(ylab)+ + ylab("")+ xlab("Year")+ facet_grid(varlab~lab,scales="free_y")+ labs(title = paste(basinIN, "Climate projections"), diff --git a/R/sub_fun/plot_biascorrection.R b/R/sub_fun/plot_biascorrection.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/plot_stations_basemap.R b/R/sub_fun/plot_stations_basemap.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/plot_weekly.R b/R/sub_fun/plot_weekly.R old mode 100644 new mode 100755 index 4ac559d..5708665 --- a/R/sub_fun/plot_weekly.R +++ b/R/sub_fun/plot_weekly.R @@ -20,9 +20,11 @@ plot_weekly <- function( datIN = dat, datIN_sub = dat_sub, datIN_mn_hind_sub = dat_mn_hind_sub, varIN, + subyear = seq(1970,2090,10), useBiascorrected=FALSE, basinIN = "SEBS", titleIN = ""){ + pal <- colorRampPalette(RColorBrewer::brewer.pal(9,"Spectral")[5:9]) pal <- pal(length(allyears)) pal[allyears<2005] <- RColorBrewer::brewer.pal(9,"Greys")[3] @@ -36,8 +38,49 @@ plot_weekly <- function( datIN = dat, scen_lab <- data.frame(scen= c("ssp126","ssp585"), lab = factor(c("High mitigation scenario (ssp126)","Low mitigation scenario (ssp585)"), levels = c("High mitigation scenario (ssp126)","Low mitigation scenario (ssp585)"))) + + grplist <- c("var","sim","basin","type","sim_type","jday", + # "lognorm", "total_area_km2", + "gcmcmip","CMIP","GCM","scen", "mod") + #, "units","longname","lab" ) + length.na <- function(x,na.rm=F){ + if(na.rm){ + x <- as.numeric(na.omit(x)) + } + length(x) + } + se <- function(x, na.rm=T){ + if(na.rm){ + x <- as.numeric(na.omit(x)) + } + if(length(x)>0){ + sd(x)/sqrt(length(x)) + }else{ + 0 + } + + } + # mndat<- + # dhind%>%group_by(!!!syms(grplist))%>% + # summarize(mn= mean(mn_val,na.rm = T), + # sd= sd(mn_val,na.rm = T), + # se= se(mn_val,na.rm = T), + # n= length.na(mn_val,na.rm = T), + # mn= mean(mn_val,na.rm = T), + # mn_hind= mean(mnVal_hind,na.rm = T)) + # + dhind <- dat_hindIN%>% filter(var==varIN,basin==basinIN,scen%in%scensIN)%>%left_join(scen_lab) + # mndat<- + # dhind%>%group_by(!!!syms(grplist))%>% + # summarize(mnVal_hind2 = mean(mn_val,na.rm = T), + # mn_hind= mean(mnVal_hind,na.rm = T), + # sdVal_hind = sd(mn_val,na.rm = T), + # seVal_hind = se(mn_val,na.rm = T), + # n = length.na(mn_val,na.rm = T)) + # dhind <- dhind%>%left_join(mndat) + dfut <- datIN%>% filter(var%in%varIN,basin==basinIN,scen%in%scensIN)%>%left_join(scen_lab) dfut_sub <- datIN_sub%>% @@ -49,7 +92,7 @@ plot_weekly <- function( datIN = dat, geom_line(data=dhind, aes(x=jday,y=mn_val, color=yrFactor), alpha=alpha_annual,size=thinline, show.legend = FALSE) - + if(useBiascorrected){ pp <- pp + geom_line(data=dfut, aes(x=jday,y=val_biascorrected,color=yrFactor), @@ -58,18 +101,18 @@ plot_weekly <- function( datIN = dat, aes(x=jday,y=val_biascorrected,color=yrFactor ), alpha=.8,size=1.2, show.legend = TRUE)+ scale_color_manual(values = pal)+ - guides(color = "none", size = "none")+ + # guides(color = "none", size = "none")+ new_scale_color()+ geom_line(data=dhind_sub%>%filter(year == 2010), - aes(x=jday,y=mnVal_hind,color=yrFactor ), + aes(x=jday,y=mn_hind,color=yrFactor ), #color=RColorBrewer::brewer.pal(9,"Spectral")[1], alpha=.8,size=1.2, show.legend = FALSE)+ geom_line(data=dhind_sub%>%filter(year == 2010), - aes(x=jday,y=mnVal_hind +sdVal_hind,color=yrFactor ),linetype = "dashed", + aes(x=jday,y=mn_hind +sd_val,color=yrFactor ),linetype = "dashed", #color=RColorBrewer::brewer.pal(9,"Spectral")[1], alpha=.8,size=.9, show.legend = FALSE)+ geom_line(data=dhind_sub%>%filter(year == 2010), - aes(x=jday,y=mnVal_hind-sdVal_hind,color=yrFactor ),linetype = "dashed", + aes(x=jday,y=mn_hind-sd_val,color=yrFactor ),linetype = "dashed", #color=RColorBrewer::brewer.pal(9,"Spectral")[1], alpha=.8,size=.9, show.legend = FALSE) sub_title = "bias-corrected" @@ -90,18 +133,18 @@ plot_weekly <- function( datIN = dat, aes(x=jday,y=mn_val,color=yrFactor ), alpha=.8,size=1.2, show.legend = TRUE)+ scale_color_manual(values = pal)+ - guides(color = "none", size = "none")+ + # guides(color = "none", size = "none")+ new_scale_color()+ - geom_line(data=dfut2, - aes(x=jday,y=mnVal_hist,color=yrFactor ), + geom_line(data=dhind_sub, + aes(x=jday,y=mn_hist,color=yrFactor ), #color=RColorBrewer::brewer.pal(9,"Spectral")[1], alpha=.8,size=1.2, show.legend = FALSE)+ - geom_line(data=dfut2, - aes(x=jday,y=mnVal_hist +sdVal_hist,color=yrFactor ),linetype = "dashed", + geom_line(data=dhind_sub, + aes(x=jday,y=mn_hist +sd_val_hist,color=yrFactor ),linetype = "dashed", #color=RColorBrewer::brewer.pal(9,"Spectral")[1], alpha=.8,size=.9, show.legend = FALSE)+ - geom_line(data=dfut2, - aes(x=jday,y=mnVal_hist-sdVal_hist,color=yrFactor ),linetype = "dashed", + geom_line(data=dhind_sub, + aes(x=jday,y=mn_hist-sd_val_hist,color=yrFactor ),linetype = "dashed", #color=RColorBrewer::brewer.pal(9,"Spectral")[1], alpha=.8,size=.9, show.legend = FALSE) } @@ -113,7 +156,7 @@ plot_weekly <- function( datIN = dat, labs(title = titleIN, subtitle = sub_title, caption = strwrap (" Operational hindcasts: AK IEA | Projections: ACLIM2 | Model: Bering10K 30-layer",width = 150))+ - theme_kir_EBM()+theme_minimal() + theme(legend.position="bottom") #+xlim(0,364) + theme_kir_EBM()+theme_minimal() + theme(legend.position="none") #+xlim(0,364) return(pp) } diff --git a/R/sub_fun/rmd2md.R b/R/sub_fun/rmd2md.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/save_indices.R b/R/sub_fun/save_indices.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/save_png.R b/R/sub_fun/save_png.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/scan_l2.R b/R/sub_fun/scan_l2.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/stitchTS.R b/R/sub_fun/stitchTS.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/sub_get_hind.R b/R/sub_fun/sub_get_hind.R old mode 100644 new mode 100755 index 62b98bf..3c1e6a6 --- a/R/sub_fun/sub_get_hind.R +++ b/R/sub_fun/sub_get_hind.R @@ -76,9 +76,10 @@ cat(" -- Get indices \n") sdVal_hind_yr = sdVal_x_yr)%>% ungroup() - rmlistIN <- c("sdVal_hind", "seVal_hind", - "sdVal_hind_strata", "sdVal_hind_yr", - "nVal_hind") + # rmlistIN <- c("sdVal_hind", "seVal_hind", + # "sdVal_hind_strata", "sdVal_hind_yr", + # "nVal_hind") + # rmlistIN <- c("sdVal_hind_strata", "sdVal_hind_yr") hind <- hindA$fullDat%>%rename( mnVal_hind = mnVal_x, @@ -86,7 +87,8 @@ cat(" -- Get indices \n") nVal_hind = nVal_x, seVal_hind = seVal_x, sdVal_hind_strata = sdVal_x_strata, - sdVal_hind_yr = sdVal_x_yr)%>%select(-all_of(rmlistIN))%>% + sdVal_hind_yr = sdVal_x_yr)%>% + #select(-all_of(rmlistIN))%>% ungroup() # if(!dir.exists(file.path("Data/out",CMIP_fdlr))) @@ -124,8 +126,10 @@ cat(" -- Get indices \n") sdVal_hind_mo = sdVal_x_mo, sdVal_hind_yr = sdVal_x_yr)%>% ungroup() - rmlistIN <- c("sdVal_hind", "seVal_hind", "sdVal_hind_mo", "sdVal_hind_yr", - "nVal_hind") + #rmlistIN <- c("sdVal_hind", "seVal_hind", "sdVal_hind_mo", "sdVal_hind_yr", + # "nVal_hind") + + #rmlistIN <- c("sdVal_hind_mo", "sdVal_hind_yr") hind <- hindA$fullDat%>%rename( mnVal_hind = mnVal_x, sdVal_hind = sdVal_x, @@ -133,7 +137,7 @@ cat(" -- Get indices \n") seVal_hind = seVal_x, sdVal_hind_mo = sdVal_x_mo, sdVal_hind_yr = sdVal_x_yr)%>% - select(-all_of(rmlistIN))%>% + #select(-all_of(rmlistIN))%>% ungroup() rm(list=c("hnd","hindA")) diff --git a/R/sub_fun/sub_get_hist.R b/R/sub_fun/sub_get_hist.R old mode 100644 new mode 100755 index 8dc2c38..4713cd6 --- a/R/sub_fun/sub_get_hist.R +++ b/R/sub_fun/sub_get_hist.R @@ -91,8 +91,10 @@ sub_get_hist<-function( CMIP = CMIP, gcmsim = gcmsim)%>% ungroup() - rmlistIN <- c("sdVal_hist", "seVal_hist", "sdVal_hist_strata", "sdVal_hist_yr", - "nVal_hist") + # rmlistIN <- c("sdVal_hist", "seVal_hist", "sdVal_hist_strata", "sdVal_hist_yr", + # "nVal_hist") + # rmlistIN <- c( "sdVal_hist_strata", "sdVal_hist_yr") + tmphist <- histA$fullDat%>%rename( mnVal_hist = mnVal_x, sdVal_hist = sdVal_x, @@ -100,7 +102,7 @@ sub_get_hist<-function( seVal_hist = seVal_x, sdVal_hist_strata = sdVal_x_strata, sdVal_hist_yr = sdVal_x_yr)%>% - select(-all_of(rmlistIN))%>% + # select(-all_of(rmlistIN))%>% mutate( GCM = GCM, RCP2 = RCP, @@ -152,8 +154,9 @@ sub_get_hist<-function( CMIP = CMIP, gcmsim = gcmsim)%>% ungroup() - rmlistIN = c("sdVal_hist", "seVal_hist", "sdVal_hist_mo", "sdVal_hist_yr", - "nVal_hist") + # rmlistIN = c("sdVal_hist", "seVal_hist", "sdVal_hist_mo", "sdVal_hist_yr", + # "nVal_hist") + # rmlistIN = c("sdVal_hist_mo", "sdVal_hist_yr") tmphist <- histA$fullDat%>%rename( mnVal_hist = mnVal_x, sdVal_hist = sdVal_x, @@ -161,7 +164,7 @@ sub_get_hist<-function( seVal_hist = seVal_x, sdVal_hist_mo = sdVal_x_mo, sdVal_hist_yr = sdVal_x_yr)%>% - select(-all_of(rmlistIN))%>% + #select(-all_of(rmlistIN))%>% mutate( GCM = GCM, RCP = RCP, @@ -247,8 +250,7 @@ sub_get_hist<-function( CMIP = CMIP, gcmsim = gcmsim)%>% ungroup() - rmlistIN = c("sdVal_hist", "seVal_hist", "sdVal_hist_strata", "sdVal_hist_yr", - "nVal_hist") + #rmlistIN = c("sdVal_hist_strata", "sdVal_hist_yr") tmphist <- histA$fullDat%>%rename( mnVal_hist = mnVal_x, sdVal_hist = sdVal_x, @@ -256,7 +258,7 @@ sub_get_hist<-function( seVal_hist = seVal_x, sdVal_hist_strata = sdVal_x_strata, sdVal_hist_yr = sdVal_x_yr)%>% - select(-all_of(rmlistIN))%>% + # select(-all_of(rmlistIN))%>% mutate( GCM = GCM, RCP = RCP, @@ -309,8 +311,7 @@ sub_get_hist<-function( CMIP = CMIP, gcmsim = gcmsim)%>% ungroup() - rmlistIN = c("sdVal_hist", "seVal_hist", "sdVal_hist_mo", "sdVal_hist_yr", - "nVal_hist") + # rmlistIN = c( "sdVal_hist_mo", "sdVal_hist_yr") tmphist <- histA$fullDat%>%rename( mnVal_hist = mnVal_x, sdVal_hist = sdVal_x, @@ -318,7 +319,7 @@ sub_get_hist<-function( seVal_hist = seVal_x, sdVal_hist_mo = sdVal_x_mo, sdVal_hist_yr = sdVal_x_yr)%>% - select(-all_of(rmlistIN))%>% + #select(-all_of(rmlistIN))%>% mutate( GCM = GCM, RCP = RCP, diff --git a/R/sub_fun/sub_get_proj.R b/R/sub_fun/sub_get_proj.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/unlink_val.R b/R/sub_fun/unlink_val.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xbias_correct.R b/R/sub_fun/xbias_correct.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xbias_correct_new.R b/R/sub_fun/xbias_correct_new.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xmakeACLIM2_BC_Indices.R b/R/sub_fun/xmakeACLIM2_BC_Indices.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xmakeACLIM2_BC_Indices_new.R b/R/sub_fun/xmakeACLIM2_BC_Indices_new.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xmakeACLIM2_indices.R b/R/sub_fun/xmakeACLIM2_indices.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xmakeACLIM2_indices_old.R b/R/sub_fun/xmakeACLIM2_indices_old.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xmake_indices_region_new.R b/R/sub_fun/xmake_indices_region_new.R old mode 100644 new mode 100755 diff --git a/R/sub_fun/xmake_indices_srvyrep_new.R b/R/sub_fun/xmake_indices_srvyrep_new.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/.DS_Store b/R/sub_scripts/.DS_Store old mode 100644 new mode 100755 index 5008ddf..67ed6c7 Binary files a/R/sub_scripts/.DS_Store and b/R/sub_scripts/.DS_Store differ diff --git a/R/sub_scripts/.Rapp.history b/R/sub_scripts/.Rapp.history old mode 100644 new mode 100755 diff --git a/R/sub_scripts/APPENDIX_A.R b/R/sub_scripts/APPENDIX_A.R old mode 100644 new mode 100755 index e7a112c..3c8fde2 --- a/R/sub_scripts/APPENDIX_A.R +++ b/R/sub_scripts/APPENDIX_A.R @@ -10,6 +10,8 @@ # rm(list=ls()) # setwd("D:/GitHub_cloud/ACLIM2") # setwd("/Volumes/LaCie/GitHub_cloud/ACLIM2") +# setwd("/Users/KKH/Documents/GitHub_mac/ACLIM2") +# suppressMessages(source("R/make.R")) # loads packages, data, setup, etc. tmstp <- "2022_10_17" @@ -17,6 +19,8 @@ update_biascorrection <- FALSE suppressMessages(source("R/make.R")) tmstp <- "2022_10_17" Rdata_path <- paste0("../../romsnpz/",tmstp,"_Rdata") +Rdata_path <- paste0("../../Data/romsnpz/",tmstp,"_Rdata") + main <- getwd() #"~/GitHub_new/ACLIM2" tmstamp1 <- format(Sys.time(), "%Y%m%d") @@ -223,8 +227,10 @@ write.csv(normlist,file = file.path("Data/out/","normlist.csv")) sim_listIN = sim_list[-grep("historical",sim_list)], gcinfoIN = FALSE)) - - #make ACLIM level 4 indices (annual, mont + # ------------------------------------------- + # make ACLIM level 4 indices (annual, monthly, weekly, etc) + # ------------------------------------------- + gc() suppressMessages(makeACLIM2_L4_Indices_strata( CMIP_fdlr = "Data/out/K20P19_CMIP6", diff --git a/R/sub_scripts/Extract_Env_Data_KKH_Andre.R b/R/sub_scripts/Extract_Env_Data_KKH_Andre.R new file mode 100644 index 0000000..af73e2d --- /dev/null +++ b/R/sub_scripts/Extract_Env_Data_KKH_Andre.R @@ -0,0 +1,37 @@ + + + +# Extract Env Data v KKH +# rm(list=ls()) +library(dplyr) +outfldr <- "Data/out/RKC_indices" + +load(file.path(outfldr,"hind_RKC_immature_males_monthly_avg.Rdata")) +load(file.path(outfldr,"fut_RKC_immature_males_monthly_avg.Rdata")) + +mo_nm <- c("YEAR","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC") + +sims <- unique(fut_RKC_immature_males_monthly_avg$sim) +vars <- unique(hind_RKC_immature_males_monthly_avg$var) + + +if(!dir.exists(file.path(outfldr,"wide"))) dir.create(file.path(outfldr,"wide")) + +for(i in 1:length(vars)){ + hind <- hind_RKC_immature_males_monthly_avg%>%filter(var==vars[i])%>%mutate(mo = mo_nm[mo])%>% + pivot_wider(id_cols = c(year), values_from = val_use,names_from = mo ) + save(hind, file = file.path(outfldr,paste0("wide/hind_",vars[i],"_monthly_avg.Rdata"))) + write.csv(hind, file = file.path(outfldr,paste0("wide/hind_",vars[i],"_monthly_avg.csv"))) +} + + +for(s in 1:length(sims)){ + for(i in 1:length(vars)){ + fut <- fut_RKC_immature_males_monthly_avg%>%filter(sim==sims[s],var==vars[i])%>%mutate(mo=as.numeric(mo),mo = mo_nm[mo])%>% + pivot_wider(id_cols = c(year), values_from = val_use,names_from = mo ) + + save(fut, file = file.path(outfldr,paste0("wide/fut_",vars[i],"_",sims[s],"_monthly_avg.Rdata"))) + write.csv(fut, file = file.path(outfldr,paste0("wide/fut_",vars[i],"_",sims[s],"_monthly_avg.csv"))) + + } +} diff --git a/R/sub_scripts/Get_hind.R b/R/sub_scripts/Get_hind.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/Get_hist.R b/R/sub_scripts/Get_hist.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/Get_proj.R b/R/sub_scripts/Get_proj.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/Kerims_packages.R b/R/sub_scripts/Kerims_packages.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/bc_mo_season_yr.R b/R/sub_scripts/bc_mo_season_yr.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/bc_mo_season_yrold.R b/R/sub_scripts/bc_mo_season_yrold.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/bias_correct_example.r b/R/sub_scripts/bias_correct_example.r old mode 100644 new mode 100755 diff --git a/R/sub_scripts/get_MHW_index.R b/R/sub_scripts/get_MHW_index.R new file mode 100755 index 0000000..0550ca8 --- /dev/null +++ b/R/sub_scripts/get_MHW_index.R @@ -0,0 +1,275 @@ +#' +#' +#' +#' +#'get_MHW.R +#'K.Holsman +#'ACLIM NOAA Fisheries +#' +#'generate frequency of MHW for future scenarios: +#' 2024 +#' + +# load setup +suppressMessages(source("R/make.R")) +# vars to select from for weekly data: +weekly_vars + +# Annual Indices +#df <- get_var(typeIN = "weekly",plotvar = "temp_bottom5m",plothist = F) +#df$plot +#head(df$dat) +stitchDate <- "2020-12-30" + +# Get high res weekly indices +df <- get_var(typeIN = "annual",plotvar = "temp_bottom5m",plothist = F) +df$plot +head(df$dat) + + +if(!dir.exists( file.path("Data/NotShared/MHW"))) + dir.create( file.path("Data/NotShared/MHW")) + + +# Get data: + +for(varIN in c("temp_surface5m","temp_bottom5m","EupS_integrated")){ + figpath <- file.path("Data/NotShared/MHW",varIN) + if(!dir.exists( figpath)) + dir.create( figpath) + for(basinIN in c("SEBS","NEBS")){ + df <- get_var(typeIN = "weekly",plotvar = varIN,plothist = F,plotbasin = basinIN,bcIN = c("bias corrected")) + MHW <- get_MHW(datIN= df$dat) + save(MHW, file = paste0("Data/NotShared/MHW/", "MHW_",varIN,"_",basinIN,".Rdata")) + rm(df) + } +} + +# create plots and summaries + +i <- 0 +for(varIN in c("temp_surface5m","temp_bottom5m","EupS_integrated")){ + figpath <- file.path("Data/NotShared/MHW",varIN) + if(!dir.exists( figpath)) + dir.create( figpath) + tmax <- 10 + if(varIN=="temp_surface5m") tmax <- 16 + if(varIN=="EupS_integrated") tmax <- 30 + for(basinIN in c("SEBS","NEBS")){ + i <- i + 1 + + load(file = paste0("Data/NotShared/MHW/", "MHW_",varIN,"_",basinIN,".Rdata")) + gcmlist <- unique(MHW$MHW$GCM) + dat_ld_tmp <- melt(MHW$MHW_decade%>%select(decade, sim, scen,GCM, basin,var, + Category1, Category2, Category3, Category4, Category5, + CategoryNeg1, CategoryNeg2, CategoryNeg3, CategoryNeg4, CategoryNeg5), + id.vars =c("decade", "sim","scen","GCM","basin","var"), + variable_name = "MHWCategory") + + dat_lq_tmp <- melt(MHW$MHW_quarter%>%select(quarter, sim, scen,GCM, basin,var, + Category1, Category2, Category3, Category4, Category5, + CategoryNeg1, CategoryNeg2, CategoryNeg3, CategoryNeg4, CategoryNeg5), + id.vars =c("quarter", "sim","scen","GCM","basin","var"), + variable_name = "MHWCategory") + + mn_d_tmp <- MHW$MHW%>% + group_by(season,decade, basin, var, sim, scen, GCM)%>% + summarise(mnval = mean(val_use,na.rm=T), + sdval = sd(val_use,na.rm=T))%>% + left_join(MHW$MHW%>% + group_by(decade, basin, var, sim, scen, GCM)%>% + summarise(mnval_yr = mean(val_use,na.rm=T), + sdval_yr = sd(val_use,na.rm=T)))%>%data.frame() + mn_q_tmp <- MHW$MHW%>% + group_by(season,quarter, basin, var, sim, scen, GCM)%>% + summarise(mnval = mean(val_use,na.rm=T), + sdval = sd(val_use,na.rm=T))%>% + left_join(MHW$MHW%>% + group_by(quarter, basin, var, sim, scen, GCM)%>% + summarise(mnval_yr = mean(val_use,na.rm=T), + sdval_yr = sd(val_use,na.rm=T)))%>%data.frame() + + + + if(i==1){ + dat_ld <- dat_ld_tmp + dat_lq <- dat_lq_tmp + mn_d <- mn_d_tmp + mn_q <- mn_q_tmp + }else{ + dat_ld <- rbind(dat_ld,dat_ld_tmp) + dat_lq <- rbind(dat_lq,dat_lq_tmp) + mn_d <- rbind(mn_d,mn_d_tmp) + mn_q <- rbind(mn_q,mn_q_tmp) + } + + P_hind <- plot_MHW (datIN = MHW$MHW%>%mutate(scen="Hindcast"), + yr_range = c(2010,2026), + subtitleIN = MHW$MHW$var[1], + titleIN = MHW$MHW$basin[1], + alpha2 = 0, simIN = "ACLIMregion_B10K-K20P19_CORECFS", + scenIN = "Hindcast",gcmIN = "hind")+ + coord_cartesian(ylim=c(-2,tmax)) + + fn <- file.path(figpath,paste0("p_hind_",basinIN,".jpg")) + sclr <- 1.5 + jpeg(filename = fn, width = 5*sclr,height =3*sclr, units = "in", res = 350) + print(P_hind) + dev.off() + rm(P_hind) + + P_hind2 <- plot_anomly (datIN = MHW$MHW%>%mutate(scen="Hindcast"), + yr_range = c(1970,2026), + subtitleIN = MHW$MHW$var[1], + titleIN = MHW$MHW$basin[1], + alpha2 = 0, simIN = "ACLIMregion_B10K-K20P19_CORECFS", + scenIN = "Hindcast",gcmIN = "hind")+ + coord_cartesian(ylim=c(-2,tmax)) + + fn <- file.path(figpath,paste0("p_hind_",basinIN,"long.jpg")) + sclr <- 1.5 + jpeg(filename = fn, width = 8*sclr,height =2*sclr, units = "in", res = 350) + print(P_hind2) + dev.off() + rm(P_hind2) + + rm(list=c("dat_lq_mn","dat_ld_mn","df","mn_d_tmp","mn_q_tmp")) + tt <-plot_anomly (datIN = MHW$MHW, + yr_range = c(2050,2060), + subtitleIN = MHW$MHW$var[1], + titleIN = MHW$MHW$basin[1], + alpha2 = 0, + simIN = NULL,gcmIN = NULL) + #+coord_cartesian(ylim=c(-2,tmax)) + fn <- file.path(figpath,paste0("p_fut_",basinIN,"_all.jpg")) + sclr <- 1.5 + jpeg(filename = fn, width = 6*sclr,height =4*sclr, units = "in", res = 350) + print(tt) + dev.off() + rm(tt) + + for(ssp in c("ssp126","ssp585")){ + p_fut <- plot_anomly (datIN = MHW$MHW%>%filter(scen==ssp), + yr_range = c(2050,2060), + subtitleIN = MHW$MHW$var[1], + titleIN = MHW$MHW$basin[1], + alpha2 = 0, + simIN = NULL, + scenIN = ssp,gcmIN = NULL)+ + coord_cartesian(ylim=c(-2,tmax)) + + fn <- file.path(figpath,paste0("p_fut_",basinIN,"_",ssp,".jpg")) + jpeg(filename = fn, width = 6,height =4, units = "in", res = 350) + print(p_fut) + dev.off() + rm(p_fut) + } + rm(MHW) + + } +} + + save(mn_d, file = paste0("Data/NotShared/MHW/", "Temp_summary_10yr.Rdata")) + save(mn_q, file = paste0("Data/NotShared/MHW/", "Temp_summary_25yr.Rdata")) + save(dat_lq, file = paste0("Data/NotShared/MHW/", "MHW_summary_25yr.Rdata")) + save(dat_ld, file = paste0("Data/NotShared/MHW/", "MHW_summary_10yr.Rdata")) + + dat_lq_mn <- dat_lq%>%rowwise()%>%mutate(type = ifelse(GCM !="hind",scen,"hind"))%>% + group_by(quarter,type, MHWCategory, basin, var)%>% + summarize(mn = mean(value,na.rm=T), + sd = sd(value,na.rm=T) )%>%data.frame() + + dat_ld_mn <- dat_ld%>%rowwise()%>%mutate(type = ifelse(GCM !="hind",scen,"hind"))%>% + group_by(decade,type, MHWCategory, basin, var)%>% + summarize(mn = mean(value,na.rm=T), + sd = sd(value,na.rm=T) )%>%data.frame() + + for(varIN in c("temp_surface5m","temp_bottom5m", "EupS_integrated")){ + tmax <- 10 + if(varIN=="temp_surface5m") tmax <- 16 + for(basinIN in c("SEBS","NEBS")){ + p_mn_d <- ggplot(dat_ld_mn%>%filter(var==varIN,basin==basinIN))+ + ylab("% time")+xlab("")+ + geom_bar(aes(x= factor(decade), y= mn*100, fill=MHWCategory), color=NA,stat = "identity", position = position_stack(reverse = TRUE))+ + scale_fill_manual(values = c(RColorBrewer::brewer.pal(6,"YlOrRd")[2:6],RColorBrewer::brewer.pal(6,"Blues")[2:6]))+ + facet_grid(~type)+theme_minimal()+ + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+ + coord_cartesian(ylim=c(0,100))+ theme(panel.spacing = unit(2, "lines")) + + GCMIN <- "cesm" + plotdT <- mn_d%>%filter(var==varIN,basin==basinIN,GCM!="hind") + plotdT <- plotdT%>%left_join(plotdT%>%filter(decade<2015)%>%group_by(GCM, scen,season)%>%summarize(baseline = mean(mnval,na.rm=T)))%>% + rowwise()%>%mutate(mn_val_delta = mnval-baseline)%>%group_by(decade,var,basin,scen,season)%>% + summarize(mn_val_delta = mean(mn_val_delta,na.rm=T), sd_val_delta = sd(mn_val_delta, na.rm=T))%>%data.frame() + + p_mnT_d <- ggplot(plotdT)+ + ylab(expression("Change"))+xlab("")+ + geom_bar(aes(x= factor(decade), y= mn_val_delta, fill=mn_val_delta), color=NA,stat = "identity", position = position_stack(reverse = F))+ + scale_fill_distiller(palette = "Spectral", direction = -1) + + facet_grid(season~scen)+theme_minimal()+ + ggtitle(paste(basinIN,", ",GCMIN),subtitle = varIN)+ + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+theme(panel.spacing = unit(2, "lines")) + + + qrts <- dat_lq_mn%>%filter(type!="hind")%>%select(quarter)%>%unique()%>%unlist() + plotdat <- dat_lq_mn%>%filter(var==varIN,basin==basinIN) + plotdat2 <- plotdat%>% + left_join( plotdat%>%filter(quarter==as.numeric(qrts[1]))%>%select(-var,-sd,-quarter)%>%rename(mn_ref = mn) )%>% + group_by(quarter, basin, type, var, MHWCategory)%>%summarize(mn_tot = sum(mn), mn_tot_ref = sum(mn_ref))%>% + mutate(delta_mn = round(mn_tot/mn_tot_ref))%>%rowwise()%>%mutate(delta_mn_txt = ifelse(delta_mn<=1,"",paste0("x ",delta_mn)))%>%data.frame() + plotdat3 <- plotdat%>% + left_join( plotdat%>%filter(quarter==as.numeric(qrts[1]))%>%select(-var,-sd,-quarter)%>%rename(mn_ref = mn) )%>% + group_by(quarter, basin, type, var)%>%summarize(mn_tot2 = sum(mn), mn_tot_ref2 = sum(mn_ref))%>% + mutate(delta_mn2 = round(mn_tot2/mn_tot_ref2,1))%>%rowwise()%>%mutate(delta_mn_txt2 = ifelse(delta_mn2<=1,"",paste0("x ",delta_mn2)))%>%data.frame() + + + + p_mn_q <- ggplot( plotdat%>%left_join(plotdat2)%>%filter(type!="hind"))+ + geom_bar(aes(x= factor(quarter), y= mn*100, fill=MHWCategory), color=NA,stat = "identity", width = 0.9, + position = position_stack(reverse = TRUE))+ + geom_text(data=plotdat3%>%filter(type!="hind"),aes(x= factor(quarter), y= mn_tot2*100, + label =delta_mn_txt2),size = 4,position = position_stack(vjust = 1.05))+ + # geom_text(aes(x= factor(quarter), y= mn*100, label =delta_mn_txt),size = 3, position = position_stack(reverse = TRUE,vjust = 0.5))+ #position = position_stack(vjust = 0.5))+ #position = position_stacknudge(y = -60) + ggtitle(basinIN,subtitle = varIN)+ + ylab("% time")+xlab("")+ + scale_fill_manual(values = c(RColorBrewer::brewer.pal(6,"YlOrRd")[2:6],RColorBrewer::brewer.pal(6,"Blues")[2:6]))+ + facet_grid(~type)+theme_minimal()+ theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+ + coord_cartesian(ylim=c(0,105))+ theme(panel.spacing = unit(2, "lines")) + + p_mn_q2 <- ggplot( plotdat%>%left_join(plotdat2))+ + geom_bar(aes(x= factor(quarter), y= mn*100, fill=MHWCategory), color=NA,stat = "identity", width = 0.9, + position = position_stack(reverse = TRUE))+ + ggtitle(basinIN,subtitle = varIN)+ + ylab("% time")+xlab("")+ + scale_fill_manual(values = c(RColorBrewer::brewer.pal(6,"YlOrRd")[2:6],RColorBrewer::brewer.pal(6,"Blues")[2:6]))+ + facet_grid(~type)+theme_minimal()+ theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+ + coord_cartesian(ylim=c(0,100))+ theme(panel.spacing = unit(2, "lines")) + + + fn <- file.path("Data/NotShared/MHW",paste0("p_mn_25yr_abrv_",varIN,"_",basinIN,".jpg")) + sclr <- 1.5 + jpeg(filename = fn, width = 5*sclr,height =3*sclr, units = "in", res = 350) + print(p_mn_q) + dev.off() + + + fn <- file.path("Data/NotShared/MHW",paste0("p_mn_25yr_",varIN,"_",basinIN,".jpg")) + sclr <- 1.5 + jpeg(filename = fn, width = 5*sclr,height =3*sclr, units = "in", res = 350) + print(p_mn_q2) + dev.off() + + fn <- file.path("Data/NotShared/MHW",paste0("p_mn_10yr_",varIN,"_",basinIN,".jpg")) + jpeg(filename = fn, width = 5*sclr,height =3*sclr, units = "in", res = 350) + print(p_mn_d) + dev.off() + + } + } + + +# Now make mean temperature plots: + + + + diff --git a/R/sub_scripts/get_OpHindcast.R b/R/sub_scripts/get_OpHindcast.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/get_map_layers.R b/R/sub_scripts/get_map_layers.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/get_salmon_indices.R b/R/sub_scripts/get_salmon_indices.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/get_summary_tables.R b/R/sub_scripts/get_summary_tables.R new file mode 100644 index 0000000..177ded5 --- /dev/null +++ b/R/sub_scripts/get_summary_tables.R @@ -0,0 +1,298 @@ +#' +#' +#'get_summary_stats +#' +#' + + +suppressWarnings(source("R/make.R")) +thisYr <- as.numeric(format(Sys.time(), "%Y")) +today <- format(Sys.time(), "%b %d, %Y") + +# Create lookup table: +# ------------------------ + +cmip6_lkup <- data.frame(rbind( + c( "MIROC-ES2L", " r1i1p1f2","miroc"), + c("GFDL-ESM4", " r1i1p1f1","gfdl"), + c("CESM2", " r2i1p1f1","cesm")),stringsAsFactors = FALSE) +colnames(cmip6_lkup)<-c("model", "ensemble","GCM") + + +cmip5_lkup <- data.frame(rbind( + c( "MIROC5", " r1i1p1","miroc"), + c("GFDL-ESM2M", " r1i1p1","gfdl"), + c("CESM1-BGC", " r1i1p1","cesm")),stringsAsFactors = FALSE) +colnames(cmip5_lkup)<-c("model", "ensemble","GCM") + + + +# Now get CMIP6 warming levels from Mathis repo +# ------------------------ +# https://github.com/mathause/cmip_warming_levels + +GWL_cmip6 <- read.csv("Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip6_all_ens/csv/cmip6_warming_levels_all_ens_1850_1900.csv",skip=4) +GWL_cmip5 <- read.csv("Data/in/cmip_warming_levels-v0.2.0/mathause-cmip_warming_levels-fc9a5d7/warming_levels/cmip5_all_ens/csv/cmip5_warming_levels_all_ens_1850_1900.csv",skip=4) +GWL_cmip6%>%filter(model%in%c("CESM2","MIROC-ES2L","GFDL-ESM4"),exp%in%c(" ssp126"," ssp585")) +GWL_cmip5%>%filter(model%in%c("CESM1-BGC","MIROC5","GFDL-ESM4"),exp%in%c(" rcp45"," rcp85")) + + +cmip5<- GWL_cmip5%>% + filter(model%in%cmip5_lkup$model,exp%in%c(" rcp45"," rcp85"))%>% + left_join(cmip5_lkup,by=c("model"="model","ensemble"="ensemble"))%>% + filter(!is.na(GCM))%>% + group_by(model,exp,warming_level,GCM)%>%summarize( + mnSTyr = mean(start_year), + mnENDyr = mean(end_year))%>%mutate(exp = gsub(" ","",exp)) + +cmip6 <- GWL_cmip6%>%filter( + model%in%c("CESM2","MIROC-ES2L","GFDL-ESM4"), + exp%in%c(" ssp126"," ssp585"))%>% + left_join(cmip6_lkup,by=c("model"="model","ensemble"="ensemble"))%>% + filter(!is.na(GCM))%>% + group_by(model,exp,warming_level,GCM)%>%summarize( + mnSTyr = mean(start_year), + mnENDyr = mean(end_year))%>%mutate(exp = gsub(" ","",exp)) + +# Load the rest of the ROMSNPZ data: +# ------------------------ +cat("Rdata_path : ", Rdata_path,"\n") + +hind_yearsIN <- 1979:thisYr +proj_yearsIN <- (thisYr+1):2100 + +yrs <- hind_yearsIN + + +# Load weekly data: +# ---------------------------------------------- +load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_weekly_fut_mn.Rdata") +ACLIM_weekly_futCMIP5 <- ACLIM_weekly_fut%>%left_join(weekly_var_def,join_by(var== name)) +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_weekly_fut_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_weekly_hind_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_weekly_hist_mn.Rdata") +ACLIM_weekly_hist <- ACLIM_weekly_hist%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_weekly_fut <- ACLIM_weekly_fut%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_weekly_futCMIP6 <- ACLIM_weekly_fut +ACLIM_weekly_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_weekly_futCMIP5$GCM) +ACLIM_weekly_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_weekly_futCMIP5$GCM) +ACLIM_weekly_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_weekly_futCMIP5$GCM) +ACLIM_weekly_fut <- rbind(ACLIM_weekly_futCMIP6,ACLIM_weekly_futCMIP5) + +# Load surveyrep data: +# ---------------------------------------------- +load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_surveyrep_fut_mn.Rdata") +ACLIM_surveyrep_futCMIP5 <- ACLIM_surveyrep_fut%>%left_join(srvy_var_def,join_by(var== name)) +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_fut_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_hind_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_hist_mn.Rdata") +ACLIM_surveyrep_hist <- ACLIM_surveyrep_hist%>%left_join(srvy_var_def,join_by(var== name)) +ACLIM_surveyrep_hind <- ACLIM_surveyrep_hind%>%left_join(srvy_var_def,join_by(var== name)) +ACLIM_surveyrep_fut <- ACLIM_surveyrep_fut%>%left_join(srvy_var_def,join_by(var== name)) +ACLIM_surveyrep_futCMIP6 <- ACLIM_surveyrep_fut +ACLIM_surveyrep_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_surveyrep_futCMIP5$GCM) +ACLIM_surveyrep_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_surveyrep_futCMIP5$GCM) +ACLIM_surveyrep_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_surveyrep_futCMIP5$GCM) +ACLIM_surveyrep_fut <- rbind(ACLIM_surveyrep_futCMIP6,ACLIM_surveyrep_futCMIP5) + +# Load annual data: +# ---------------------------------------------- +load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_annual_fut_mn.Rdata") +ACLIM_annual_futCMIP5 <- ACLIM_annual_fut%>%left_join(weekly_var_def,join_by(var== name)) +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_fut_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_hind_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_hist_mn.Rdata") +ACLIM_annual_hist <- ACLIM_annual_hist%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_annual_hind <- ACLIM_annual_hind%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_annual_fut <- ACLIM_annual_fut%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_annual_futCMIP6 <- ACLIM_annual_fut +ACLIM_annual_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_annual_futCMIP5$GCM) +ACLIM_annual_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_annual_futCMIP5$GCM) +ACLIM_annual_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_annual_futCMIP5$GCM) +ACLIM_annual_fut <- rbind(ACLIM_annual_futCMIP6,ACLIM_annual_futCMIP5) + +# Load seasonal data: +# ---------------------------------------------- +load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_seasonal_fut_mn.Rdata") +ACLIM_seasonal_futCMIP5 <- ACLIM_seasonal_fut%>%left_join(weekly_var_def,join_by(var== name)) +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_seasonal_fut_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_seasonal_hind_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_seasonal_hist_mn.Rdata") +ACLIM_seasonal_hist <- ACLIM_seasonal_hist%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_seasonal_hind <- ACLIM_seasonal_hind%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_seasonal_fut <- ACLIM_seasonal_fut%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_seasonal_futCMIP6 <- ACLIM_seasonal_fut +ACLIM_seasonal_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_seasonal_futCMIP5$GCM) +ACLIM_seasonal_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_seasonal_futCMIP5$GCM) +ACLIM_seasonal_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_seasonal_futCMIP5$GCM) +ACLIM_seasonal_fut <- rbind(ACLIM_seasonal_futCMIP6,ACLIM_seasonal_futCMIP5) + +# Load monthly data: +# ---------------------------------------------- +load("Data/out/K20P19_CMIP5/allEBS_means/ACLIM_monthly_fut_mn.Rdata") +ACLIM_monthly_futCMIP5 <- ACLIM_monthly_fut%>%left_join(weekly_var_def,join_by(var== name)) +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_monthly_fut_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_monthly_hind_mn.Rdata") +load("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_monthly_hist_mn.Rdata") +ACLIM_monthly_hist <- ACLIM_monthly_hist%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_monthly_hind <- ACLIM_monthly_hind%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_monthly_fut <- ACLIM_monthly_fut%>%left_join(weekly_var_def,join_by(var== name)) +ACLIM_monthly_futCMIP6 <- ACLIM_monthly_fut +ACLIM_monthly_futCMIP5$GCM <- gsub("MIROC","miroc",ACLIM_monthly_futCMIP5$GCM) +ACLIM_monthly_futCMIP5$GCM <- gsub("CESM","cesm", ACLIM_monthly_futCMIP5$GCM) +ACLIM_monthly_futCMIP5$GCM <- gsub("GFDL","gfdl", ACLIM_monthly_futCMIP5$GCM) +ACLIM_monthly_fut <- rbind(ACLIM_monthly_futCMIP6,ACLIM_monthly_futCMIP5) + + +# get just the core columns: +grplist <- c("var","sim", + "basin","type", + "sim_type", + "gcmcmip","CMIP", + "scen", + "GCM","mod") + +plot_vars <- c("fracbelow2", + "fracbelow0", + "temp_bottom5m", + "temp_surface5m", + "oxygen_bottom5m", + "pH_bottom5m", + "pH_surface5m", + "aice","EupS_integrated","NCaS_integrated") + +hind <- ACLIM_weekly_hind%>%filter(var%in%plot_vars)%>% + select(all_of(c(grplist,"year","season","mn_val","mnVal_hind","mnDate","jday","wk","mo"))) + +# get weekly climatology +wkly_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"wk")))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) +ggplot(wkly_clim%>%filter(var=="EupS_integrated"))+ + geom_line(aes(x=mndate_clim,y= mn_clim,color=basin))+ + geom_line(aes(x=mndate_clim,y= mn_clim+sd_clim,color=basin),linetype="dashed")+ + geom_line(aes(x=mndate_clim,y= mn_clim-sd_clim,color=basin),linetype="dashed") + + +# get monthly climatology +mo_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"mo")))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) +ggplot(mo_clim%>%filter(var=="EupS_integrated"))+ + geom_line(aes(x=mndate_clim,y= mn_clim,color=basin))+ + geom_line(aes(x=mndate_clim,y= mn_clim+sd_clim,color=basin),linetype="dashed")+ + geom_line(aes(x=mndate_clim,y= mn_clim-sd_clim,color=basin),linetype="dashed") + + +# get seasonal climatology +season_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"season")))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) +ggplot(season_clim%>%filter(var=="EupS_integrated"))+ + geom_line(aes(x=mndate_clim,y= mn_clim,color=basin))+ + geom_line(aes(x=mndate_clim,y= mn_clim+sd_clim,color=basin),linetype="dashed")+ + geom_line(aes(x=mndate_clim,y= mn_clim-sd_clim,color=basin),linetype="dashed") + +# get annual climatatology +annual_clim <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist)))%>% + summarise( + jday_clim = mean(jday, na.rm=T), + mn_clim = mean(mn_val,na.rm=T), + sd_clim = sd(mn_val,na.rm=T))%>% + mutate(mndate_clim = as.Date("1990-01-01")+jday_clim) + + +# now determine freq of MHWs in the future +wkly_clim + +ACLIM_weekly_hind$warming_level <- + ACLIM_weekly_fut$warming_level <- NA +GWLS <- rbind(cmip5,cmip6) +for(i in 1:dim(GWLS)[1]){ + rr <- which(ACLIM_weekly_fut$RCP==GWLS$exp[i]& + ACLIM_weekly_fut$GCM==GWLS$GCM[i]& + ACLIM_weekly_fut$year>=GWLS$mnSTyr[i]& + ACLIM_weekly_fut$year0)) + ACLIM_weekly_fut[rr,]$warming_level<- GWLS[i,]$warming_level + rm(rr) +} +for(i in 1:dim(GWLS)[1]){ + rr <- which(ACLIM_weekly_hind$GCM==GWLS$GCM[i]& + ACLIM_weekly_hind$year>=GWLS$mnSTyr[i]& + ACLIM_weekly_hind$year0)) + ACLIM_weekly_hind[rr,]$warming_level<- GWLS[i,]$warming_level + rm(rr) +} + +ggplot(ACLIM_weekly_hind)+ + geom_point(aes(x=)) + + + + + + +hind <- ACLIM_seasonal_hind%>%filter(var%in%plot_vars)%>% + select(all_of(c(grplist,"year","season","mn_val","mnVal_hind","sdVal_hind","mnDate","jday"))) +tt <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"season")))%>% + summarise(mnVal_hind = mean(mn_val,na.rm=T), + sdVal_hind = sd(mn_val,na.rm=T)) +hind <- hind%>%rename(mnVal_hind_old = mnVal_hind,sdVal_hind_old =sdVal_hind)%>%left_join(tt) +rm(tt) + +hind_mo <- ACLIM_monthly_hind%>%filter(var%in%plot_vars)%>%rename(units = units.x)%>% + select(all_of(c(grplist,"year","season","mo","sdVal_hind","mn_val","mnVal_hind","mnDate","jday"))) +tt <- hind_mo%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"season","mo")))%>% + summarise(mnVal_hind = mean(mn_val,na.rm=T), + sdVal_hind = sd(mn_val,na.rm=T)) +hind_mo <- hind_mo%>%rename(mnVal_hind_old = mnVal_hind)%>%left_join(tt) + +ggplot(hind%>%filter(var=="aice",basin=="SEBS",season=="Spring"))+ + geom_line(aes(x=year,y=mnVal_hind_old,color="old"))+ + geom_line(aes(x=year,y=mnVal_hind,color="new")) + +ggplot(hind_mo%>%filter(var=="aice",basin=="SEBS",mo==12))+ + geom_line(aes(x=year,y=mnVal_hind_old,color="old"))+ + geom_line(aes(x=year,y=mnVal_hind,color="new"))+ + geom_line(aes(x=year,y=mnVal_hind+sdVal_hind))+ + geom_line(aes(x=year,y=mnVal_hind-sdVal_hind)) + +hind <- ACLIM_seasonal_hind%>%filter(var%in%plot_vars)%>% + select(all_of(c(grplist,"year","season","sd_val","mn_val","val_raw","mnVal_hind","mnDate","jday"))) +tt <- hind%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"season")))%>% + summarise(mnVal_hind = mean(mn_val,na.rm=T), + sdVal_hind = sd(mn_val,na.rm=T)) +hind <- hind%>%rename(mnVal_hind_old = mnVal_hind)%>%left_join(tt) +rm(tt) + +hind_mo <- ACLIM_monthly_hind%>%filter(var%in%plot_vars)%>% + select(all_of(c(grplist,"year","season","mo","sd_val","mn_val","val_raw","mnVal_hind","mnDate","jday"))) + tt <- hind_mo%>%ungroup()%>%filter(year<2019)%>% + group_by(!!!syms(c(grplist,"season","mo")))%>% + summarise(mnVal_hind = mean(mn_val,na.rm=T), + sdVal_hind = sd(mn_val,na.rm=T)) +hind_mo <- hind_mo%>%rename(mnVal_hind_old = mnVal_hind)%>%left_join(tt) + + + + diff --git a/R/sub_scripts/load_maps.R b/R/sub_scripts/load_maps.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_CEATTLE_dat_files.R b/R/sub_scripts/make_CEATTLE_dat_files.R new file mode 100755 index 0000000..1db0ff5 --- /dev/null +++ b/R/sub_scripts/make_CEATTLE_dat_files.R @@ -0,0 +1,297 @@ +#' +#' +#'make_CEATTLE_dat_files.R +#' +#'first run "R/sub_scripts/make_ceattle_indices.R" +#' + +# "Data/out/CEATTLE_indices/ceattle_vars_wide_op.Rdata" + + # Load setup + #-------------------------------------- + suppressMessages(source("R/make.R")) + + # load the datafile: + load(file="Data/out/CEATTLE_indices/ceattle_vars_op.Rdata") + load(file="Data/out/CEATTLE_indices/ceattle_vars_wide_op.Rdata") + + # switches + varall <- varlist <- unique(ceattle_vars_op$var) + shortlist <- c("Summer_temp_bottom5m","Winter_temp_bottom5m", + "Winter_pH_depthavg","Summer_oxygen_bottom5m", + "Summer_temp_surface5m", + "Spring_Cop_integrated", + "Fall_largeZoop_integrated") + thisYr <- as.numeric(format(Sys.time(), "%Y")) + today <- format(Sys.time(), "%b %d, %Y") + lastyr_hind <- thisYr #as.numeric(thisYr) #2021 + hind_yrs <- 1979:(lastyr_hind) # define the years of your estimation model (noting that recruitment covars are for cohort year) + fut_yrs <- (lastyr_hind+1):2099 # define the years of your projections + stitchDate <- "2019-12-30" # last date of the ACLIM hindcast + stitchDate_op <- "2022-05-16" #last operational hindcast date + log_adj <- 1e-4 + zscore_years <- 1980:2010 # years to recenter z score on + plotbasin <- "SEBS" + + # Define the name for the .dat file + fn <- paste0("ACLIM2_CMIP6_short_delta_bc",thisYr,".dat") + fn_long <- paste0("ACLIM2_CMIP6_delta_bc",thisYr,".dat") + + archive_old <- T # Archive the older version of the .dat file? + normlist <- read.csv(file=file.path(Rdata_path,"../normlist.csv")) + + CMIPS <- c("K20P19_CMIP6","K20P19_CMIP5") + + # create outpath folder + outpath <- "Data/out/ADMB_datfiles" + if(!dir.exists(outpath)) dir.create(outpath) + + # define hind and fut data files + fndat_hind <- file.path(outpath,paste("KKHhind_",fn,sep="")) + fndat_fut <- file.path(outpath,paste("KKHfut_",fn,sep="")) + + fndat_hind_long <- file.path(outpath,paste("KKHhind_",fn_long,sep="")) + fndat_fut_long <- file.path(outpath,paste("KKHfut_",fn_long,sep="")) + + fndat_hind2 <- file.path(outpath,paste("hind_",fn,sep="")) + fndat_fut2 <- file.path(outpath,paste("fut_",fn,sep="")) + + # create and archive .dat files + outfile <- fndat_fut + if(file.exists(outfile)&archive_old){ + # archive older version + archivefl <- paste0(substr(outfile,start=1,stop=nchar(outfile)-4), + format(Sys.time(), "%Y%m%d_%H%M%S"),".dat") + file.rename(outfile, archivefl) + #file.remove(outfile) + } + + file.create(outfile) + outfile <- fndat_hind + if(file.exists(outfile)&archive_old){ + # archive older version + archivefl <- paste0(substr(outfile,start=1,stop=nchar(outfile)-4), + format(Sys.time(), "%Y%m%d_%H%M%S"),".dat") + file.rename(outfile, archivefl) + #file.remove(outfile) + } + file.create(outfile) + + # ---------------------------------------------- + # CREATE INDICES + # ---------------------------------------------- + # 2 -- rescale (Z-score) data and get variables + + # preview possible variables + varall + + grpby2 <- c("type","var","basin", + "year","sim","sim_type", + "bc") + + #define hind and fut: + hind <- ceattle_vars_op%>%filter(year%in%hind_yrs,sim_type=="hind")%>% + ungroup() + + mnhind <- hind%>% + group_by(season,var,basin)%>% + summarize(mnhind = mean(val_use,na.rm=T), + sdhind = sd(val_use, na.rm=T))%>%ungroup() + hind <- hind%>%left_join(mnhind)%>% + mutate(val_use_scaled = (val_use-mnhind)/sdhind, + zscoreyrs = paste0( zscore_years[1],":", rev(zscore_years)[1]))%>% + select(all_of(c(grpby2,"val_use","val_use_scaled")))%>%distinct()%>% + ungroup() + + hind <- hind%>%full_join(expand.grid(year= hind_yrs, var = unique(hind$var))) %>%ungroup() + + fut <- ceattle_vars_op%>% + filter(year%in%fut_yrs)%>%ungroup() + + #temporary fix: Add Large Zoop for CESM RCP85 + tmp_fut <- fut%>%filter(GCM_scen=="cesm_rcp85") + grplist <- c("NCaS_integrated","EupS_integrated") + + if(length(grep("largeZoop_integrated",unique(tmp_fut$var_raw)) )==0){ + tmp_futA <- tmp_fut[grep(grplist[1],tmp_fut$var),] + tmp_futB <- tmp_fut[grep(grplist[2],tmp_fut$var),] + tmp_futA$var2 <- grplist[1] + tmp_futB$var2 <- grplist[2] + sumat<-c("val_use","mnVal_hind","val_delta","val_biascorrected", + "val_raw","mn_val") + tmp_var_zoop <- rbind(tmp_futA,tmp_futB)%>% + dplyr::filter(var2%in%c("NCaS_integrated","EupS_integrated"))%>% + dplyr::group_by( + var, + season, + type, + basin, + year, + sim, + gcmcmip, + GCM, + scen, + sim_type, + bc, + GCM_scen, + GCM_scen_sim, + CMIP, + GCM2, + GCM2_scen_sim, + jday,mnDate,var_raw,lognorm,var2)%>% + summarise_at(all_of(sumat),mean,na.rm=T)%>% + mutate(var_raw="largeZoop_integrated", + var = paste0(season,"_largeZoop_integrated"))%>%select(-var2)%>% + summarise_at(all_of(sumat),sum,na.rm=T)%>%relocate(names(fut))%>% + distinct() + + fut <- rbind(fut%>%ungroup(), tmp_var_zoop%>%ungroup()) + + } + fut <- fut%>%left_join(mnhind)%>% + mutate(val_use_scaled = (val_use-mnhind)/sdhind, + zscoreyrs = paste0( zscore_years[1],":", rev(zscore_years)[1]))%>%ungroup() + + data.frame(fut%>%filter(var=="Winter_largeZoop_integrated",GCM_scen=="cesm_rcp85")) + data.frame(fut%>%ungroup()%>%group_by(GCM_scen)%>%summarise(count = length(var))) + + fut <- fut%>%full_join(expand.grid(year= fut_yrs, + var = unique(fut$var), + GCM_scen = unique(fut$GCM_scen))) + data.frame(fut%>%ungroup()%>%group_by(GCM_scen)%>%summarise(count = length(var))) + data.frame(fut%>%filter(var=="Winter_largeZoop_integrated",GCM_scen=="cesm_rcp85")) + + # now identify which covars are highly correlated + + d_wide <- ceattle_vars_op%>% + filter(year<=lastyr_hind)%>% + left_join(mnhind)%>% + mutate(val_use_scaled = (val_use-mnhind)/sdhind)%>%ungroup()%>% + group_by(across(all_of(grpby2)))%>% + summarize_at(all_of(c("val_use_scaled")), mean, na.rm=T)%>% + tidyr::pivot_wider(names_from = "var", values_from = "val_use_scaled") + + # calculate correlations and display in column format + + # define columns with meta data: + col_meta <- which(colnames(d_wide)%in%grpby2) + d_wide_dat <-d_wide[,-col_meta] + num_col <- ncol(d_wide[,-col_meta]) + out_indx <- which(upper.tri(diag(num_col))) + cor_cols <- d_wide_dat%>% + do(melt(cor(., + method="spearman", + use="pairwise.complete.obs"), + value.name="cor")[out_indx,]) + + corr <- cor(na.omit(d_wide_dat)) + + long_dat <- reshape2::melt(corr,variable.name = "variable") %>% + as.data.frame() + + # plot co variation between variables + corplot <- long_dat %>%arrange(value)%>% + ggplot(aes(x=Var1, y=Var2, fill=value)) + + geom_raster() + + scale_fill_viridis_c()+ + theme_minimal()+ + theme(axis.text.x = element_text(angle = 90)) + + jpeg(filename = file.path("Data/out/CEATTLE_indices/CEATTLE_indicescorplot.jpg"), + width=8,height=7,units="in",res=350) + print(corplot) + dev.off() + + # # remove those where cov is high (temp by season and cold pool by season) + # subset <- long_dat$>$filter(abs(value)<0.6) + + # 3 -- write data to hind .dat file + # ------------------------------------ + + + # CEATTLE uses a spp overlap index - you can skip this + + overlapdat <- data.frame( + atf_OL=c(0.9391937,0.8167094,0.808367,0.5926875,0.7804481,0.5559549, + 0.4006931,0.5881404,0.7856776,0.511565,0.6352048,0.5583476, + 0.5792738,0.5417657,0.8212887,0.6287613,0.4536608,0.6587292, + 0.4884194,0.8289379,0.4399257,0.5950167,0.6388434,0.6111834, + 0.8742649,0.7868746,0.8024257,0.6227457,0.4956742,0.4347917, + 0.4791108,0.4369006,0.5613625,0.4353015), + south_OL=c(0.9980249,0.9390368,0.9959974,0.6130846,0.951234,0.5851891, + 0.4934879,0.641471,0.9809618,0.5596813,0.7196964,0.6754698, + 0.5774808,0.6041351,0.9406521,0.7949525,0.5306435,0.7977694, + 0.5345031,0.9879945,0.5079171,0.7148121,0.8997132,0.7340859, + 0.9962068,0.9627235,0.998043,0.8111,0.6087638,0.513057,0.5492621, + 0.4971361,0.665453,0.5969653) + ) + + + includeOverlap <- F + overlap <- matrix(1,3,length(sort(unique(hind$year)))) + overlap_fut <- array(1,c(3,length(unique(fut$GCM_scen))+1,length(sort(unique(fut$year))))) + if(includeOverlap){ + overlap[3,] <- overlapIN + overlap[3,][overlap[3,]>1]<-1 #covs$BT2to6/covs$BT0to6 + } + + # replace NA values with the mean + hind_short <- hind%>%mutate(long_name=var)%>% + filter(var%in%shortlist) + + cat("making short hind and future dat files\n") + + + # Kir's .dat file + makeDat_hind(datIN = hind_short, + outfile = fndat_hind, + value2use = "val_use", + value2use_scaled = "val_use_scaled", + NAVal = "mean", + nsppIN = 3, + overlapIN = overlap, + nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), + Scaled_covlist = unique(hind_short$var)) + + makeDat_fut( datIN = fut%>%mutate(long_name=var)%>% + filter(var%in%shortlist), + hinddatIN = hind%>%mutate(long_name=var)%>% + filter(var%in%shortlist), + outfile = fndat_fut, + value2use = "val_use", + value2use_scaled = "val_use_scaled", + NAVal = "mean", + nsppIN = 3, + last_nyrs_avg = 10, + overlapIN = overlap_fut, #(nspp,nsim+1,nyrs_fut) + overlap_hind = overlap, + nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), + Scaled_covlist = unique(hind_short$var)) + + # Kir's .dat file + cat("making long hind and future dat files\n") + + makeDat_hind(datIN = hind%>%mutate(long_name=var), + outfile = fndat_hind_long, + value2use = "val_use", + value2use_scaled = "val_use_scaled", + NAVal = "mean", + nsppIN = 3, + overlapIN = overlap, + nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), + Scaled_covlist = unique(hind$var)) + + makeDat_fut( datIN = fut%>%mutate(long_name=var), + hinddatIN = hind%>%mutate(long_name=var), + outfile = fndat_fut_long, + value2use = "val_use", + value2use_scaled = "val_use_scaled", + NAVal = "mean", + nsppIN = 3, + last_nyrs_avg = 10, + overlapIN = overlap_fut, #(nspp,nsim+1,nyrs_fut) + overlap_hind = overlap, + nonScaled_covlist = c("Summer_temp_bottom5m","Summer_temp_surface5m"), + Scaled_covlist = unique(hind$var)) + + message(paste0("dat files successfully created (e.g., ",fndat_fut_long,")")) diff --git a/R/sub_scripts/make_NRS_indices.R b/R/sub_scripts/make_NRS_indices.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_NRS_indices_raw.R b/R/sub_scripts/make_NRS_indices_raw.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_RKC_Indices_Andre.R b/R/sub_scripts/make_RKC_Indices_Andre.R new file mode 100755 index 0000000..7b3337f --- /dev/null +++ b/R/sub_scripts/make_RKC_Indices_Andre.R @@ -0,0 +1,450 @@ +#' +#' +#' +#'make_RKC_Indices_Andre.R +#' +#'This script generates the indices for the NRS and pcod papers +#'for Punt et al. 2024 +#' +#' staion info for +#' I-11 +#' K-14 +#' Z-05 +#' D-10 +#' +#' +#' + +# rm(list=ls()) + +# load ACLIM packages and functions + suppressMessages(source("R/make.R")) + +# Set up stations + RKC_immature_males_stations <- c( + "D-10 ", + "E-12 ", + "F-11 ", + "G-10 ", + "H-10 ", + "H-11 ", + "H-13 ", + "I-10 ", + "I-11 ", + "I-12 ", + "J-11 ", + "J-13 " + ) + + + TC_small_males_stations <- c( + "A-02 ", + "C-18 ", + "D-18 ", + "F-19 ", + "F-24 ", + "G-25 ", + "I-21 ", + "I-26 ", + "I-20 ", + "H-19 ", + "J-21 ", + "I-20 ", + "L-27 ", + "M-26 ") + + +# set up paths + outfldr <- "Data/out/RKC_indices" + if(!dir.exists(outfldr)) dir.create(outfldr) + +# specific the stations, variables, and projection sets + station_set <- c("D-10 ","Z-05 ", "K-14 ","I-11 ") + varlist <- c("pH_bottom5m","pH_depthavg","pH_integrated","pH_surface5m","temp_surface5m", "temp_bottom5m") + CMIPset <- c("K20P19_CMIP6","K20P19_CMIP5") + stitchDate_op <- "2021-12-30" #last operational hindcast date + +# preview possible variables + load(file = "Data/out/weekly_vars.Rdata") + load(file = "Data/out/srvy_vars.Rdata") + +# save setup for plotting + save(list=ls(),file=file.path(outfldr,"RKC_indices_setup.Rdata")) + + +# ------------------------------------ +# Hindcast First +# ------------------------------------ + + # Load and select stations (survey replicated hindcast): + + load("Data/out/K20P19_CMIP6/BC_ACLIMsurveyrep/ACLIMsurveyrep_B10K-K20P19_CORECFS_BC_hind.Rdata") + + # first for RCK Immature Males + # preview the data + station_set <- RKC_immature_males_stations + head(hind%>%filter(station_id%in%station_set,var%in%varlist)%>%data.frame()) + + # select the subset for RKC + hind_RKC_immature_males <- hind%>%filter(station_id%in%station_set,var%in%varlist)%>% + mutate(val_use = val_raw)%>%ungroup() + + # output the data as Rdata and CSV + write_csv(hind_RKC_immature_males, file.path(outfldr,"hind_RKC_immature_males.csv")) + save(hind_RKC_immature_males, file=file.path(outfldr,"hind_RKC_immature_males.Rdata")) + + # Then for TC_small_males + # preview the data + station_set <- TC_small_males_stations + head(hind%>%filter(station_id%in%station_set,var%in%varlist)%>%data.frame()) + + # select the subset for RKC + hind_TC_small_males <- hind%>%filter(station_id%in%station_set,var%in%varlist)%>% + mutate(val_use = val_raw)%>%ungroup() + + # output the data as Rdata and CSV + write_csv(hind_TC_small_males, file.path(outfldr,"hind_TC_small_males.csv")) + save(hind_TC_small_males, file=file.path(outfldr,"hind_TC_small_males.Rdata")) + + # ------------------------------------ + # now get monthly values: + # ------------------------------------ + # SST, Ph and SBT values. predictions for 1/15, 2/15 .. 12/15.. + # Load bias corrected weekly strata data: + + rm(hind) + load("Data/out/K20P19_CMIP6/BC_ACLIMregion/ACLIMregion_B10K-K20P19_CORECFS_BC_hind.Rdata") + + for(outType in c("RKC_immature_males","TC_small_males")){ + if(outType == "TC_small_males") + hindDat <- hind_TC_small_males + + if(outType == "RKC_immature_males") + hindDat <- hind_RKC_immature_males + + unique(hindDat$strata) + unique(hind$mo) + unique(hind$year) + tmp_mat <- expand_grid(year =unique(hind$year), mo = unique(hind$mo))%>% + rowwise()%>%mutate(targetdate = as.Date(paste0(year,"-",mo,"-",15))) + tt <- strptime(tmp_mat$targetdate,format = "%Y-%m-%d") + tmp_mat$target_jday <- tt$yday+1 + tmp_mat$target_mday <- tt$mday + + hindDat_monthly <- hind%>% + filter(strata%in%unique(hindDat$strata), + var%in%varlist)%>% + mutate(val_use = val_raw)%>%left_join(tmp_mat)%>% + rowwise()%>%mutate(mday=strptime(mnDate,format = "%Y-%m-%d")$mday)%>%ungroup()%>% + mutate(keepA = mday>=target_mday-3,keepB = mday<=target_mday+3)%>% + filter(keepA,keepB)%>% + ungroup() + + grp_names <- names(hindDat_monthly)[!names(hindDat_monthly)%in%c("strata","strata_area_km2", "keepA","keepB")] + nms <- c("val_use","val_raw","mn_val","sd_val", + "n_val","jday","mnDate", + "mnVal_hind","sdVal_hind","nVal_hind", + "seVal_hind","sdVal_hind_mo", "sdVal_hind_yr") + + nms2 <- grp_names[!grp_names%in%nms] + + hindDat_monthly_avg <- hindDat_monthly%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>%ungroup() + + if(outType == "TC_small_males"){ + hind_TC_small_males_monthly <- hindDat_monthly + hind_TC_small_males_monthly_avg <- hindDat_monthly_avg + + # output the data as Rdata and CSV + write_csv(hind_TC_small_males_monthly, file.path(outfldr,"hind_TC_small_males_monthly.csv")) + save(hind_TC_small_males_monthly, file=file.path(outfldr,"hind_TC_small_males_monthly.Rdata")) + + write_csv(hind_TC_small_males_monthly_avg, file.path(outfldr,"hind_TC_small_males_monthly_avg.csv")) + save(hind_TC_small_males_monthly_avg, file=file.path(outfldr,"hind_TC_small_males_monthly_avg.Rdata")) + } + + if(outType == "RKC_immature_males"){ + hind_RKC_immature_males_monthly <- hindDat_monthly + hind_RKC_immature_males_monthly_avg <- hindDat_monthly_avg + # output the data as Rdata and CSV + write_csv(hind_RKC_immature_males_monthly, file.path(outfldr,"hind_RKC_immature_males_monthly.csv")) + save(hind_RKC_immature_males_monthly, file=file.path(outfldr,"hind_RKC_immature_males_monthly.Rdata")) + + write_csv(hind_RKC_immature_males_monthly_avg, file.path(outfldr,"hind_RKC_immature_males_monthly_avg.csv")) + save(hind_RKC_immature_males_monthly_avg, file=file.path(outfldr,"hind_RKC_immature_males_monthly_avg.Rdata")) + } + rm(tmp_mat) + rm(hindDat_monthly) + rm(hindDat_monthly_avg) + + } + +# ------------------------------------ +# Projections Next +# ------------------------------------ + select_list <- unique(c(names(hind_RKC_immature_males),"long_name","qry_date","station_id", + "sim_type","GCM","RCP","mod", "CMIP", "val_raw","mnVal_hind","sdVal_hind","val_delta")) + jj <- 0 + +for (CMIP in c("CMIP6","CMIP5")){ + + if(CMIP == "CMIP6"){ + + fl_base_srv <- "ACLIMsurveyrep_B10K-K20P19_CMIP6_" + fl_path_srv <- "Data/out/K20P19_CMIP6/BC_ACLIMsurveyrep" + + fl_base_reg <- "ACLIMregion_B10K-K20P19_CMIP6_" + fl_path_reg <- "Data/out/K20P19_CMIP6/BC_ACLIMregion" + + + # CMIP6 + ssps <- c("ssp126","ssp585") + gcms <- c("cesm","miroc","gfdl") + set <- expand.grid(gcms,ssps,stringsAsFactors = F) + + } + + if(CMIP == "CMIP5"){ + #now get monthly + fl_base_srv <- "ACLIMsurveyrep_B10K-K20P19_CMIP5_" + fl_path_srv <- "Data/out/K20P19_CMIP5/BC_ACLIMsurveyrep" + + fl_base_reg <- "ACLIMregion_B10K-K20P19_CMIP5_" + fl_path_reg <- "Data/out/K20P19_CMIP5/BC_ACLIMregion" + + # now for CMIP5 + gcms <- c("CESM","MIROC","GFDL") + ssps <- c("rcp45","rcp85") + set <- expand.grid(gcms,ssps,stringsAsFactors = F) + + } + + for(outType in c("RKC_immature_males","TC_small_males")){ + + eval(parse(text = paste0("station_set <- ",outType,"_stations") )) + + # for each scenario + for(i in 1:dim(set)[1]){ + + cat("set = ",set[i,1],set[i,2],"\n") + fl <- paste0(fl_base_srv,set[i,1],"_",set[i,2],"_BC_fut.Rdata") + load(file.path(fl_path_srv,fl)) + + tmp <- fut%>%filter(station_id%in%station_set,var%in%varlist)%>%data.frame() + + my_vars <- function() select_list[select_list%in%names(tmp)] + + tmp <- tmp%>%ungroup()%>% + dplyr::select(my_vars())%>% + mutate(val_use = val_delta)%>%data.frame() + + if(i==1){ + fut_RKC_all <- tmp + }else{ + fut_RKC_all <- rbind(fut_RKC_all,tmp) + } + rm(fut) + + #now get monthly + fl <- paste0(fl_base_reg,set[i,1],"_",set[i,2],"_BC_fut.Rdata") + load(file.path(fl_path_reg,fl)) + + tmp_mat <- expand_grid(year =unique(tmp$year), mo = unique(substr(fut$mnDate,6,7)))%>% + rowwise()%>%mutate(targetdate = as.Date(paste0(year,"-",mo,"-",15))) + tt <- strptime(tmp_mat$targetdate,format = "%Y-%m-%d") + tmp_mat$target_jday <- tt$yday+1 + tmp_mat$target_mday <- tt$mday + + futDat_monthly <- fut%>% + filter(strata%in%unique(tmp$strata), + var%in%varlist)%>%mutate(mo = substr(mnDate,6,7))%>% + mutate(val_use = val_delta)%>%left_join(tmp_mat)%>%rowwise()%>% + rowwise()%>%mutate(mday=strptime(mnDate,format = "%Y-%m-%d")$mday)%>%ungroup()%>% + mutate(keepA = mday>=target_mday-3,keepB = mday<=target_mday+3)%>% + filter(keepA,keepB)%>% + ungroup() + + if(i==1){ + fut_RKC_all_monthly <- futDat_monthly + }else{ + fut_RKC_all_monthly <- rbind(fut_RKC_all_monthly,futDat_monthly) + } + rm(futDat_monthly) + rm(fut) + + rm(tmp) + + } + + jj <- jj + 1 + if(jj==1){ + fut_RKC_all_tmp <- fut_RKC_all + fut_RKC_all_tmp_monthly <- fut_RKC_all_monthly + }else{ + fut_RKC_all <- rbind(fut_RKC_all_tmp,fut_RKC_all) + fut_RKC_all_monthly <- rbind(fut_RKC_all_tmp_monthly,fut_RKC_all_monthly) + + } + + # fix the caps issue: + fut_RKC <- fut_RKC_all%>% + mutate(GCM = gsub("MIROC","miroc",GCM))%>% + mutate(GCM = gsub("GFDL","gfdl",GCM))%>% + mutate(GCM = gsub("CESM","cesm",GCM))%>% + mutate(sim = gsub("MIROC","miroc",sim))%>% + mutate(sim = gsub("GFDL","gfdl",sim))%>% + mutate(sim = gsub("CESM","cesm",sim))%>% + mutate(GCM = factor(GCM, levels =c("hind","gfdl","cesm","miroc")))%>% + mutate(GCM_scen = paste0(GCM,"_",RCP))%>%data.frame() + + # fix the caps issue: + fut_RKC_monthly <- fut_RKC_all_monthly%>% + mutate(GCM = gsub("MIROC","miroc",GCM))%>% + mutate(GCM = gsub("GFDL","gfdl",GCM))%>% + mutate(GCM = gsub("CESM","cesm",GCM))%>% + mutate(sim = gsub("MIROC","miroc",sim))%>% + mutate(sim = gsub("GFDL","gfdl",sim))%>% + mutate(sim = gsub("CESM","cesm",sim))%>% + mutate(GCM = factor(GCM, levels =c("hind","gfdl","cesm","miroc")))%>% + mutate(GCM_scen = paste0(GCM,"_",RCP))%>%data.frame() + + + if(outType =="RKC_immature_males"){ + fut_RKC_immature_males <- fut_RKC + # output the data as Rdata and CSV + write_csv(fut_RKC_immature_males, file.path(outfldr,"fut_RKC_immature_males.csv")) + save(fut_RKC_immature_males, file=file.path(outfldr,"fut_RKC_immature_males.Rdata")) + + fut_RKC_immature_males_monthly <- fut_RKC_monthly + # output the data as Rdata and CSV + write_csv(fut_RKC_immature_males_monthly, file.path(outfldr,"fut_RKC_immature_males_monthly.csv")) + save(fut_RKC_immature_males_monthly, file=file.path(outfldr,"fut_RKC_immature_males_monthly.Rdata")) + + + }else{ + if(outType =="TC_small_males"){ + + fut_TC_small_males <- fut_RKC + # output the data as Rdata and CSV + write_csv(fut_TC_small_males, file.path(outfldr,"fut_TC_small_males.csv")) + save(fut_TC_small_males, file=file.path(outfldr,"fut_TC_small_males.Rdata")) + + fut_TC_small_males_monthly <- fut_RKC_monthly + # output the data as Rdata and CSV + write_csv(fut_TC_small_males_monthly, file.path(outfldr,"fut_TC_small_males_monthly.csv")) + save(fut_TC_small_males_monthly, file=file.path(outfldr,"fut_TC_small_males_monthly.Rdata")) + + + }else{ + stop("outType doesn't match options") + } + } + + + rm(fut_RKC) + rm(fut_RKC_monthly) + } + +} + + if(1 == 10){ + load(file=file.path(outfldr,"fut_RKC_immature_males.Rdata")) #fut_RKC_immature_males + load(file.path(outfldr,"fut_TC_small_males.Rdata")) #fut_TC_small_males + + load(file=file.path(outfldr,"hind_RKC_immature_males.Rdata")) #hind_RKC_immature_males + load(file.path(outfldr,"hind_TC_small_males.Rdata")) #hind_TC_small_males + } + + # now summarize across stations + AVG_hind_RKC_immature_males <- hind_RKC_immature_males%>%ungroup()%>% + group_by(var,units,year,basin,sim,type,sim_type)%>% + summarize(mn_val_use = mean(val_use,na.rm=T), + sd_val_use = sd(val_use,na.rm=T), + n_val_use = length.na(val_use), + mnDate = mean(mnDate, na.rm =T))%>%data.frame() + AVG_hind_TC_small_males <- hind_TC_small_males%>%ungroup()%>% + group_by(var,units,year,basin,sim,type,sim_type)%>% + summarize(mn_val_use = mean(val_use,na.rm=T), + sd_val_use = sd(val_use,na.rm=T), + n_val_use = length.na(val_use), + mnDate = mean(mnDate, na.rm =T))%>%data.frame() + + AVG_fut_RKC_immature_males <- fut_RKC_immature_males%>%ungroup()%>% + group_by(var,units,year,basin,sim,type,sim_type,GCM,RCP,mod,CMIP,GCM_scen)%>% + summarize(mn_val_use = mean(val_use,na.rm=T), + sd_val_use = sd(val_use,na.rm=T), + n_val_use = length.na(val_use), + mnDate = mean(mnDate, na.rm =T))%>%data.frame() + AVG_fut_TC_small_males <- fut_TC_small_males%>%ungroup()%>% + group_by(var,units,year,basin,sim,type,sim_type,GCM,RCP,mod,CMIP,GCM_scen)%>% + summarize(mn_val_use = mean(val_use,na.rm=T), + sd_val_use = sd(val_use,na.rm=T), + n_val_use = length.na(val_use), + mnDate = mean(mnDate, na.rm =T))%>%data.frame() + + + # average across strata monhtly + + futDat_monthly <- fut_TC_small_males_monthly + + grp_names <- names(futDat_monthly)[!names(futDat_monthly)%in%c("strata","strata_area_km2", "keepA","keepB")] + nms <- c("val_use","val_raw","mnVal_hind","sdVal_hind", + "sdVal_hind_mo","sdVal_hind_yr","mnVal_hist", + "sdVal_hist","sdVal_hist_mo","sdVal_hist_yr", + "sf_wk","val_biascorrectedyr" ,"val_biascorrectedmo", + "sf_mo","val_delta_adj","val_biascorrected", + "val_biascorrectedwk", "val_delta", + "sf_yr","val_use" ) + + nms2 <- grp_names[!grp_names%in%nms] + + futDat_monthly_avg <- futDat_monthly%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>%ungroup() + + fut_TC_small_males_monthly_avg <- futDat_monthly_avg + + futDat_monthly <- fut_RKC_immature_males_monthly + + rm(futDat_monthly_avg) + grp_names <- names(futDat_monthly)[!names(futDat_monthly)%in%c("strata","strata_area_km2", "keepA","keepB")] + nms <- c("val_use","val_raw","mnVal_hind","sdVal_hind", + "sdVal_hind_mo","sdVal_hind_yr","mnVal_hist", + "sdVal_hist","sdVal_hist_mo","sdVal_hist_yr", + "sf_wk","val_biascorrectedyr" ,"val_biascorrectedmo", + "sf_mo","val_delta_adj","val_biascorrected", + "val_biascorrectedwk", "val_delta", + "sf_yr","val_use" ) + + nms2 <- grp_names[!grp_names%in%nms] + + futDat_monthly_avg <- futDat_monthly%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>%ungroup() + + fut_RKC_immature_males_monthly_avg <- futDat_monthly_avg + + + write_csv(AVG_hind_TC_small_males, file.path(outfldr,"AVG_hind_TC_small_males.csv")) + save(AVG_hind_TC_small_males, file=file.path(outfldr,"AVG_hind_TC_small_males.Rdata")) + + write_csv(AVG_hind_RKC_immature_males, file.path(outfldr,"AVG_hind_RKC_immature_males.csv")) + save(AVG_hind_RKC_immature_males, file=file.path(outfldr,"AVG_hind_RKC_immature_males.Rdata")) + + write_csv(AVG_fut_TC_small_males, file.path(outfldr,"AVG_fut_TC_small_males.csv")) + save(AVG_fut_TC_small_males, file=file.path(outfldr,"AVG_fut_TC_small_males.Rdata")) + + write_csv(AVG_fut_RKC_immature_males, file.path(outfldr,"AVG_fut_RKC_immature_males.csv")) + save(AVG_fut_RKC_immature_males, file=file.path(outfldr,"AVG_fut_RKC_immature_males.Rdata")) + + write_csv(fut_TC_small_males_monthly_avg, file.path(outfldr,"fut_TC_small_males_monthly_avg.csv")) + save(fut_TC_small_males_monthly_avg, file=file.path(outfldr,"fut_TC_small_males_monthly_avg.Rdata")) + + write_csv(fut_TC_small_males_monthly_avg, file.path(outfldr,"fut_TC_small_males_monthly_avg.csv")) + save(fut_TC_small_males_monthly_avg, file=file.path(outfldr,"fut_TC_small_males_monthly_avg.Rdata")) + + write_csv(fut_RKC_immature_males_monthly_avg, file.path(outfldr,"fut_RKC_immature_males_monthly_avg.csv")) + save(fut_RKC_immature_males_monthly_avg, file=file.path(outfldr,"fut_RKC_immature_males_monthly_avg.Rdata")) + + diff --git a/R/sub_scripts/make_ceattle_indices.R b/R/sub_scripts/make_ceattle_indices.R old mode 100644 new mode 100755 index 1ee0d1b..462c881 --- a/R/sub_scripts/make_ceattle_indices.R +++ b/R/sub_scripts/make_ceattle_indices.R @@ -59,7 +59,7 @@ adjIN = "val_delta", ifmissingyrs = 5, weekIN = NULL, #"Week" - monthIN = NULL, + monthIN = NULL, GCMIN = NULL, scenIN = NULL, facet_rowIN = "bc", # choices=c("bc","basin","scen") @@ -392,6 +392,8 @@ save(ceattle_vars_op, file="Data/out/CEATTLE_indices/ceattle_vars_op.Rdata") write.csv(ceattle_vars_op, file="Data/out/CEATTLE_indices/ceattle_vars_op.csv") + cat("Indices saved in : ACLIM2/Data/out/CEATTLE_indices/ceattle_vars_op.Rdata") + # recast with vars for each column: ceattle_vars_wide_op<- ceattle_vars_op%>% @@ -399,17 +401,10 @@ c("units","long_name","lognorm")])))%>% summarize_at(all_of(c("val_use")), mean, na.rm=T)%>% tidyr::pivot_wider(names_from = "var", values_from = "val_use") - - # ceattle_vars_wide_op$NE_winds <- getNE_winds(vNorth=ceattle_vars_wide_op$vNorth_surface5m, - # uEast=ceattle_vars_wide_op$uEast_surface5m) - # - # ceattle_vars2_op<- ceattle_vars_wide_op%>% - # tidyr::pivot_longer(cols = c(unique(NRS_vars$var),"NE_winds"), - # names_to = "var", - # values_to = "val_use")%>%mutate(mn_val=val_use) - + save(ceattle_vars_wide_op, file="Data/out/CEATTLE_indices/ceattle_vars_wide_op.Rdata") write.csv(ceattle_vars_wide_op, file="Data/out/CEATTLE_indices/ceattle_vars_wide_op.csv") + cat("Indices saved in : ACLIM2/Data/out/CEATTLE_indices/ceattle_vars_wide_op.Rdata") pp<- ggplot(ceattle_vars_wide_op)+ geom_line(aes(x=year,y=annual_NE_winds,color= GCM_scen,linetype = basin), @@ -427,7 +422,7 @@ pp - pp<- ggplot(ceattle_vars_wide_op)+ + pp_winds<- ggplot(ceattle_vars_wide_op)+ geom_line(aes(x=year,y=Spring_NE_winds,color= GCM_scen,linetype = basin), alpha = 0.2,show.legend = FALSE)+ geom_smooth(aes(x=year,y=Spring_NE_winds,color= GCM_scen, @@ -441,8 +436,8 @@ legend = "")+ scale_color_discrete()+ facet_grid(scen~bc) - pp + pp_winds jpeg(filename = file.path("Data/out/CEATTLE_indices/CEATTLE_indices2_spring_op.jpg"), width=8,height=7,units="in",res=350) - print(pp) + print(pp_winds) dev.off() \ No newline at end of file diff --git a/R/sub_scripts/make_hind.R b/R/sub_scripts/make_hind.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_hind_C.R b/R/sub_scripts/make_hind_C.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_hist.R b/R/sub_scripts/make_hist.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_hist_new.R b/R/sub_scripts/make_hist_new.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_hist_old.R b/R/sub_scripts/make_hist_old.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_pcod_indices_Andre.R b/R/sub_scripts/make_pcod_indices_Andre.R new file mode 100755 index 0000000..3d0c296 --- /dev/null +++ b/R/sub_scripts/make_pcod_indices_Andre.R @@ -0,0 +1,534 @@ +#' +#' +#' +#'make_pcod_indices_Andre.R +#' +#'This script generates the indices for the NRS and pcod papers +#'for Punt et al. 20220 +#' +#' SST SBT and pH in mar-April +#' SST and SBT for June-Aug +#' +#' + +# rm(list=ls()) +suppressMessages(source("R/make.R")) + +CMIPset <- c("K20P19_CMIP6","K20P19_CMIP5") + +# preview possible variables +load(file = "Data/out/weekly_vars.Rdata") +load(file = "Data/out/srvy_vars.Rdata") +load(paste0("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_hind_mn.Rdata")) + +varall <- unique(ACLIM_annual_hind$var) + +# varall +load(paste0("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_annual_fut_mn.Rdata")) +load(paste0("Data/out/K20P19_CMIP6/allEBS_means/ACLIM_surveyrep_fut_mn.Rdata")) + +stitchDate <- "2019-12-30" # last date of the ACLIM hindcast +#stitchDate_op <- "2022-05-16" #last operational hindcast date # can't be mid year for these +stitchDate_op <- "2021-12-30" #last operational hindcast date +# scens <- c("ssp126", "ssp585") +# GCMs <- c("miroc", "gfdl", "cesm" ) + +# Now compile the Pcod indices: +#-------------------------------------- +grpby <- c("type","var","basin", + "year","sim","gcmcmip","GCM","scen","sim_type", + "bc","GCM_scen","GCM_scen_sim", "CMIP" ) + +sumat <- c("jday","mnDate","val_use","mnVal_hind", + "val_delta","val_biascorrected","val_raw") + +# make PCOD_indices.csv using the ACLIM hindcast only as well as +# PCOD_indices_op.csv, the operational hindcast filled in for 2019-2022 +varlist <- c("pH_bottom5m","pH_depthavg","pH_integrated","pH_surface5m") +varlist <- c("temp_surface5m", "temp_bottom5m") +i <- 0 +v <- varlist[1] +mIN <- 3:4 +for(v in varlist){ + + i <- i + 1 + cat("compiling indices : ",v,"\n") + + # get the variable you want: + df <- get_var( typeIN = "monthly", + monthIN = mIN, + plotbasin = c("SEBS"), + plotvar = v, + bcIN = "bias corrected", + CMIPIN = CMIPset, + plothist = T, # ignore the hist runs + removeyr1 = T) # "Remove first year of proj ( burn in)") + + tmpda <- df$dat%>% + group_by(across(all_of(grpby)))%>% + summarize_at(all_of(sumat), mean, na.rm=T)%>% + mutate(mn_val = val_use, var = paste0("Mar2Apr_",var))%>%ungroup() + + tmpd <- stitchTS(dat = tmpda, maxD = stitchDate) + tmpd <- tmpd%>%mutate(type = "Pcod indices") + ggplot(tmpd)+ + geom_line(aes(x=year, y=mn_val,color=GCM_scen_sim))+ + facet_grid(.~scen) + + # now for operational hindcasts: + dfop <- get_var_ophind( typeIN = "monthly", + monthIN = mIN, + stitchDateIN = stitchDate, + plotbasin = c("SEBS"), + plotvar = v, + bcIN = "bias corrected", + CMIPIN = CMIPset, + jday_rangeIN = c(0,365), + plothist = T, # ignore the hist runs + removeyr1 = T, + adjIN = "val_delta", + ifmissingyrs = 5, + weekIN = NULL, #"Week" + SeasonIN = NULL, + GCMIN = NULL, + scenIN = NULL, + facet_rowIN = "bc", # choices=c("bc","basin","scen") + facet_colIN = "scen") +# dfop$dat%>%filter(var==v,year%in%(2022))%>%select(year,mo, basin, var,val_use,val_delta,val_raw) + tmpdop <- dfop$dat%>% + group_by(across(all_of(c(grpby,"GCM2","GCM2_scen_sim"))))%>% + summarize_at(all_of(sumat), mean, na.rm=T)%>% + mutate(mn_val = val_use, var = paste0("Mar2Apr_",var))%>%ungroup() + + # tmpdop%>%filter(var==v,year%in%(2022))%>%select(year, basin, var,val_use,val_delta,val_raw) + tmpdop <- stitchTS(dat = tmpdop, maxD = stitchDate_op) + tmpdop <- tmpdop%>%mutate(type = "Pcod indices") + tmpdop%>%filter(var==v,year%in%(2022))%>%select(year, basin, var,val_use,val_delta,val_raw,GCM_scen,sim) + + ggplot(tmpdop)+ + geom_line(aes(x=year, y=mn_val,color=GCM_scen_sim))+ + facet_grid(.~scen) + + if(i==1){ + PCOD_vars <- tmpd + PCOD_vars_op <- tmpdop + }else{ + PCOD_vars <- rbind(PCOD_vars,tmpd) + PCOD_vars_op <- rbind(PCOD_vars_op,tmpdop) + } + + rm(df) + rm(dfop) + rm(tmpd) + rm(tmpdop) + +} + +varlist <- c("pH_bottom5m","pH_depthavg","pH_integrated","pH_surface5m") +i <- 0 +v <- varlist[1] +mIN <- 3:4 + +for(v in varlist){ + + cat("compiling indices : ",v,"\n") + + # get the variable you want: + df <- get_var( typeIN = "monthly", + monthIN = mIN, + plotbasin = c("SEBS"), + plotvar = v, + bcIN = "bias corrected", + CMIPIN = CMIPset, + plothist = T, # ignore the hist runs + removeyr1 = T) # "Remove first year of proj ( burn in)") + + tmpda <- df$dat%>% + group_by(across(all_of(grpby)))%>% + summarize_at(all_of(sumat), mean, na.rm=T)%>% + mutate(mn_val = val_use, var = paste0("Mar2Apr_",var))%>%ungroup() + + tmpd <- stitchTS(dat = tmpda, maxD = stitchDate) + tmpd <- tmpd%>%mutate(type = "Pcod indices") + ggplot(tmpd)+ + geom_line(aes(x=year, y=mn_val,color=GCM_scen_sim))+ + facet_grid(.~scen) + + + PCOD_vars <- rbind(PCOD_vars,tmpd) + + + rm(df) + rm(tmpd) + +} + + + +varlist <- c("temp_surface5m", "temp_bottom5m") +i <- 0 +v <- varlist[1] +mIN <- 6:9 +for(v in varlist){ + cat("compiling indices : ",v,"\n") + + # get the variable you want: + df <- get_var( typeIN = "monthly", + monthIN = mIN, + plotbasin = c("SEBS"), + plotvar = v, + bcIN = "bias corrected", + CMIPIN = CMIPset, + plothist = T, # ignore the hist runs + removeyr1 = T) # "Remove first year of proj ( burn in)") + + tmpda <- df$dat%>% + group_by(across(all_of(grpby)))%>% + summarize_at(all_of(sumat), mean, na.rm=T)%>% + mutate(mn_val=val_use, var = paste0("Jun2Aug_",var))%>%ungroup() + + tmpd <- stitchTS(dat = tmpda, maxD = stitchDate) + tmpd <- tmpd%>%mutate(type = "Pcod indices") + ggplot(tmpd)+ + geom_line(aes(x=year, y=mn_val,color=GCM_scen_sim))+ + facet_grid(.~scen) + + # now for operational hindcasts: + dfop <- get_var_ophind( typeIN = "monthly", + monthIN = mIN, + stitchDateIN = stitchDate, + plotbasin = c("SEBS"), + plotvar = v, + bcIN = "bias corrected", + CMIPIN = CMIPset, + jday_rangeIN = c(0,365), + plothist = T, # ignore the hist runs + removeyr1 = T, + adjIN = "val_delta", + ifmissingyrs = 5, + weekIN = NULL, #"Week" + SeasonIN = NULL, + GCMIN = NULL, + scenIN = NULL, + facet_rowIN = "bc", # choices=c("bc","basin","scen") + facet_colIN = "scen") + #dfop$dat%>%filter(var==v,year%in%(2022))%>%select(year,mo, basin, var,val_use,val_delta,val_raw) + tmpdop <- dfop$dat%>% + group_by(across(all_of(c(grpby,"GCM2","GCM2_scen_sim"))))%>% + summarize_at(all_of(sumat), mean, na.rm=T)%>% + mutate(mn_val=val_use, var = paste0("Jun2Aug_",var))%>%ungroup() +# tmpdop%>%filter(var==v,year%in%(2022))%>%select(year, basin, var,val_use,val_delta,val_raw) + tmpdop <- stitchTS(dat = tmpdop, maxD = stitchDate_op) + tmpdop <- tmpdop%>%mutate(type = "Pcod indices") + tmpdop%>%filter(var==v,year%in%(2022))%>%select(year, basin, var,val_use,val_delta,val_raw,GCM_scen,sim) + + ggplot(tmpdop)+ + geom_line(aes(x=year, y=mn_val,color=GCM_scen_sim))+ + facet_grid(.~scen) + + PCOD_vars <- rbind(PCOD_vars,tmpd) + PCOD_vars_op <- rbind(PCOD_vars_op,tmpdop) + + rm(df) + rm(dfop) + rm(tmpd) + rm(tmpdop) + +} + +if(any(unique(PCOD_vars_op$sim)=="ACLIMregion_B10K-K20P19_CORECFS")) + stop(paste("ACLIMregion_B10K-K20P19_CORECFS in operational hindcast!!!\n ",paste(varlist,"\n"))) + + +PCOD_vars <- PCOD_vars%>%ungroup() +PCOD_vars_op <- PCOD_vars_op%>%ungroup() + + +#Annual Indices +# annual values +varlist <- c("temp_surface5m", "temp_bottom5m") + +# +# for(v in varlist){ +# cat("compiling indices : ",v,"\n") +# # get the variable you want: +# df <- get_var( typeIN = "annual", +# plotbasin = c("SEBS"), +# plotvar = v, +# bcIN = "bias corrected", +# CMIPIN = CMIPset, +# plothist = T, # ignore the hist runs +# removeyr1 = T) # "Remove first year of projection ( burn in)") +# tmpd <- df$dat%>%mutate(season="annual")%>% +# group_by(across(all_of(grpby)))%>% +# summarize_at(all_of(sumat), mean, na.rm=T)%>% +# mutate(mn_val=val_use, var = paste0("annual_",var)) +# +# tmpd <- stitchTS(dat = tmpd, stitchDate) +# tmpd <- tmpd%>%mutate(type = "Pcod indices") +# PCOD_vars <- rbind(PCOD_vars,tmpd) +# rm(df) +# rm(tmpd) +# +# # now for operational hindcasts: +# dfop <- get_var_ophind(stitchDateIN = stitchDate, +# typeIN = "annual", +# plotbasin = c("SEBS"), +# plotvar = v, +# bcIN = "bias corrected", +# CMIPIN = CMIPset, +# plothist = T, # ignore the hist runs +# removeyr1 = T) # "Remove first year of proj ( burn in)") +# +# tmpdop <- dfop$dat%>%mutate(season="annual")%>% +# group_by(across(all_of(c(grpby,"GCM2","GCM2_scen_sim"))))%>% +# summarize_at(all_of(sumat), mean, na.rm=T)%>% +# mutate(mn_val=val_use, var = paste0("annual_",var)) +# +# tmpdop <- stitchTS(dat = tmpdop, stitchDate_op) +# tmpdop <- tmpdop%>%mutate(type = "Pcod indices") +# PCOD_vars_op <- rbind(PCOD_vars_op,tmpdop) +# rm(dfop) +# rm(tmpdop) +# } +# +# if(any(unique(PCOD_vars_op$sim)=="ACLIMregion_B10K-K20P19_CORECFS")) +# stop(paste("ACLIMregion_B10K-K20P19_CORECFS in operational hindcast!!!\n ",paste(varlist,"\n"))) +# +# varlist <- c("pH_bottom5m","pH_depthavg","pH_integrated","pH_surface5m") +# +# for(v in varlist){ +# cat("compiling indices : ",v,"\n") +# # get the variable you want: +# df <- get_var( typeIN = "annual", +# plotbasin = c("SEBS"), +# plotvar = v, +# bcIN = "bias corrected", +# CMIPIN = CMIPset, +# plothist = T, # ignore the hist runs +# removeyr1 = T) # "Remove first year of projection ( burn in)") +# tmpd <- df$dat%>%mutate(season="annual")%>% +# group_by(across(all_of(grpby)))%>% +# summarize_at(all_of(sumat), mean, na.rm=T)%>% +# mutate(mn_val=val_use, var = paste0("annual_",var)) +# +# tmpd <- stitchTS(dat = tmpd, stitchDate) +# tmpd <- tmpd%>%mutate(type = "Pcod indices") +# PCOD_vars <- rbind(PCOD_vars,tmpd) +# rm(df) +# rm(tmpd) +# +# } +# +# if(any(unique(PCOD_vars_op$sim)=="ACLIMregion_B10K-K20P19_CORECFS")) +# stop(paste("ACLIMregion_B10K-K20P19_CORECFS in operational hindcast!!!\n ",paste(varlist,"\n"))) +# + +# fix the caps issue: +PCOD_vars<-PCOD_vars%>% + mutate(GCM = gsub("MIROC","miroc",GCM))%>% + mutate(GCM = gsub("GFDL","gfdl",GCM))%>% + mutate(GCM = gsub("CESM","cesm",GCM))%>% + mutate(GCM_scen = gsub("MIROC","miroc",GCM_scen))%>% + mutate(GCM_scen = gsub("GFDL","gfdl",GCM_scen))%>% + mutate(GCM_scen = gsub("CESM","cesm",GCM_scen))%>% + mutate(GCM_scen_sim = gsub("MIROC","miroc",GCM_scen_sim))%>% + mutate(GCM_scen_sim = gsub("GFDL","gfdl",GCM_scen_sim))%>% + mutate(GCM_scen_sim = gsub("CESM","cesm",GCM_scen_sim))%>% + mutate(GCM = factor(GCM, levels =c("hind","gfdl","cesm","miroc"))) + +# fix the caps issue: +PCOD_vars_op<-PCOD_vars_op%>% + mutate(GCM = gsub("MIROC","miroc",GCM))%>% + mutate(GCM = gsub("GFDL","gfdl",GCM))%>% + mutate(GCM = gsub("CESM","cesm",GCM))%>% + mutate(GCM_scen = gsub("MIROC","miroc",GCM_scen))%>% + mutate(GCM_scen = gsub("GFDL","gfdl",GCM_scen))%>% + mutate(GCM_scen = gsub("CESM","cesm",GCM_scen))%>% + mutate(GCM_scen_sim = gsub("MIROC","miroc",GCM_scen_sim))%>% + mutate(GCM_scen_sim = gsub("GFDL","gfdl",GCM_scen_sim))%>% + mutate(GCM_scen_sim = gsub("CESM","cesm",GCM_scen_sim))%>% + mutate(GCM = factor(GCM, levels =c("hind","gfdl","cesm","miroc"))) + +# save indices +if(!dir.exists("Data/out/PCOD_indices")) + dir.create("Data/out/PCOD_indices") + +save(PCOD_vars, file="Data/out/PCOD_indices/PCOD_vars.Rdata") +write.csv(PCOD_vars, file="Data/out/PCOD_indices/PCOD_vars.csv") +save(PCOD_vars_op, file="Data/out/PCOD_indices/PCOD_vars_op.Rdata") +write.csv(PCOD_vars_op, file="Data/out/PCOD_indices/PCOD_vars_op.csv") + +# recast with vars for each column: +PCOD_vars_wide<- PCOD_vars%>% + group_by(across(all_of(grpby[!grpby%in% + c("units","long_name","lognorm")])))%>% + summarize_at(all_of(c("val_use")), mean, na.rm=T)%>% + tidyr::pivot_wider(names_from = "var", values_from = "val_use") + +# reorder to put annual indices at the end +cc <- colnames(PCOD_vars_wide) +cc <- cc[-grep("annual",cc)] +PCOD_vars_wide<- PCOD_vars_wide%>%relocate(all_of(cc)) + +PCOD_vars2<- PCOD_vars_wide%>% + tidyr::pivot_longer(cols = c(unique(PCOD_vars$var)), + names_to = "var", + values_to = "val_use")%>%mutate(mn_val=val_use)%>%ungroup() + +# recast with vars for each column: +PCOD_vars_wide_op<- PCOD_vars_op%>% + group_by(across(all_of(grpby[!grpby%in% + c("units","long_name","lognorm")])))%>% + summarize_at(all_of(c("val_use")), mean, na.rm=T)%>% + tidyr::pivot_wider(names_from = "var", values_from = "val_use") + +# PCOD_vars_wide_op$NE_winds <- +# getNE_winds(vNorth=PCOD_vars_wide_op$vNorth_surface5m, +# uEast=PCOD_vars_wide_op$uEast_surface5m) + +# reorder to put annual indices at the end +cc <- colnames(PCOD_vars_wide_op) +cc <- cc[-grep("annual",cc)] +PCOD_vars_wide_op<- PCOD_vars_wide_op%>% + relocate(all_of(cc)) + + +PCOD_vars2_op<- PCOD_vars_wide_op%>% + tidyr::pivot_longer(cols = c(unique(PCOD_vars_op$var)), + names_to = "var", + values_to = "val_use")%>% + mutate(mn_val=val_use)%>%ungroup() + +save(PCOD_vars_wide, file="Data/out/PCOD_indices/PCOD_vars_wide.Rdata") +write.csv(PCOD_vars_wide, file="Data/out/PCOD_indices/PCOD_vars_wide.csv") +save(PCOD_vars_wide_op, file="Data/out/PCOD_indices/PCOD_vars_wide_op.Rdata") +write.csv(PCOD_vars_wide_op, file="Data/out/PCOD_indices/PCOD_vars_wide_op.csv") + + +tt <- PCOD_vars_wide_op%>%filter(scen=="rcp45",year ==1976) +unique(tt$sim) + +tt2 <- PCOD_vars_op%>%filter(scen=="rcp45",year ==1976,var=="fracbelow1") +unique(tt2$sim) + +tt1 <- PCOD_vars_wide%>%filter(scen=="rcp45",year ==1976) +unique(tt1$sim) + +tt12 <- PCOD_vars%>%filter(scen=="rcp45",year ==1976,var=="fracbelow1") +unique(tt12$sim) + + +sclr <- 2 +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_vars.jpg"), + width=6*sclr, height=9*sclr, units="in", res = 350) +print(plotTS(PCOD_vars )+labs(title="Pcod indices, with ACLIM hind")) +dev.off() + + + +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_vars_byGCM.jpg"), + width=6*sclr, height=9*sclr, units="in", res = 350) +print(plotTS(PCOD_vars )+ + labs(title="Pcod indices")+facet_grid(var~GCM,scales='free_y')) +dev.off() + + +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_vars_op_byGCM.jpg"), + width=6*sclr, height=9*sclr, units="in", res = 350) +print(plotTS(PCOD_vars_op )+ + labs(title="Pcod indices, with operational hind")+facet_grid(var~GCM,scales='free_y')) +dev.off() + +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_vars_op.jpg"), + width=6*sclr, height=9*sclr, units="in", res = 350) +print(plotTS(PCOD_vars_op )+labs(title="Pcod indices, with operational hind")) +dev.off() + + +plotTS(PCOD_vars_op%>%filter(var=="Mar2Apr_temp_bottom5m"), plotvalIN = "val_raw" )+ + coord_cartesian(ylim=c(7.5,8.1)) + + +pp2 <- plotTS(PCOD_vars2%>%mutate(units="",mnDate=year) )+ + facet_wrap(.~var,scales="free")+ylab("val")+ + labs(title = "ACLIM hindcast +projections") +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_indices.jpg"), + width=10,height=8,units="in",res=350) +print(pp2) +dev.off() + + +pp2 <- plotTS(PCOD_vars2_op%>%mutate(units="",mnDate=year) )+ + facet_wrap(.~var,scales="free")+ylab("val")+ + labs(title = "operational hindcast + projections") +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_indices_op.jpg"), + width=10,height=8,units="in",res=350) +print(pp2) +dev.off() + +# +# pp<- ggplot(PCOD_vars_wide)+ +# geom_line(aes(x=year,y=NE_winds,color= GCM_scen,linetype = basin), +# alpha = 0.2,show.legend = FALSE)+ +# geom_smooth(aes(x=year,y=NE_winds,color= GCM_scen, +# fill=GCM_scen,linetype = basin), +# alpha=0.1,method="loess",formula='y ~ x',span = .5)+ +# theme_minimal() + +# labs(x="Year", +# y="NE_winds (m s^-1)", +# subtitle = "", +# title = "NE_winds, ACLIM hindcast", +# legend = "")+ +# scale_color_discrete()+ facet_grid(scen~bc) +# +# pp +# +# jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_indices2.jpg"), +# width=8,height=7,units="in",res=350) +# print(pp) +# dev.off() + +# +# pp<- ggplot(PCOD_vars_wide_op)+ +# geom_line(aes(x=year,y=NE_winds,color= GCM_scen,linetype = basin), +# alpha = 0.2,show.legend = FALSE)+ +# geom_smooth(aes(x=year,y=NE_winds,color= GCM_scen, +# fill=GCM_scen,linetype = basin), +# alpha=0.1,method="loess",formula='y ~ x',span = .5)+ +# theme_minimal() + +# labs(x="Year", +# y="NE_winds (m s^-1)", +# subtitle = "", +# title = "NE_winds, operational hindcast", +# legend = "")+ +# scale_color_discrete()+ facet_grid(scen~bc) +# +# pp +# +# jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_indices2_op.jpg"), +# width=8,height=7,units="in",res=350) +# print(pp) +# dev.off() + + +pp<- ggplot(PCOD_vars_wide_op)+ + geom_hline(yintercept = 0,color="gray")+ + geom_line(aes(x=year,y=Mar2Apr_temp_bottom5m,color= GCM_scen,linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(aes(x=year,y=Mar2Apr_temp_bottom5m,color= GCM_scen, + fill=GCM_scen,linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Year", + subtitle = "", + title = "Mar2Apr_temp_bottom5m, operational hindcast", + legend = "")+ + scale_color_discrete()+ facet_grid(scen~bc) + +pp +jpeg(filename = file.path("Data/out/PCOD_indices/PCOD_indices2_op_Mar2Apr_temp_bottom5m.jpg"), + width=8,height=7,units="in",res=350) +print(pp) +dev.off() + diff --git a/R/sub_scripts/make_proj.R b/R/sub_scripts/make_proj.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_proj_C.R b/R/sub_scripts/make_proj_C.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_proj_new.R b/R/sub_scripts/make_proj_new.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/make_salmon_indices.R b/R/sub_scripts/make_salmon_indices.R new file mode 100644 index 0000000..0682680 --- /dev/null +++ b/R/sub_scripts/make_salmon_indices.R @@ -0,0 +1,417 @@ +#' +#' +#' make_salmon_indices.R +#' K. Holsman +#' 2024 +#' generate indices for E. Yasumiishi +#' +#' + +# +# 1. temperature_surface5m for months 9:10 and strata 70 & 71 +# 2. NW ditrrection for months 5:6 and strata 71 +# 3. temperature_surface5m for months 7:10 and strata 90,61,62 + +# load ACLIM packages and functions +rm(list=ls()) +suppressMessages(source("R/make.R")) + +cat("\n\nsetting things up\n") + +# set up paths +outfldr <- "Data/out/salmon_indices" +if(!dir.exists(outfldr)) dir.create(outfldr) + +strata_set <- list(c(70,71),c(71),c(90,61,62)) +mo_set <- list(c(9,10),c(5,6),7:10) +var_set <- list(c("temp_surface5m"),c("NEwinds"),"temp_surface5m") +names(var_set) <- c("fall_SST_70_71","Winds_71","7through10_SST_90_61_62") + +NEWinds <- c(0,1,0) + +# PCOD_vars_wide_op$NE_winds <- +# getNE_winds(vNorth=PCOD_vars_wide_op$vNorth_surface5m, +# uEast=PCOD_vars_wide_op$uEast_surface5m) + +#varlist <- c("pH_bottom5m","pH_depthavg","pH_integrated","pH_surface5m","temp_surface5m", "temp_bottom5m") +CMIPset <- c("K20P19_CMIP6","K20P19_CMIP5") +stitchDate_op <- "2021-12-30" #last operational hindcast date + +# preview possible variables +load(file = "Data/out/weekly_vars.Rdata") +load(file = "Data/out/srvy_vars.Rdata") +# save setup for plotting +save(list=ls(),file=file.path(outfldr,"salmon_indices_setup.Rdata")) + + +# ------------------------------------ +# Hindcast First +# ------------------------------------ +cat("running hindcast summary\n") + +load("Data/out/K20P19_CMIP6/BC_ACLIMregion/ACLIMregion_B10K-K20P19_CORECFS_BC_hind.Rdata") +rm_cols <- c( "lognorm","type", "val_raw","mn_val" ,"sd_val", "n_val", + "sdVal_hind_mo", "sdVal_hind_yr") + +select_list <- c("sim","year","var_salmon","basin","strata","strata_area_km2","units", + "season","mo","wk","jday","mnDate","qry_date","sim_type","mday", + "val_use","mnVal_hind","sdVal_hind","nVal_hind","seVal_hind","val_raw","var") + +for(i in 1:length(strata_set)){ + + if(var_set[[i]]=="NEwinds"){ + my_vars2 <- function(IN) select_list[select_list%in%names(IN)] + valset <- c("val_use","mnVal_hind","sdVal_hind","nVal_hind", "seVal_hind","val_raw") + + hindDat_weekly_strata_tmp <- hind%>% + filter(strata%in%strata_set[[i]], + mo%in%mo_set[[i]], + var%in%c("vNorth_surface5m","uEast_surface5m"))%>% + mutate(val_use = val_raw, units = "meter second-1")%>% + rowwise()%>%mutate(mday=strptime(mnDate,format = "%Y-%m-%d")$mday)%>%ungroup()%>% + mutate(var_salmon = names(var_set)[i]) + + # remove all the extra stuff: + hindDat_weekly_strata_tmp <- hindDat_weekly_strata_tmp%>%select(my_vars2(hindDat_weekly_strata_tmp)) + + hindDat_weekly_strata_tmp <- hindDat_weekly_strata_tmp%>% + pivot_wider(names_from = var, + values_from = all_of(valset))%>% + ungroup()%>%data.frame() + + for(k in 1:length(valset)){ + + eval(parse(text = paste0(" hindDat_weekly_strata_tmp <- hindDat_weekly_strata_tmp%>% + rowwise()%>%mutate(",valset[k], "= getNE_winds + (vNorth = ",valset[k],"_vNorth_surface5m, + uEast = ",valset[k],"_uEast_surface5m))%>% + select(-",valset[k],"_vNorth_surface5m,-", + valset[k],"_uEast_surface5m)%>% + ungroup()%>%data.frame()") )) + } + hindDat_weekly_strata_tmp <- hindDat_weekly_strata_tmp%>%mutate(var = "NEwinds") + + + }else{ + my_vars <- function(IN) select_list[select_list%in%names(IN)] + + hindDat_weekly_strata_tmp <- hind%>% + filter(strata%in%strata_set[[i]], + mo%in%mo_set[[i]], + var%in%var_set[[i]])%>% + mutate(val_use = val_raw)%>% + rowwise()%>%mutate(mday=strptime(mnDate,format = "%Y-%m-%d")$mday)%>%ungroup()%>% + mutate(var_salmon = names(var_set)[i]) + + # remove all the extra stuff: + hindDat_weekly_strata_tmp <- hindDat_weekly_strata_tmp%>%select(my_vars(hindDat_weekly_strata_tmp)) + + + } + + grp_names <- names(hindDat_weekly_strata_tmp) + nms3 <- grp_names[!grp_names%in%rm_cols] + + hindDat_weekly_strata_tmp <-hindDat_weekly_strata_tmp%>% + select(!!!syms(nms3))%>% + relocate(val_use, .before = mnVal_hind)%>% + relocate(var_salmon, .before = var)%>% + ungroup()%>%data.frame() + + grp_names <- names(hindDat_weekly_strata_tmp)[!names(hindDat_weekly_strata_tmp)%in%c("strata","strata_area_km2","wk","season","basin","mday")] + nms <- c("val_use","jday","mnDate", + "mnVal_hind","sdVal_hind","nVal_hind", + "seVal_hind") + + nms2 <- grp_names[!grp_names%in%nms] + nms3 <- grp_names[!grp_names%in%rm_cols] + + hindDat_monthly_tmp <- hindDat_weekly_strata_tmp%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>% + select(!!!syms(nms3))%>% + relocate(val_use, .before = mnVal_hind)%>% + relocate(var_salmon, .before = var)%>% + ungroup()%>%data.frame() + + + grp_names <- names(hindDat_weekly_strata_tmp)[!names(hindDat_weekly_strata_tmp)%in%c("strata","lognorm","type", + "strata_area_km2", + "mo","wk","season","basin","mday")] + nms <- c("val_use","jday","mnDate", + "mnVal_hind","sdVal_hind","nVal_hind", + "seVal_hind") + + nms2 <- grp_names[!grp_names%in%nms] + nms3 <- grp_names[!grp_names%in%rm_cols] + + hindDat_avg_tmp <- hindDat_weekly_strata_tmp%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>% + select(!!!syms(nms3))%>% + relocate(val_use, .before = mnVal_hind)%>% + relocate(var_salmon, .before = var)%>% + ungroup()%>%data.frame() + + + if(i==1){ + hindDat_avg <- hindDat_avg_tmp + hindDat_monthly <- hindDat_monthly_tmp + hindDat_weekly_strata <- hindDat_weekly_strata_tmp + + }else{ + hindDat_avg <- rbind(hindDat_avg,hindDat_avg_tmp) + hindDat_monthly <- rbind(hindDat_monthly,hindDat_monthly_tmp) + hindDat_weekly_strata <- rbind(hindDat_weekly_strata,hindDat_weekly_strata_tmp) + } + rm(hindDat_avg_tmp) + rm(hindDat_monthly_tmp) + rm(hindDat_weekly_strata_tmp) + +} + + + + # output the data as Rdata and CSV + write_csv(hindDat_weekly_strata, file.path(outfldr,"salmon_hindDat_weekly_strata.csv")) + save(hindDat_weekly_strata, file=file.path(outfldr,"salmon_hindDat_weekly_stratat.Rdata")) + + write_csv(hindDat_monthly, file.path(outfldr,"salmon_hindDat_monthly.csv")) + save(hindDat_monthly, file=file.path(outfldr,"salmon_hindDat_monthly.Rdata")) + + write_csv(hindDat_avg, file.path(outfldr,"salmon_hindDat.csv")) + save(hindDat_avg, file=file.path(outfldr,"salmon_hindDat.Rdata")) + + + #rm(hindDat_weekly_strata) + rm(hindDat_monthly) + rm(hindDat_avg) + + +# ------------------------------------ +# Projections Next +# ------------------------------------ +select_list <- unique(c(names(hindDat_weekly_strata),"long_name","qry_date","station_id", + "sim_type","GCM","RCP","mod", "CMIP", "mnVal_hind","sdVal_hind","val_delta","val_raw")) + my_vars <- function(IN) select_list[select_list%in%names(IN)] + + jj <- 0 + +CMIP <- "CMIP6" +ii <- 1 +i <- 1 + +for (CMIP in c("CMIP6","CMIP5")){ + + if(CMIP == "CMIP6"){ + + fl_base_srv <- "ACLIMsurveyrep_B10K-K20P19_CMIP6_" + fl_path_srv <- "Data/out/K20P19_CMIP6/BC_ACLIMsurveyrep" + + fl_base_reg <- "ACLIMregion_B10K-K20P19_CMIP6_" + fl_path_reg <- "Data/out/K20P19_CMIP6/BC_ACLIMregion" + + + # CMIP6 + ssps <- c("ssp126","ssp585") + gcms <- c("cesm","miroc","gfdl") + set <- expand.grid(gcms,ssps,stringsAsFactors = F) + + } + + if(CMIP == "CMIP5"){ + #now get monthly + fl_base_srv <- "ACLIMsurveyrep_B10K-K20P19_CMIP5_" + fl_path_srv <- "Data/out/K20P19_CMIP5/BC_ACLIMsurveyrep" + + fl_base_reg <- "ACLIMregion_B10K-K20P19_CMIP5_" + fl_path_reg <- "Data/out/K20P19_CMIP5/BC_ACLIMregion" + + # now for CMIP5 + gcms <- c("CESM","MIROC","GFDL") + ssps <- c("rcp45","rcp85") + set <- expand.grid(gcms,ssps,stringsAsFactors = F) + + } + + + for(i in 1:dim(set)[1]){ + fl <- paste0(fl_base_reg,set[i,1],"_",set[i,2],"_BC_fut.Rdata") + load(file.path(fl_path_reg,fl)) + + for(ii in 1:length(strata_set)){ + cat(paste("running proj summary for",CMIP,": strata_set",names(var_set)[ii],set[i,1],set[i,2],"\n")) + + + fut$mo <- as.numeric(substr(fut$mnDate,6,7)) + fut$mday <- as.numeric(substr(fut$mnDate,9,10)) + + if(var_set[[ii]]=="NEwinds"){ + + valset <- c("val_use","mnVal_hind","sdVal_hind","val_raw","val_delta") + # PCOD_vars_wide_op$NE_winds <- + # getNE_winds(vNorth=PCOD_vars_wide_op$vNorth_surface5m, + # uEast=PCOD_vars_wide_op$uEast_surface5m) + + futDat_weekly_strata_tmp <- fut%>% + filter(strata%in%strata_set[[ii]], + mo%in%mo_set[[ii]], + var%in%c("vNorth_surface5m","uEast_surface5m"))%>% + mutate(val_use = val_delta,units = "meter second-1" )%>% + mutate(var_salmon = names(var_set)[ii])%>% + ungroup()%>%data.frame() + + # remove all the extra stuff: + futDat_weekly_strata_tmp <- futDat_weekly_strata_tmp%>%select(my_vars(futDat_weekly_strata_tmp)) + + futDat_weekly_strata_tmp <- futDat_weekly_strata_tmp%>% + pivot_wider(names_from = var, + values_from = all_of(valset))%>% + ungroup()%>%data.frame() + + for(k in 1:length(valset)){ + + eval(parse(text = paste0(" futDat_weekly_strata_tmp <- futDat_weekly_strata_tmp%>% + rowwise()%>%mutate(",valset[k], "= getNE_winds + (vNorth = ",valset[k],"_vNorth_surface5m, + uEast = ",valset[k],"_uEast_surface5m))%>% + select(-",valset[k],"_vNorth_surface5m,-", + valset[k],"_uEast_surface5m)%>% + ungroup()%>%data.frame()") )) + } + futDat_weekly_strata_tmp <- futDat_weekly_strata_tmp%>%mutate(var = "NEwinds") + + + }else{ + + futDat_weekly_strata_tmp <- fut%>% + filter(strata%in%strata_set[[ii]], + mo%in%mo_set[[ii]], + var%in%var_set[[ii]])%>% + mutate(val_use = val_delta)%>% + mutate(var_salmon = names(var_set)[ii])%>% + ungroup()%>%data.frame() + + # remove all the extra stuff: + futDat_weekly_strata_tmp <- futDat_weekly_strata_tmp%>%select(my_vars(futDat_weekly_strata_tmp)) + + } + + + grp_names <- names(futDat_weekly_strata_tmp)[!names(futDat_weekly_strata_tmp)%in%c("strata","strata_area_km2","wk","season","basin","mday")] + nms <- c("val_use","jday","mnDate", + "mnVal_hind","sdVal_hind","val_raw","val_delta") + + nms2 <- grp_names[!grp_names%in%nms] + + futDat_monthly_tmp <- futDat_weekly_strata_tmp%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>% + relocate(val_use, .before = mnVal_hind)%>% + relocate(var_salmon, .before = var)%>% + ungroup()%>%data.frame() + + + grp_names <- names(futDat_weekly_strata_tmp)[!names(futDat_weekly_strata_tmp)%in%c("strata","lognorm","type", + "strata_area_km2", + "mo","wk","season","basin","mday")] + nms <- c("val_use","jday","mnDate", + "mnVal_hind","sdVal_hind","val_raw","val_delta") + + nms2 <- grp_names[!grp_names%in%nms] + + futDat_avg_tmp <- futDat_weekly_strata_tmp%>% + select(!!!syms(grp_names))%>%group_by(!!!syms(nms2))%>% + summarize_at(nms,mean,na.rm=T)%>% + relocate(val_use, .before = mnVal_hind)%>% + relocate(var_salmon, .before = var)%>% + ungroup()%>%data.frame() + + jj <- jj + 1 + if(jj==1){ + futDat_avg <- futDat_avg_tmp + futDat_monthly <- futDat_monthly_tmp + futDat_weekly_strata <- futDat_weekly_strata_tmp + + }else{ + futDat_avg <- rbind(futDat_avg,futDat_avg_tmp) + futDat_monthly <- rbind(futDat_monthly,futDat_monthly_tmp) + futDat_weekly_strata <- rbind(futDat_weekly_strata,futDat_weekly_strata_tmp) + } + + rm(futDat_avg_tmp) + rm(futDat_monthly_tmp) + rm(futDat_weekly_strata_tmp) + + + } + rm(fut) + } +} + + fix_caps <- function (dataset){ + out <- dataset%>% + mutate(GCM = gsub("MIROC","miroc",GCM))%>% + mutate(GCM = gsub("GFDL","gfdl",GCM))%>% + mutate(GCM = gsub("CESM","cesm",GCM))%>% + mutate(sim = gsub("MIROC","miroc",sim))%>% + mutate(sim = gsub("GFDL","gfdl",sim))%>% + mutate(sim = gsub("CESM","cesm",sim))%>% + mutate(GCM = factor(GCM, levels =c("hind","gfdl","cesm","miroc")))%>% + mutate(GCM_scen = paste0(GCM,"_",RCP))%>%data.frame() + return(out) + } + + cat("saving outputs\n") + + # fix the caps issue: + futDat_monthly <- fix_caps(futDat_monthly) + futDat_weekly_strata <- fix_caps(futDat_weekly_strata) + futDat_avg <- fix_caps(futDat_avg) + + # output the data as Rdata and CSV + write_csv(futDat_monthly, file.path(outfldr,"futDat_monthly.csv")) + save(futDat_monthly, file=file.path(outfldr,"futDat_monthly.Rdata")) + + # output the data as Rdata and CSV + write_csv(futDat_weekly_strata, file.path(outfldr,"futDat_weekly_strata.csv")) + save(futDat_weekly_strata, file=file.path(outfldr,"futDat_weekly_strata.Rdata")) + + # output the data as Rdata and CSV + write_csv(futDat_avg, file.path(outfldr,"futDat_avg.csv")) + save(futDat_avg, file=file.path(outfldr,"futDat_avg.Rdata")) + +### ----- PREV + + +if (1 ==10){ + # loads packages, data, setup, etc. + suppressMessages( suppressWarnings(source("R/make.R"))) + + # get the variable you want: + df <- get_var( typeIN = "monthly", + monthIN = 9:10, + plotvar = "temp_bottom5m", + bcIN = c("raw","bias corrected"), + CMIPIN = "K20P19_CMIP6", + plothist = T, # ignore the hist runs + removeyr1 = T) # "Remove first year of projection ( burn in)") + + df$plot+coord_cartesian(ylim = c(0, 7)) + head(df$dat) + + # concat the hind and fut runs by removing years from projection + stitchDate <- "2020-12-30" + + newdat <- stitchTS(dat = df$dat, + maxD = stitchDate) + + # newdat has the full set of data + # select miroc_ssp126 + head(newdat%>%dplyr::filter(GCM_scen==paste0(GCMs[1],"_",scens[1]))) + tail(newdat%>%dplyr::filter(GCM_scen==paste0(GCMs[1],"_",scens[1]))) + + pp <- plotTS(newdat ) + pp + +} \ No newline at end of file diff --git a/R/sub_scripts/older_scripts/section5_chunk4Andy.R b/R/sub_scripts/older_scripts/section5_chunk4Andy.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/plotACLIM2_indices.R b/R/sub_scripts/plotACLIM2_indices.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/plot_BC_station.R b/R/sub_scripts/plot_BC_station.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/plot_BC_stratawk.R b/R/sub_scripts/plot_BC_stratawk.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/plot_NEBSnSEBS.R b/R/sub_scripts/plot_NEBSnSEBS.R old mode 100644 new mode 100755 index 879b6d8..dfbacf0 --- a/R/sub_scripts/plot_NEBSnSEBS.R +++ b/R/sub_scripts/plot_NEBSnSEBS.R @@ -2,6 +2,8 @@ #' #'plot_NEBSnSEBS.R #' +#' + fldrout <- "Figs/prod_plots" if(dir.exists(fldrout)) dir.remove(fldrout) @@ -18,6 +20,7 @@ vardef <- vardef%>%filter(name%in%unique(ACLIM_weekly_hind$var)) + i <-grep("temp_bottom5m",vardef$name) w<-9; h<-6; dpi <-350 w2<-6; h2<-4 @@ -50,9 +53,10 @@ rm(tmp2) rm(tmp) - tmp3 <- suppressMessages(plotNEBS_productivity_futBC(datIN=ACLIM_weekly_hind,alphaIN = .4, - datIN_fut=ACLIM_weekly_fut, - varlistIN=vardef[i,])) + tmp3 <- suppressMessages(plotNEBS_productivity_futBC(datIN = ACLIM_weekly_hind, + alphaIN = .4, + datIN_fut = ACLIM_weekly_fut%>%mutate(scen=paste0(RCP,"_",GCM)), + varlistIN = vardef[i,])) jpeg(file.path(fldrout,paste0(vv,"_futBC.jpg")),width = w*sclr, height=h*sclr, res=dpi, units="in") print(tmp3$p2) diff --git a/R/sub_scripts/plot_RKC_Indices_Andre.R b/R/sub_scripts/plot_RKC_Indices_Andre.R new file mode 100644 index 0000000..1ab66dd --- /dev/null +++ b/R/sub_scripts/plot_RKC_Indices_Andre.R @@ -0,0 +1,269 @@ +#' +#' +#' +#'plot_RKC_Indices_Andre +#'ALCIM3 K. Holsman +#'2024 +#' + +# rmlist=ls() +message("Set outfldr to your local folder with the RKC indiceies \n e.g., /Users/KKH/Documents/GitHub_mac/ACLIM2/Data/out/RKC_indices") +outfldr <- "Data/out/RKC_indices" + +# ------------------------------------ +# Load packages +# ------------------------------------ +load(file.path(outfldr,"RKC_indices_setup.Rdata")) +library(ggplot2) +library(dplyr) +library(RColorBrewer) +# +# # load ACLIM packages and functions +# suppressMessages(source("R/make.R")) + +# ------------------------------------ +# Load Data +# ------------------------------------ + + + +load(file.path(outfldr,"AVG_hind_TC_small_males.Rdata")) +load(file.path(outfldr,"AVG_hind_RKC_immature_males.Rdata")) +load(file.path(outfldr,"AVG_fut_TC_small_males.Rdata")) +load(file.path(outfldr,"AVG_fut_RKC_immature_males.Rdata")) + +load(file.path(outfldr,"fut_TC_small_males_monthly.Rdata")) +load(file.path(outfldr,"fut_TC_small_males_monthly_avg.Rdata")) +load(file.path(outfldr,"fut_RKC_immature_males_monthly.Rdata")) +load(file.path(outfldr,"fut_RKC_immature_males_monthly_avg.Rdata")) + +load(file.path(outfldr,"hind_TC_small_males_monthly.Rdata")) +load(file.path(outfldr,"hind_TC_small_males_monthly_avg.Rdata")) +load(file.path(outfldr,"hind_RKC_immature_males_monthly.Rdata")) +load(file.path(outfldr,"hind_RKC_immature_males_monthly_avg.Rdata")) + +load(file.path(outfldr,"hind_TC_small_males.Rdata")) +load(file.path(outfldr,"hind_RKC_immature_males.Rdata")) +load(file.path(outfldr,"fut_TC_small_males.Rdata")) +load(file.path(outfldr,"fut_RKC_immature_males.Rdata")) + +# ------------------------------------ +# Plot results +# ------------------------------------ + + # Set color palette + # ------------------------------------ + display.brewer.all() + + GCM_scens <- c("hind",unique(AVG_fut_RKC_immature_males$GCM_scen)) + GCM_scens <- GCM_scens[ + c(1, + grep("ssp126",GCM_scens), + grep("rcp45",GCM_scens), + grep("rcp85",GCM_scens), + grep("ssp585",GCM_scens))] + + cc <- brewer.pal(n = 11, name ="Spectral") [c(10,9,4,3)] + + nn <- length(grep("ssp126",GCM_scens)) + c1 <- rep(cc[1],nn) + nn <- length(grep("rcp45",GCM_scens)) + c2 <- rep(cc[2],nn) + nn <- length(grep("rcp85",GCM_scens)) + c3 <- rep(cc[3],nn) + nn <- length(grep("ssp585",GCM_scens)) + c4 <- rep(cc[4],nn) + + cols <- c("gray",c1,c2,c3,c4) + valuesIN <- cols + names(valuesIN) <- GCM_scens + + # Plot AVG across subset stations: + # -------------------------------------- + AVGfut_RKC <- AVG_fut_RKC_immature_males + plot_stationAVG <- plotTS(AVGfut_RKC%>% + mutate(mn_val = mn_val_use, + scen = GCM, + GCM_scen = factor(GCM_scen,levels = GCM_scens)))+ + labs(title="average variables (RKC_immature_males) ")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + plot_stationAVG + + # Plot Indiv station: + # -------------------------------------- + stN <- 3 + fut_RKC <- fut_RKC_immature_males + station_set <- unique(fut_RKC$station_id) + + plot_station <- plotTS(fut_RKC%>%mutate(mn_val=val_use, + scen=GCM, + GCM_scen = factor(GCM_scen,levels = GCM_scens))%>% + filter(station_id==station_set[stN]) )+ + labs(title=paste("Station: ", station_set[stN]))+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + plot_station + + +# ------------------------------------ +# Plot restults with hindcast +# ------------------------------------ + + # Plot AVG across subset stations: + # -------------------------------------- + stN <- 3 # for further down + vlN <- 1:length(varlist) + + + AVGfut_RKC <- AVG_fut_RKC_immature_males%>%mutate(mn_val = mn_val_use, + scen = GCM, + GCM_scen = factor(GCM_scen,levels = GCM_scens)) + AVGhind_RKC <- AVG_hind_RKC_immature_males%>%mutate(mn_val = mn_val_use, + scen = "hind", + GCM_scen = factor("hind",levels = GCM_scens)) + + hindfut_avg <- ggplot( )+ + geom_line(data=AVGfut_RKC%>%mutate(scen=GCM)%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=mn_val_use,color= GCM_scen,linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=AVGfut_RKC%>%mutate(scen=GCM)%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=mn_val_use,color= GCM_scen, + fill=GCM_scen,linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+facet_grid(var~GCM,scales="free_y")+ + + geom_line(data=AVGhind_RKC%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=mn_val_use,color="hind",linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=AVGhind_RKC%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=mn_val_use,color= "hind", + fill="hind",linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Year", + subtitle = "", + title = "cross-station average (RKC_immature_males)", + legend = "")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + + hindfut_avg + + + + # Plot Indiv station: + # -------------------------------------- + hind_RKC <- hind_RKC_immature_males%>%mutate(mn_val = val_use, + scen = "hind", + GCM_scen = factor("hind",levels = GCM_scens)) + fut_RKC <- fut_RKC_immature_males%>%mutate(mn_val = val_use, + scen = GCM, + GCM_scen = factor(GCM_scen,levels = GCM_scens)) + + + hindfut_station <- ggplot( )+ + geom_line(data=fut_RKC%>%mutate(mn_val=val_use,scen=GCM)%>%filter(station_id==station_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen,linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=fut_RKC%>%mutate(mn_val=val_use,scen=GCM)%>%filter(station_id==station_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen, + fill=GCM_scen,linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+facet_grid(var~GCM,scales="free_y")+ + + geom_line(data=hind_RKC%>%filter(station_id%in%station_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color="hind",linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=hind_RKC%>%filter(station_id==station_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= "hind", + fill="hind",linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Year", + subtitle = "", + title = paste("Station:", station_set[stN]), + legend = "")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + + hindfut_station + + + # plot monthly indices + # ------------------------------------ + + # ggplot(hind_TC_small_males_monthly)+ + # geom_line(aes(x= mnDate,y = val_use,color=var))+facet_grid(var~strata,scales="free_y") + # + stratalist<-unique( fut_TC_small_males_monthly$strata) + sin <- 1 + hindfut_station_monthly <- ggplot()+ + geom_line(data=fut_TC_small_males_monthly%>%mutate(mn_val=val_use,scen=GCM)%>% + filter(strata==stratalist[sin],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen,linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=fut_TC_small_males_monthly%>%mutate(mn_val=val_use,scen=GCM)%>% + filter(strata==stratalist[sin],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen, + fill=GCM_scen,linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + facet_grid(var~GCM,scales="free_y")+ + geom_line(data=hind_TC_small_males_monthly%>%filter(strata==stratalist[sin],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color="hind",linetype = basin), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=hind_TC_small_males_monthly%>%filter(strata==stratalist[sin],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= "hind", + fill="hind",linetype = basin), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Year", + subtitle = "", + title = paste("Monthly by strata:",stratalist[sin] ), + legend = "")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + + hindfut_station_monthly + + + # Save plots + # ------------------------------------ + + sclr <- 1.2 + jpeg(filename = file.path(outfldr,"Station_Averaged_RKC_vars.jpg"), + width=8*sclr, height=7*sclr, units="in", res = 350) + print(plot_stationAVG) + dev.off() + + jpeg(filename = file.path(outfldr,paste0("RKC_vars_",station_set[stN],".jpg")), + width=8*sclr, height=7*sclr, units="in", res = 350) + print(plot_station) + dev.off() + + + sclr <- 1.2 + jpeg(filename = file.path(outfldr,"RKC_indices_station_W_hind.jpg"), + width=8*sclr,height=7*sclr,units="in",res=350) + print(hindfut_station) + dev.off() + + jpeg(filename = file.path(outfldr,"RKC_indices_avg_W_hind.jpg"), + width=8*sclr,height=7*sclr,units="in",res=350) + print(hindfut_avg) + dev.off() + + jpeg(filename = file.path(outfldr,"TC_small_males_monthly.jpg"), + width=8*sclr,height=7*sclr,units="in",res=350) + print(hindfut_station_monthly) + dev.off() + + \ No newline at end of file diff --git a/R/sub_scripts/plot_salmon_indices.R b/R/sub_scripts/plot_salmon_indices.R new file mode 100644 index 0000000..00d6821 --- /dev/null +++ b/R/sub_scripts/plot_salmon_indices.R @@ -0,0 +1,213 @@ +#' +#' +#' +#'plot_salmon_Indices +#'ALCIM3 K. Holsman +#'2024 +#' + +# rmlist=ls() +message("Set outfldr to your local folder with the salmon indiceies \n e.g., /Users/KKH/Documents/GitHub_mac/ACLIM2/Data/out/salmon_indices") +outfldr <- "Data/out/salmon_indices" + +# ------------------------------------ +# Load packages +# ------------------------------------ +load(file.path(outfldr,"salmon_indices_setup.Rdata")) +library(ggplot2) +library(dplyr) +library(RColorBrewer) +# +# # load ACLIM packages and functions +# suppressMessages(source("R/make.R")) + +# ------------------------------------ +# Load Data +# ------------------------------------ + +dirlist <- dir(outfldr) +dirlist <- dirlist[grep("Dat",dirlist)] +dirlist <- dirlist[grep("Rdata",dirlist)] + +for(d in dirlist) + load(file.path(outfldr,d)) + +# ------------------------------------ +# Plot results +# ------------------------------------ + +# Set color palette +# ------------------------------------ +display.brewer.all() + +GCM_scens <- c("hind",unique(futDat_weekly_strata$GCM_scen)) +GCM_scens <- GCM_scens[ + c(1, + grep("ssp126",GCM_scens), + grep("rcp45",GCM_scens), + grep("rcp85",GCM_scens), + grep("ssp585",GCM_scens))] + +cc <- brewer.pal(n = 11, name ="Spectral") [c(10,9,4,3)] + +nn <- length(grep("ssp126",GCM_scens)) +c1 <- rep(cc[1],nn) +nn <- length(grep("rcp45",GCM_scens)) +c2 <- rep(cc[2],nn) +nn <- length(grep("rcp85",GCM_scens)) +c3 <- rep(cc[3],nn) +nn <- length(grep("ssp585",GCM_scens)) +c4 <- rep(cc[4],nn) + +cols <- c("gray",c1,c2,c3,c4) +valuesIN <- cols +names(valuesIN) <- GCM_scens + +# Plot AVG across subset stations: +# -------------------------------------- +var_salmons <- unique(futDat_avg$var_salmon) + +AVGfut <- futDat_avg +plot_stationAVG <- plotTS(AVGfut%>% + mutate(mn_val = val_use, + scen = RCP, + basin = var_salmon, + GCM_scen = factor(GCM_scen,levels = GCM_scens)))+ + labs(title="average variables (RKC_immature_males) ")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN)+ + facet_grid(var~scen,scales='free_y') +plot_stationAVG + + +plot_stationAVG2 <- plotTS(AVGfut%>% + mutate(mn_val = val_use, + scen = GCM, + basin = var_salmon, + GCM_scen = factor(GCM_scen,levels = GCM_scens)))+ + labs(title="average variables (RKC_immature_males) ")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN)+ + facet_grid(var~scen,scales='free_y') +plot_stationAVG2 + + +# ------------------------------------ +# Plot restults with hindcast +# ------------------------------------ + +# Plot AVG across subset stations: +# -------------------------------------- +varlist <- unique(futDat_avg$var) +var_sal_set <- var_salmons + + +vlN <- 1:length(varlist) + + +AVGfut <- futDat_avg%>%mutate(mn_val = val_use, + scen = GCM, + GCM_scen = factor(GCM_scen,levels = GCM_scens)) +AVGhind_salmon <- hindDat_avg%>%mutate(mn_val = val_use, + scen = "hind", + GCM_scen = factor("hind",levels = GCM_scens)) + +hindfut_avg <- ggplot( )+ + geom_line(data=AVGfut%>%mutate(scen=GCM)%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen,linetype = var_salmon), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=AVGfut%>%mutate(scen=GCM)%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen, + fill=GCM_scen,linetype = var_salmon), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+facet_grid(var~GCM,scales="free_y")+ + + geom_line(data=AVGhind_salmon%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color="hind",linetype = var_salmon), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=AVGhind_salmon%>%filter(var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= "hind", + fill="hind",linetype = var_salmon), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Year", + subtitle = "", + title = "cross-station average (RKC_immature_males)", + legend = "")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + +hindfut_avg + + + +# Plot Indiv station: +# -------------------------------------- +hind_salmon <- hindDat_avg%>%mutate(mn_val = val_use, + scen = "hind", + GCM_scen = factor("hind",levels = GCM_scens)) +fut_salmon <- futDat_avg%>%mutate(mn_val = val_use, + scen = GCM, + GCM_scen = factor(GCM_scen,levels = GCM_scens)) + + +stN <- 3 +for(stN in 1:length(var_sal_set)){ + var_sal_set[stN] + + hindfut_station <- ggplot( )+ + geom_line(data=fut_salmon%>%mutate(mn_val=val_use,scen=GCM)%>%filter(var_salmon==var_sal_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen,linetype = var_salmon), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=fut_salmon%>%mutate(mn_val=val_use,scen=GCM)%>%filter(var_salmon==var_sal_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= GCM_scen, + fill=GCM_scen,linetype = var_salmon), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+facet_grid(var~GCM,scales="free_y")+ + + geom_line(data=hind_salmon%>%filter(var_salmon%in%var_sal_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color="hind",linetype = var_salmon), + alpha = 0.2,show.legend = FALSE)+ + geom_smooth(data=hind_salmon%>%filter(var_salmon==var_sal_set[stN],var%in%varlist[vlN]), + aes(x=mnDate,y=val_use,color= "hind", + fill="hind",linetype = var_salmon), + alpha=0.1,method="loess",formula='y ~ x',span = .5)+ + theme_minimal() + + labs(x="Year", + subtitle = "", + title = paste("Salmon strata/mo:", var_sal_set[stN]), + legend = "")+ + scale_color_manual(name = "Scenario", + values = valuesIN)+ + scale_fill_manual(name = "Scenario", + values = valuesIN) + + hindfut_station + + jpeg(filename = file.path(outfldr,paste0("salmon_indices_indiv_hind",stN,".jpg")), + width=8*sclr,height=7*sclr,units="in",res=350) + print(hindfut_avg) + dev.off() +} + + +sclr <- 1.2 +jpeg(filename = file.path(outfldr,"salmon_vars.jpg"), + width=8*sclr, height=7*sclr, units="in", res = 350) +print(plot_stationAVG) +dev.off() + + +sclr <- 1.2 +jpeg(filename = file.path(outfldr,"salmon_indices_fut_hind.jpg"), + width=8*sclr,height=7*sclr,units="in",res=350) +print(hindfut_station) +dev.off() + + + + diff --git a/R/sub_scripts/profile_attach.R b/R/sub_scripts/profile_attach.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/updateREADME.R b/R/sub_scripts/updateREADME.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/update_base_data.R b/R/sub_scripts/update_base_data.R old mode 100644 new mode 100755 diff --git a/R/sub_scripts/xplot_weekly.R b/R/sub_scripts/xplot_weekly.R old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rplot.png b/Rplot.png old mode 100644 new mode 100755 diff --git a/Vignettes/Ellen_regional_temperture_index.Rmd b/Vignettes/Ellen_regional_temperture_index.Rmd old mode 100644 new mode 100755 diff --git a/Vignettes/Ellen_regional_temperture_index.pdf b/Vignettes/Ellen_regional_temperture_index.pdf old mode 100644 new mode 100755 diff --git a/Vignettes/Ellen_regional_temperture_index.tex b/Vignettes/Ellen_regional_temperture_index.tex old mode 100644 new mode 100755 diff --git a/_config.yml b/_config.yml old mode 100644 new mode 100755 diff --git a/aclim.png b/aclim.png old mode 100644 new mode 100755 diff --git a/index.html b/index.html old mode 100644 new mode 100755 diff --git a/nul b/nul new file mode 100755 index 0000000..ac1d590 --- /dev/null +++ b/nul @@ -0,0 +1,325 @@ + + + + + + The CTAN archive + + + +

Comprehensive TeX Archive Network

+

The CTAN root directory

+ +

+ This is the root of the Comprehensive + TeX Archive Network directory tree. + Most information in CTAN is contained in subdirectories: +

+ +
+
biblio
+
+ Systems for maintaining and presenting bibliographies within documents + typeset using TeX +
+ +
digests
+
Collections of + TeX mailing list digests, + TeX-related electronic magazines, and indexes, + etc., of printed publications +
+ +
dviware
+
+ Printer drivers and previewers, etc., for .dvi files +
+ +
fonts
+
+ Fonts written in Metafont, and support for using fonts from other + sources (e.g., those in Adobe Type 1 format) +
+ +
graphics
+
+ Systems and TeX macros for producing graphics +
+ +
help
+
+ FAQs + (de + fr + uk) + and similar direct assistance +
+ +
indexing
+
+ Systems for maintaining and presenting indexes of documents typeset + using TeX +
+ +
info
+
+ Manuals and extended how-to information; errata for + TeX-related publications, collections of project + (e.g., LaTeX and NTS) + documents, etc. +
+ +
install
+
+ ZIP files of ready-to-install CTAN packages. The package contained in + CTAN directory a/b/c/d/ appears as + install/a/b/c/d.tds.zip – each such file may be unzipped + directly into + a TDS + tree, and should contain no “tree prefix” +
+ +
language
+
+ Support for various languages; hyphenation patterns +
+ +
macros
+
TeX + macros; several directories have significant sub-trees: +
+
context
+
+ The ConTeXt distribution + and contributed material +
+ +
generic
+
Macros that work in several environments
+ +
latex
+
+ The LaTeX + distribution and contributed material +
+ +
luatex
+
Macros that require the LuaTeX engine
+ +
plain
+
Donald Knuth's example macro set and contributed material
+ +
xetex
+
Macros that require the XƎTeX engine
+
+
+ +
obsolete
+
+ Material which is now obsolete, but which needs to remain + on the archive for some reason (such as the 1992 + LaTeX 2.09 + distribution). The tree maintains a “shadow hierarchy” + – for example obsolete/macros + has the same basic structures macros. +
+ +
support
+
+ TeX support environments and the like +
+ +
systems
+
+ TeX systems; + organised by operating environment, but also including: + +
+
knuth
+
Donald Knuth's current distribution.
+ +
generic
+
+ Complete systems that can potentially operate in more than one + operating environment. +
+ +
MacTeX
+
The distribution of MacTeX for Mac OS X
+ +
+ TeX Live +
+
+ The Live collection of freely distributable TeX + material, including the TeX + Live on-line installer. +
+ +
MiKTeX
+
+ The distribution of MiKTeX; CTAN provides a + home for MiKTeX's package repository, part + of its online installer. +
+
+
+ +
tds
+
+ The TeX Directory Structure standard + (the output of the TUG TDS working group) +
+ +
usergrps
+
Information supplied by TeX User Groups
+ +
web
+
+ Literate Programming tools and systems +
+
+ +

CTAN on the Web

+

+ The home page for CTAN is at + https://ctan.org, + which provides several features: +

+ + +

Searching CTAN

+

+ You can search the content of the Catalogue with the + following form on the CTAN site: +

+
+ + +
+ + +

+ In addition, CTAN archives maintain lists of their contents + as plain text files, in a number of ways: +

+
    +
  1. + Sorted by name + (This is a big file…around 20M bytes). +
  2. +
  3. + New or changed in the last 7 days + (This is usually a more manageable size…) +
  4. +
+ +
+

+ This is an experimental page. Comments, to + the CTAN team, + will be most welcome. +

+

Last updated 2020-03-31

+
+ + diff --git a/plot_ts.R b/plot_ts.R old mode 100644 new mode 100755 diff --git a/shiny/._NPSSP b/shiny/._NPSSP deleted file mode 100644 index 169e65d..0000000 Binary files a/shiny/._NPSSP and /dev/null differ diff --git a/shiny/NPSSP/NPSSP.R b/shiny/NPSSP/NPSSP.R old mode 100644 new mode 100755 diff --git a/~$LIM2_quickStart.docx b/~$LIM2_quickStart.docx deleted file mode 100644 index a837b48..0000000 Binary files a/~$LIM2_quickStart.docx and /dev/null differ