-
Notifications
You must be signed in to change notification settings - Fork 0
/
ACLIM2_quickStart.tex
executable file
·1761 lines (1487 loc) · 109 KB
/
ACLIM2_quickStart.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\title{ACLIM2 CMIP6 ROMSNPZ Indices quick start guide}
\author{K. Holsman}
\date{}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
pdftitle={ACLIM2 CMIP6 ROMSNPZ Indices quick start guide},
pdfauthor={K. Holsman},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\begin{document}
\maketitle
{
\setcounter{tocdepth}{3}
\tableofcontents
}
\hypertarget{download-the-aclim2-repo-data}{%
\section{Download the ACLIM2 repo \&
data}\label{download-the-aclim2-repo-data}}
\hypertarget{clone-the-aclim2-repo}{%
\subsection{Clone the ACLIM2 repo}\label{clone-the-aclim2-repo}}
To run this tutorial first clone the ACLIM2 repository to your local
drive:
\hypertarget{option-1-use-r}{%
\subsubsection{Option 1: Use R}\label{option-1-use-r}}
This set of commands, run within R, downloads the ACLIM2 repository and
unpacks it, with the ACLIM2 directory structrue being located in the
specified \texttt{download\_path}. This also performs the folder
renaming mentioned in Option 2.
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Specify the download directory}
\NormalTok{ main\_nm }\OtherTok{\textless{}{-}} \StringTok{"ACLIM2"}
\CommentTok{\# Note: Edit download\_path for preference}
\NormalTok{ download\_path }\OtherTok{\textless{}{-}} \FunctionTok{path.expand}\NormalTok{(}\StringTok{"\textasciitilde{}"}\NormalTok{)}
\NormalTok{ dest\_fldr }\OtherTok{\textless{}{-}} \FunctionTok{file.path}\NormalTok{(download\_path,main\_nm)}
\NormalTok{ url }\OtherTok{\textless{}{-}} \StringTok{"https://github.com/kholsman/ACLIM2/archive/main.zip"}
\NormalTok{ dest\_file }\OtherTok{\textless{}{-}} \FunctionTok{file.path}\NormalTok{(download\_path,}\FunctionTok{paste0}\NormalTok{(main\_nm,}\StringTok{".zip"}\NormalTok{))}
\FunctionTok{download.file}\NormalTok{(}\AttributeTok{url=}\NormalTok{url, }\AttributeTok{destfile=}\NormalTok{dest\_file)}
\CommentTok{\# unzip the .zip file (manually unzip if this doesn\textquotesingle{}t work)}
\FunctionTok{setwd}\NormalTok{(download\_path)}
\FunctionTok{unzip}\NormalTok{ (dest\_file, }\AttributeTok{exdir =}\NormalTok{ download\_path,}\AttributeTok{overwrite =}\NormalTok{ T)}
\CommentTok{\#rename the unzipped folder from ACLIM2{-}main to ACLIM2}
\FunctionTok{file.rename}\NormalTok{(}\FunctionTok{paste0}\NormalTok{(main\_nm,}\StringTok{"{-}main"}\NormalTok{), main\_nm)}
\FunctionTok{setwd}\NormalTok{(main\_nm)}
\CommentTok{\# 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.}
\end{Highlighting}
\end{Shaded}
\hypertarget{option-2-download-the-zipped-repo}{%
\subsubsection{Option 2: Download the zipped
repo}\label{option-2-download-the-zipped-repo}}
Download the full zip archive directly from the
\href{https://github.com/kholsman/ACLIM2}{\textbf{ACLIM2 Repo}} using
this link:
\href{https://github.com/kholsman/ACLIM2/archive/main.zip}{\textbf{https://github.com/kholsman/ACLIM2/archive/main.zip}},
and unzip its contents while preserving directory structure.
\textbf{Important!} If downloading from zip, please \textbf{rename the
root folder} from \texttt{ACLIM2-main} (in the zipfile) to
\texttt{ACLIM2} (name used in cloned copies) after unzipping, for
consistency in the following examples.
Your final folder structure should look like this:
\includegraphics[width=1\textwidth,height=\textheight]{Figs/ACLIM_dir.png}
\hypertarget{option-3-use-git-commandline}{%
\subsubsection{Option 3: Use git
commandline}\label{option-3-use-git-commandline}}
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 \textbf{terminal command line, not in R}, to
clone the full ACLIM2 directory and sub-directories:
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{git}\NormalTok{ clone https://github.com/kholsman/ACLIM2.git}
\end{Highlighting}
\end{Shaded}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
\hypertarget{get-the-data}{%
\subsection{Get the data}\label{get-the-data}}
--\textgreater{}
\begin{itemize}
\item
Go to the google drive and download the zipped file with the R ACLIM2
indices \texttt{ACLIM2\_indices.zip}:
\item
\href{https://drive.google.com/drive/u/1/folders/1clPtrPCQMPcwqr8UE78_Sd2IGwyBuDcD}{00\_ACLIM\_shared
\textgreater{} 02\_Data \textgreater{} Newest\_Data(use this)
\textgreater{} unzip\_and\_put\_in\_dat\_out\_folder\_CMIP6}
\href{https://drive.google.com/drive/u/1/folders/1t_JqDBQU-Fyy5nvIYRAmVcqzWi4mq7mk}{00\_ACLIM\_shared
\textgreater{} 02\_Data \textgreater{} Newest\_Data(use this)
\textgreater{} unzip\_and\_put\_in\_dat\_out\_folder\_CMIP5}
\item
Unzip \texttt{K29P19\_CMIP5.zip} or \texttt{K29P19\_CMIP6.zip} files
move the \texttt{K29P19\_CMIP5} or \texttt{K29P19\_CMIP6} folders to
your local folder \texttt{ACLIM2/Data/out}. The result should be the
following folder structure on your local computer:\\
\item
\texttt{ACLIM2/Data/out/K29P19\_CMIP6/allEBSmeans}: main folder with
annual, monthly, seasonal, and survey replicated level 4 ACLIM indices
\item
\texttt{ACLIM2/Data/out/K29P19\_CMIP6/BC\_ACLIMregion}: Weekly x
Strata based indices, including delta and bias corrected values (these
are ``rolled up'' to become strata AREA weighted mean vals in the
allEBSmeans folder).
\item
\texttt{ACLIM2/Data/out/K29P19\_CMIP6/BC\_ACLIMsurveyrep}: Survey
replicated indices at each station, including delta and bias corrected
values (these are ``rolled up'' to become average across station mean
vals in the allEBSmeans folder).
\item
\texttt{ACLIM2/Data/out/K29P19\_CMIP6/allEBSmeans}: as above but for
CMIP5
\item
\texttt{ACLIM2/Data/out/K29P19\_CMIP6/allEBSmeans}: as above but for
CMIP5
\item
\texttt{ACLIM2/Data/out/K29P19\_CMIP6/allEBSmeans}: as above but for
CMIP5
\end{itemize}
\hypertarget{set-up-the-workspace}{%
\subsection{Set up the Workspace}\label{set-up-the-workspace}}
Open R() and used `setwd()' to navigate to the root ACLIM2 folder (.e.g,
\textasciitilde/mydocuments/ACLIM2)
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# set the workspace to your local ACLIM2 folder}
\CommentTok{\# e.g., "/Users/kholsman/Documents/GitHub/ACLIM2"}
\CommentTok{\# setwd( path.expand("\textasciitilde{}/Documents/GitHub/ACLIM2") )}
\CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
\CommentTok{\# SETUP WORKSPACE}
\NormalTok{ tmstp }\OtherTok{\textless{}{-}} \FunctionTok{format}\NormalTok{(}\FunctionTok{Sys.time}\NormalTok{(), }\StringTok{"\%Y\_\%m\_\%d"}\NormalTok{)}
\NormalTok{ main }\OtherTok{\textless{}{-}} \FunctionTok{getwd}\NormalTok{() }\CommentTok{\#"\textasciitilde{}/GitHub\_new/ACLIM2"}
\CommentTok{\# loads packages, data, setup, etc.}
\FunctionTok{suppressWarnings}\NormalTok{(}\FunctionTok{source}\NormalTok{(}\StringTok{"R/make.R"}\NormalTok{))}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## ------------------------------
## ALIM2/R/setup.R settings
## ------------------------------
## data_path : D:/romsnpz/roms_for_public
## Rdata_path : D:/romsnpz/2022_10_17_Rdata/roms_for_public
## redownload_level3_mox: FALSE
## update.figs : FALSE
## load_gis : FALSE
## update.outputs : TRUE
## update.figs : FALSE
## dpiIN : 150
## update.figs : FALSE
## ------------------------------
## ------------------------------
##
## The following datasets are public, please cite as Hermann et al. 2019 (v.H16) and Kearney et al. 2020 (v.K20) :
## B10K-H16_CMIP5_CESM_BIO_rcp85
## B10K-H16_CMIP5_CESM_rcp45
## B10K-H16_CMIP5_CESM_rcp85
## B10K-H16_CMIP5_GFDL_BIO_rcp85
## B10K-H16_CMIP5_GFDL_rcp45
## B10K-H16_CMIP5_GFDL_rcp85
## B10K-H16_CMIP5_MIROC_rcp45
## B10K-H16_CMIP5_MIROC_rcp85
## B10K-H16_CORECFS
## B10K-K20_CORECFS
##
## The following datasets are still under embargo, please do not share outside of ACLIM:
## B10K-K20P19_CMIP6_cesm_historical
## B10K-K20P19_CMIP6_cesm_ssp126
## B10K-K20P19_CMIP6_cesm_ssp585
## B10K-K20P19_CMIP6_gfdl_historical
## B10K-K20P19_CMIP6_gfdl_ssp126
## B10K-K20P19_CMIP6_gfdl_ssp585
## B10K-K20P19_CMIP6_miroc_historical
## B10K-K20P19_CMIP6_miroc_ssp126
## B10K-K20P19_CMIP6_miroc_ssp585
\end{verbatim}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
\hypertarget{read-this-before-you-start}{%
\section{Read this before you start}\label{read-this-before-you-start}}
\hypertarget{overview}{%
\subsection{Overview}\label{overview}}
The \href{https://github.com/kholsman/ACLIM2}{\textbf{ACLIM2 github
repository}} contains R code and Rdata files for working with
netcdf-format data generated from the
\href{https://beringnpz.github.io/roms-bering-sea}{\textbf{downscaled
ROMSNPZ modeling}} 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 maintained by
\href{mailto:[email protected]}{Kirstin Holsman} as part of
NOAA's
\href{https://www.fisheries.noaa.gov/alaska/ecosystems/alaska-climate-integrated-modeling-project}{\textbf{ACLIM
project}} for the Bering Sea. \emph{See
\href{https://www.frontiersin.org/articles/10.3389/fmars.2019.00775/full}{Hollowed
et al.~2020} for more information about the ACLIM project.}
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
This document provides an overview of accessing, plotting, and creating
bias corrected indices for ACLIM2 based on CMIP6 (embargoed for ACLIM2
users until 2023) and CMIP5 (publicly available) simulations. This guide
assumes analyses will take place in R() and that users have access to
the data folder within the ACLIM2 shared drive. For more information
also see the full tutorial (``GettingStarted\_Bering10K\_ROMSNPZ''
available at the bottom of
\href{https://github.com/kholsman/ACLIM2}{\textbf{this repo page}}.
\textbf{Important!} A few key things to know before getting started are
detailed below. Please review this information before getting started.
\hypertarget{romsnpz-versions}{%
\subsection{ROMSNPZ versions}\label{romsnpz-versions}}
\textbf{Important!} ACLIM1 CMIP5 and ACLIM2 CMIP5 and CMIP6 datasets use
different base models.
There are two versions of the ROMSNPZ model:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
ACLIM1 an older 10-depth layer model used for CMIP5 (``H-16'')
\item
ACLIM2 a new 30-depth layer model used for CMIP6 (``K20'' or
``K20P19'')
\end{enumerate}
The models are not directly comparable, therefore the projections should
be bias corrected and recentered to baselines of hindcasts of each model
(forced by ``observed'' climate conditions). i.e.~CMIP5 and CMIP6 have
corresponding hindcasts:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
Hindcast for CMIP5 ``H19'' --\textgreater{} H16\_CORECFS
\item
Hindcast for CMIP5 ``K20P19'' --\textgreater{} H16\_CORECFS
\item
Hindcast for CMIP6 ``K20P19'' --\textgreater{} K20\_CORECFS
\end{enumerate}
In addition for CMIP6 ``historical'' runs are available for bias
correcting. We will use those below.
For a list of the available simulations for ACLIM enter the following in
R():
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# list of the climate scenarios}
\FunctionTok{data.frame}\NormalTok{(sim\_list)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## sim_list
## 1 B10K-K20_CORECFS
## 2 B10K-H16_CMIP5_CESM_BIO_rcp85
## 3 B10K-H16_CMIP5_CESM_rcp45
## 4 B10K-H16_CMIP5_CESM_rcp85
## 5 B10K-H16_CMIP5_GFDL_BIO_rcp85
## 6 B10K-H16_CMIP5_GFDL_rcp45
## 7 B10K-H16_CMIP5_GFDL_rcp85
## 8 B10K-H16_CMIP5_MIROC_rcp45
## 9 B10K-H16_CMIP5_MIROC_rcp85
## 10 B10K-H16_CORECFS
## 11 B10K-K20P19_CMIP5_CESM_rcp45
## 12 B10K-K20P19_CMIP5_CESM_rcp85
## 13 B10K-K20P19_CMIP5_GFDL_rcp45
## 14 B10K-K20P19_CMIP5_GFDL_rcp85
## 15 B10K-K20P19_CMIP5_MIROC_rcp45
## 16 B10K-K20P19_CMIP5_MIROC_rcp85
## 17 B10K-K20P19_CMIP6_cesm_historical
## 18 B10K-K20P19_CMIP6_cesm_ssp126
## 19 B10K-K20P19_CMIP6_cesm_ssp585
## 20 B10K-K20P19_CMIP6_gfdl_historical
## 21 B10K-K20P19_CMIP6_gfdl_ssp126
## 22 B10K-K20P19_CMIP6_gfdl_ssp585
## 23 B10K-K20P19_CMIP6_miroc_historical
## 24 B10K-K20P19_CMIP6_miroc_ssp126
## 25 B10K-K20P19_CMIP6_miroc_ssp585
\end{verbatim}
\hypertarget{romsnpz-variables}{%
\subsection{ROMSNPZ variables}\label{romsnpz-variables}}
For a list of the available variables from the ROMSNPZ:
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Metadata for variables}
\NormalTok{ (srvy\_var\_def[}\SpecialCharTok{{-}}\NormalTok{(}\DecValTok{1}\SpecialCharTok{:}\DecValTok{5}\NormalTok{),])}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## name units
## 6 Ben mg C m^-2
## 7 DetBen mg C m^-2
## 8 Hsbl meter
## 9 IceNH4 mmol N m^-3
## 10 IceNO3 mmol N m^-3
## 11 IcePhL mg C m^-3
## 12 aice
## 13 hice meter
## 14 shflux watt meter-2
## 15 ssflux meter second-1
## 16 Cop_integrated (mg C m^-3)*m
## 17 Cop_surface5m mg C m^-3
## 18 EupO_integrated (mg C m^-3)*m
## 19 EupO_surface5m mg C m^-3
## 20 EupS_integrated (mg C m^-3)*m
## 21 EupS_surface5m mg C m^-3
## 22 Iron_bottom5m micromol Fe m-3
## 23 Iron_integrated (micromol Fe m-3)*m
## 24 Iron_surface5m micromol Fe m-3
## 25 Jel_integrated (mg C m^-3)*m
## 26 Jel_surface5m mg C m^-3
## 27 MZL_integrated (mg C m^-3)*m
## 28 MZL_surface5m mg C m^-3
## 29 NCaO_integrated (mg C m^-3)*m
## 30 NCaO_surface5m mg C m^-3
## 31 NCaS_integrated (mg C m^-3)*m
## 32 NCaS_surface5m mg C m^-3
## 33 NH4_bottom5m mmol N m^-3
## 34 NH4_integrated (mmol N m^-3)*m
## 35 NH4_surface5m mmol N m^-3
## 36 NO3_bottom5m mmol N m^-3
## 37 NO3_integrated (mmol N m^-3)*m
## 38 NO3_surface5m mmol N m^-3
## 39 PhL_integrated (mg C m^-3)*m
## 40 PhL_surface5m mg C m^-3
## 41 PhS_integrated (mg C m^-3)*m
## 42 PhS_surface5m mg C m^-3
## 43 prod_Cop_integrated mg C m^-2 d^-1
## 44 prod_EupO_integrated mg C m^-2 d^-1
## 45 prod_EupS_integrated mg C m^-2 d^-1
## 46 prod_Eup_integrated (milligram carbon meter-3 d-1)*m
## 47 prod_Jel_integrated mg C m^-2 d^-1
## 48 prod_MZL_integrated mg C m^-2 d^-1
## 49 prod_NCaO_integrated mg C m^-2 d^-1
## 50 prod_NCaS_integrated mg C m^-2 d^-1
## 51 prod_NCa_integrated (milligram carbon meter-3 d-1)*m
## 52 prod_PhL_integrated mg C m^-2 d^-1
## 53 prod_PhS_integrated mg C m^-2 d^-1
## 54 salt_surface5m
## 55 temp_bottom5m Celsius
## 56 temp_integrated (Celsius)*m
## 57 temp_surface5m Celsius
## 58 uEast_bottom5m meter second-1
## 59 uEast_surface5m meter second-1
## 60 vNorth_bottom5m meter second-1
## 61 vNorth_surface5m meter second-1
## longname
## 6 Benthic infauna concentration
## 7 Benthic detritus concentration
## 8 depth of oceanic surface boundary layer
## 9 Ice ammonium concentration
## 10 Ice nitrate concentration
## 11 Ice algae concentration
## 12 fraction of cell covered by ice
## 13 average ice thickness in cell
## 14 surface net heat flux
## 15 surface net salt flux, (E-P)*SALT
## 16 Small copepod concentration, integrated over depth
## 17 Small copepod concentration, surface 5m mean
## 18 Offshore euphausiid concentration, integrated over depth
## 19 Offshore euphausiid concentration, surface 5m mean
## 20 On-shelf euphausiid concentration, integrated over depth
## 21 On-shelf euphausiid concentration, surface 5m mean
## 22 iron concentration, bottom 5m mean
## 23 iron concentration, integrated over depth
## 24 iron concentration, surface 5m mean
## 25 Jellyfish concentration, integrated over depth
## 26 Jellyfish concentration, surface 5m mean
## 27 Microzooplankton concentration, integrated over depth
## 28 Microzooplankton concentration, surface 5m mean
## 29 Offshore large copepod concentration, integrated over depth
## 30 Offshore large copepod concentration, surface 5m mean
## 31 On-shelf large copepod concentration, integrated over depth
## 32 On-shelf large copepod concentration, surface 5m mean
## 33 Ammonium concentration, bottom 5m mean
## 34 Ammonium concentration, integrated over depth
## 35 Ammonium concentration, surface 5m mean
## 36 Nitrate concentration, bottom 5m mean
## 37 Nitrate concentration, integrated over depth
## 38 Nitrate concentration, surface 5m mean
## 39 Large phytoplankton concentration, integrated over depth
## 40 Large phytoplankton concentration, surface 5m mean
## 41 Small phytoplankton concentration, integrated over depth
## 42 Small phytoplankton concentration, surface 5m mean
## 43 Cop net production rate, summed over depth
## 44 EupO net production rate, summed over depth
## 45 EupS net production rate, summed over depth
## 46 secondary production Euphausiids, integrated over depth
## 47 Jel net production rate, summed over depth
## 48 MZL net production rate, summed over depth
## 49 NCaO net production rate, summed over depth
## 50 NCaS net production rate, summed over depth
## 51 secondary production Neocalanus, integrated over depth
## 52 PhL net production rate, summed over depth
## 53 PhS net production rate, summed over depth
## 54 salinity, surface 5m mean
## 55 potential temperature, bottom 5m mean
## 56 potential temperature, integrated over depth
## 57 potential temperature, surface 5m mean
## 58 u-momentum component, geo-rotated, bottom 5m mean
## 59 u-momentum component, geo-rotated, surface 5m mean
## 60 v-momentum component, geo-rotated, bottom 5m mean
## 61 v-momentum component, geo-rotated, surface 5m mean
\end{verbatim}
\hypertarget{data-outputs}{%
\subsection{Data outputs}\label{data-outputs}}
\textbf{Important!} There are 2 types of post-processed data available
for use in ACLIM.
The ROMSNPZ team has developed a process to provide standardized
post-processed outputs from the large (and non-intuitive) ROMSNPZ grid.
These have been characterized as:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
Level 1 (original ROMSNPZ U,V, grid, not rotated or corrected)\\
\item
Level 2 (lat long bi-weekly high res versions, shouldn't be needed and
are difficult to work with)\\
\item
\textbf{Level 3 indices (depth corrected and area weighted means for
each model variable; i.e., what we will mostly use) }
\begin{enumerate}
\def\labelenumii{\alph{enumii}.}
\tightlist
\item
``ACLIMsurveyrep\_'': groundifsh survey replicated (replicated in
space and time)
\item
``ACLIMregion\_'': weekly strata based averages
\end{enumerate}
\end{enumerate}
To get more information about each of these level 3 datasets enter this
in R:
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Metadata for Weekly ("ACLIMregion\_...") indices}
\FunctionTok{head}\NormalTok{(all\_info1)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## name Type B10KVersion CMIP GCM
## 1 B10K-H16_CMIP5_CESM_BIO_rcp85 Weekly regional indices H16 CMIP5 CESM
## 2 B10K-H16_CMIP5_CESM_rcp45 Weekly regional indices H16 CMIP5 CESM
## 3 B10K-H16_CMIP5_CESM_rcp85 Weekly regional indices H16 CMIP5 CESM
## 4 B10K-H16_CMIP5_GFDL_BIO_rcp85 Weekly regional indices H16 CMIP5 GFDL
## 5 B10K-H16_CMIP5_GFDL_rcp45 Weekly regional indices H16 CMIP5 GFDL
## 6 B10K-H16_CMIP5_GFDL_rcp85 Weekly regional indices H16 CMIP5 GFDL
## BIO Carbon_scenario Start End nvars
## 1 TRUE rcp85 2006-01-22 12:00:00 2099-12-27 12:00:00 59
## 2 FALSE rcp45 2006-01-22 12:00:00 2081-02-16 12:00:00 59
## 3 FALSE rcp85 2006-01-22 12:00:00 2099-12-27 12:00:00 59
## 4 TRUE rcp85 2006-01-22 12:00:00 2099-12-27 12:00:00 59
## 5 FALSE rcp45 2006-01-22 12:00:00 2099-12-27 12:00:00 59
## 6 FALSE rcp85 2006-01-22 12:00:00 2099-12-27 12:00:00 59
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Metadata for Weekly ("ACLIMsurveyrep\_...") indices}
\FunctionTok{head}\NormalTok{(all\_info2)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## name Type B10KVersion CMIP GCM BIO
## 1 B10K-H16_CMIP5_CESM_BIO_rcp85 Survey replicated H16 CMIP5 CESM TRUE
## 2 B10K-H16_CMIP5_CESM_rcp45 Survey replicated H16 CMIP5 CESM FALSE
## 3 B10K-H16_CMIP5_CESM_rcp85 Survey replicated H16 CMIP5 CESM FALSE
## 4 B10K-H16_CMIP5_GFDL_BIO_rcp85 Survey replicated H16 CMIP5 GFDL TRUE
## 5 B10K-H16_CMIP5_GFDL_rcp45 Survey replicated H16 CMIP5 GFDL FALSE
## 6 B10K-H16_CMIP5_GFDL_rcp85 Survey replicated H16 CMIP5 GFDL FALSE
## Carbon_scenario Start End nvars
## 1 rcp85 1970 2100 60
## 2 rcp45 1970 2100 60
## 3 rcp85 1970 2100 60
## 4 rcp85 1970 2100 60
## 5 rcp45 1970 2100 60
## 6 rcp85 1970 2100 60
\end{verbatim}
\#Indices \& bias correction UPDATED\{.tabset\}
\emph{Summary}
We recommend using the `mn\_val' column in the hindcast and either the
`val\_biascorrected' or `val\_delta' column for projections.
\emph{use val\_biascorrected' or `val\_delta'?}
This will depend in part on the index and scale you are working at. For
fine scale (weekly strata, or station specific, or finer) we recommend
using the `val\_delta', i.e., the delta method. For the ACLIM2 spring
sprint we are recommending the `val\_biascorrected' in order to align
modeling output.
However,at the larger pooled scales there is very little difference
between the two but a sensitivity analysis may be needed to determine if
the choice makes a profound difference in projections. Following an in
depth analysis of the effects of bias correction at the finer scales of
model output we found that bias correction via the Ho et al.~method can
result in artifacts that impact final indices in unsatisfactory ways.
The effects do not emerge as frequently when data are pooled at the
annual or basin-wide scale but do occur at finer scales, especially when
areas or time-period have values in the hindcast but the corresponding
historical runs have only small values, resulting in amplification that
is not found in the raw projection to historical time-series comparison.
However the Ho et al.~approach is better at re-scaling variance between
projections and the hindcast, and preserves a more parsimonious variance
structure in projections. Whereas, the delta method assumes equal
variance between the hindcast and projection models (during the
overlapping reference years 1980:2013 when overall variance should
match) and does do not adjust projections if the corresponding
historical variance is larger or smaller than the hindcast sigma.
Applying the delta method adjustment at the smallest possible resolution
of the indices (weekly or by station) minimizes the effects of
superimposing the variance structure of the historical time-series on
the projection.
The average weekly strata value per or the average station value (for
survey replicated indices) across the reference years 1980-2013 were
calculated for the hindcast and corresponding historical runs to
determine the mean hindcast and mean historical values for bias
correction; `mn\_hind' and `mn\_hist', respectively. We used the mgcv
package to smooth weekly values `mgcv::gam(\ldots bs=``cc'')') across
all reference years to remove artifacts (e.g.~divide by 0) in the
average (\(\bar{Y}^{hind}_{w,k}\) and \(\bar{Y}^{hist}_{w,k}\)) and
variance (\(\sigma^{hist}_{w,k}\) and \(\sigma^{hind}_{w,k}\)) terms
were predicted from the gam (without error; example for
\(\bar{Y}^{hind}_{w,k}\)):
\[ \bar{Y}^{hind}_{w,k} = \mu+s(w, k = .8n)+\epsilon~~and~~\epsilon\sim N(0,\sigma)\]
\textbf{Important!} Note: the delta adjustment and the bias corrections
were done on ``raw'' values which in some cases results in negative
values (or \textless0 or \textgreater1 for proportion variables like
`aice'). For these variables, values \textless0 were set to 0,
\textgreater1 set to 1 as needed after (delta) bias correction.
\begin{figure}
\centering
\includegraphics[width=0.75\textwidth,height=\textheight]{Figs/biascorrected_temp2.png}
\caption{\textbf{Raw (top row) and bias corrected (bottom row)bottom
temperature indices based on survey replicated Level3 outputs for the
SEBS}}
\end{figure}
\emph{ACLIM2 Indices correction methods}
\#\#\#Delta method The next step creates ACLIM2 indices (i.e., Level4)
based on the Level3 output for each hindcast, historical run, and CMIP6
projection. The script below delta adjusts or bias corrects each
projected index using the corresponding historical run. (such that
projections are \(\Delta\) from historical mean values for the reference
period \texttt{deltayrs\ \ \ \ \ \textless{}-\ 1980:2013} ).
\textbf{Important!} Note that for projections the `mn\_val' represents
raw mean values, while `val\_delta' and `val\_biascorrected' are the
adjusted values using scaling factor of 1 or SD\_hind/SD\_hist on a
weekly basis (respectively).
Delta method correction was done on ``raw'' values which in some cases
results in negative values (or \textless0 or \textgreater1 for
proportion variables like `aice'). For these variables, values
\textless0 were set to 0, \textgreater1 set to 1 as needed after the
delta adjustment. Delta method adjustments were conducted at the weekly
level for strata specific data and at the station level for survey
replicated indices:
Such that (\(Y\)):
\[{Y}^{fut'}_{t,k} =\bar{Y}^{hind}_{k,\bar{T}} +({Y}^{fut}_{t,k}-\bar{Y}^{hist}_{k,\bar{T}})\]
where \(\bar{Y}^{fut'}_{y,k}\) is the bias corrected variable \(k\)
value for time-step \(t\) (e.g., year, month, or season),
\(\bar{Y}^{hind}_{k,\bar{T}}\) is the mean value of the variable \(k\)
during the reference period \(\bar{T}=[1980,2013]\) from the hindcast
model, \(\sigma^{hind}_{k,\bar{T}}\) is the standard deviation of the
hindcast during the reference period \(\bar{T}\),
\(\sigma^{hist}_{k,\bar{T}}\) is the standard deviation of the
historical run during tje reference period, \({Y}^{fut}_{t,k}\) is the
value of the variable from the projection at time-step \(t\) and
\(\bar{Y}^{hist}_{k,\bar{T}}\) is the average value from the historical
run during reference period \(\bar{T}\).
\#\#\#Bias correction
Bias correction was done on ``raw'' values which in some cases results
in negative values (or \textless0 or \textgreater1 for proportion
variables like `aice'). For these variables, values \textless0 were set
to 0, \textgreater1 set to 1 as needed after bias correction. Bias
correction adjustments were conducted at the weekly level for strata
specific data and at the station level for survey replicated indices:
Such that (\(Y\)):
\[{Y}^{fut'}_{t,k} =\bar{Y}^{hind}_{k,\bar{T}} +\left( \frac{\sigma^{hind}_{k,\bar{T}}}{\sigma^{hist}_{k,\bar{T}}}*({Y}^{fut}_{t,k}-\bar{Y}^{hist}_{k,\bar{T}}) \right )\]
where \(\bar{Y}^{fut'}_{y,k}\) is the bias corrected variable \(k\)
value for time-step \(t\) (e.g., year, month, or season),
\(\bar{Y}^{hind}_{k,\bar{T}}\) is the mean value of the variable \(k\)
during the reference period \(\bar{T}=[1980,2013]\) from the hindcast
model, \(\sigma^{hind}_{k,\bar{T}}\) is the standard deviation of the
hindcast during the reference period \(\bar{T}\),
\(\sigma^{hist}_{k,\bar{T}}\) is the standard deviation of the
historical run during tje reference period, \({Y}^{fut}_{t,k}\) is the
value of the variable from the projection at time-step \(t\) and
\(\bar{Y}^{hist}_{k,\bar{T}}\) is the average value from the historical
run during reference period \(\bar{T}\).
For log-normally distributed variables(\(Y\)):
\[{Y}^{fut'}_{y,k} =e^{\ln\bar{Y}^{hind}_{k,\bar{T}} +\left( \frac{\hat{\sigma}^{hind}_{k,\bar{T}}}{\hat{\sigma}^{hist}_{k,\bar{T}}}*(\ln{Y}^{fut}_{t,k}-\ln\bar{Y}^{hist}_{k,\bar{T}}) \right )}\],
where \(\hat\sigma^{hist}_{k,\bar{T}}\) and
\(\hat\sigma^{hind}_{k,\bar{T}}\) are the standard deviation of the
\(\ln\bar{Y}^{hist}_{k,t}\) and \(\ln\bar{Y}^{hind}_{k,t}\) during the
reference period \(\hat{T}\) (respectively).
\hypertarget{weekly-by-strata-indices}{%
\subsection{Weekly by strata indices}\label{weekly-by-strata-indices}}
Uses the strata x weekly data (`ACLIMregion') to generate
strata-specific averages in order to generate the strata area-weighted
averages for each week \(w\) each year \(y\).
\[\bar{Y}_{k,y,w}= \frac{\sum^{n_s}_{l}(\frac{1}{n_i}\sum^{n_t}_{t}Y_{k,y,s,w,t})*A_s} {\sum^{n_s}_{s}{A_s}}\],
where \(Y_{k,w,y,s,t}\) is the value of the variable \(k\) in strata
\(s\) at time \(t\) in year \(y\), \(A_s\) is the area of strata \(s\),
\(n_i\) is the number of stations in strata \(s\), and \(n_s\) is the
number of strata \(s\) in each basin (NEBS or SEBS).
\(\bar{Y}_{w,y,k}\) was calculated for the hindcast, historical run, and
projection time-series. Projections \(\bar{Y}_{k,y,w}\) were then bias
corrected using the corresponding historical and hindcast values such
that:
\[\bar{Y}^{fut'}_{k,y,w} =\bar{Y}^{hind}_{w,k} +\left( \frac{\sigma^{hind}_{w,k}}{\sigma^{hist}_{w,k}}*(\bar{Y}^{fut}_{k,y,w}-\bar{Y}^{hist}_{w,k}) \right )\],
where \(\bar{Y}^{hist}_{w,k}\) and \(\bar{Y}^{hind}_{w,k}\) are the
average historical weekly values across years in the period (1980 to
2012 ; adjustable in \texttt{R/setup.R}).
\hypertarget{nesb-sebs-wide-averaged-indices}{%
\subsection{NESB \& SEBS wide averaged
indices}\label{nesb-sebs-wide-averaged-indices}}
The average water column values for each variable from the ROMSNPZ model
strata x weekly Level2 outputs (`ACLIMregion') were calculated and used
to calculate the strata-area weighted mean value for the NEBS and SEBS
weekly, monthly, seasonally, and annually. Similarly, for survey
replicated (`ACLIMsurveyrep') Level2 outputs the average water column
value for each variable at each station was calculated used to calculate
the strata-area weighted mean value for the NEBS and SEBS annually.
These indices were calculate for hindcast, historical, and projection
scenarios, and used to bias correct the projections. More information on
the methods for each can be found in the tabs below and the code in
Appendix A following this section will re-generate the bias corrected
indices. All of the bias corrected outputs can be found in the
``Data/out/K20P19\_CMIP6'' folder.
The same approach was applied to the weekly strata data such that weekly
strata values were calculated as:
\[\bar{Y}_{k,y,s,w}= \sum^{n_s}_{l}(\frac{1}{n_i}\sum^{n_t}_{t}Y_{k,y,s,w,t})\]
\[\bar{Y}^{fut'}_{k,s,y,w} =\bar{Y}^{hind}_{k,s,w} +\left( \frac{\sigma^{hind}_{k,s,w}}{\sigma^{hist}_{k,s,w}}*(\bar{Y}^{fut}_{k,s,y,w}-\bar{Y}^{hist}_{k,s,w}) \right )\],
where \(\bar{Y}^{hist}_{k,s,w}\) and \(\bar{Y}^{hind}_{k,s,w}\) are the
average historical weekly values across years in the period (1980 to
2012 ; adjustable in \texttt{R/setup.R}).Where the mean and variance
terms were smoothed at the weekly and strata level (i.e.,
\bar\{Y\}\^{}\{hind\}\_\{w,k\} was predicted from the following gam()
without error)
\[ \bar{Y}^{hind}_{k,s,w} = \mu+s(w, k = .8n)+\epsilon ~~and~~\epsilon\sim N(0,\sigma) \]
\hypertarget{monthly-indices}{%
\subsection{Monthly indices}\label{monthly-indices}}
Using the bias corrected weekly or strata x weekly indices, we then
generated monthly indices for each month \(m\) each year \(y\).
\[\bar{Y}_{k,y,m}= \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}_{k,y,w}\], where
\(\bar{Y}_{w,y,k}\) are the weekly average indices for variable \(k\) in
year \(y\) from the previous step ,\(n_w\) is the number of weeks in
each month \(m\) as:
\[\bar{Y}^{fut'}_{k,y,m} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{fut'}_{k,y,w}\]\\
for area weighted SEBS and NEBS bias corrected values. Similarly we used
the following for monthly strata values:\\
\[\bar{Y}^{fut'}_{k,s,y,m} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{fut'}_{k,s,y,w}\]
similarly NEBS and SEBS monthly averages and strata monthly averages for
the hindcast were calculated as:
\[\bar{Y}^{hind}_{k,y,m} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{hind}_{k,y,w}\]
\[\bar{Y}^{hind}_{k,s,y,m} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{hind}_{k,s,y,w}\]
\hypertarget{seasonal-indices}{%
\subsection{Seasonal indices}\label{seasonal-indices}}
Using the bias corrected weekly or strata x weekly indices, we then
generated seasonal indices for each season \(l\) each year \(y\).
\[\bar{Y}_{k,y,l}= \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}_{k,y,w}\], where
\(\bar{Y}_{w,y,k}\) are the weekly average indices for variable \(k\) in
year \(y\) from the previous step ,\(n_w\) is the number of weeks in
each seasonal \(l\) as:
\[\bar{Y}^{fut'}_{k,y,l} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{fut'}_{k,y,w}\]\\
for area weighted SEBS and NEBS bias corrected values. Similarly we used
the following for seasonal strata values:\\
\[\bar{Y}^{fut'}_{k,s,y,l} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{fut'}_{k,s,y,w}\]
similarly NEBS and SEBS seasonal averages and strata seasonal averages
for the hindcast were calculated as:
\[\bar{Y}^{hind}_{k,y,l} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{hind}_{k,y,w}\]
\[\bar{Y}^{hind}_{k,s,y,l} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{hind}_{k,s,y,w}\]
\hypertarget{annual-indices}{%
\subsection{Annual indices}\label{annual-indices}}
Using the bias corrected weekly or strata x weekly indices, we then
generated seasonal indices for each year \(y\).
\[\bar{Y}_{k,y}= \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}_{k,y,w}\], where
\(\bar{Y}_{w,y,k}\) are the weekly average indices for variable \(k\) in
year \(y\) from the previous step ,\(n_w\) is the number of weeks in
each year \(y\) as:
\[\bar{Y}^{fut'}_{k,y} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{fut'}_{k,y,w}\]\\
for area weighted SEBS and NEBS bias corrected values. Similarly we used
the following for annual strata values:\\
\[\bar{Y}^{fut'}_{k,s,y} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{fut'}_{k,s,y,w}\]
similarly NEBS and SEBS annual averages and strata annual averages for
the hindcast were calculated as:
\[\bar{Y}^{hind}_{k,y} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{hind}_{k,y,w}\]
\[\bar{Y}^{hind}_{k,s,y} = \frac{1}{n_w}\sum^{n_w}_{w}\bar{Y}^{hind}_{k,s,y,w}\]
\hypertarget{annual-survey-rep.-indices}{%
\subsection{Annual survey rep.
indices}\label{annual-survey-rep.-indices}}
Uses the station specific survey replicated (in time and space) data
(`ACLIMsurveyrep') to generate strata-specific averages in order to
generate the strata area-weighted averages for each year \(y\).
\[\bar{Y}_{y,k}= \frac{\sum^{n_s}_{l}(\frac{1}{n_i}\sum^{n_i}_{i}Y_{k,y,s,i})*A_s} {\sum^{n_s}_{s}{A_s}}\],
where \(Y_{k,y,s,i}\) is the value of the variable \(k\) at station
\(i\) in strata \(s\) in year \(y\), \(A_s\) is the area of strata
\(s\), \(n_i\) is the number of stations in strata \(s\), and \(n_s\) is
the number of strata \(s\) in each basin (NEBS or SEBS).
\(\bar{Y}_{y,k}\) was calculated for the hindcast, historical run, and
projection time-series. For projections \(\bar{Y}_{y,k}\) was bias
corrected using the corresponding historical and hindcast values such
that:
\[\bar{Y}^{fut'}_{y,k} =\bar{Y}^{hind}_{k} +\left( \frac{\sigma^{hind}_{k}}{\sigma^{hist}_{k}}*(\bar{Y}^{fut}_{y,k}-\bar{Y}^{hist}_{k}) \right )\],
where \(\bar{Y}^{hind}_{k}\) and \(\bar{Y}^{hist}_{k}\) are the average
historical values across years in the reference period (1980 to 2012 ;
adjustable in \texttt{R/setup.R}).
Appendix A includes the code used to generate the ACLIM2 indices and
bias correct them. That code can be run to re-make the indices if you
like but takes approx 30 mins a CMIP to run.
\hypertarget{plot-concat-indices}{%
\section{Plot \& concat Indices}\label{plot-concat-indices}}
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){[}\url{https://kkh2022.shinyapps.io/ACLIM2_indices/}{]}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{ tmpwd}\OtherTok{\textless{}{-}}\FunctionTok{getwd}\NormalTok{()}
\FunctionTok{setwd}\NormalTok{(}\StringTok{"R/shiny\_aclim/ACLIM2\_indices"}\NormalTok{) }
\NormalTok{ shiny}\SpecialCharTok{::}\FunctionTok{runApp}\NormalTok{(}\StringTok{"app.R"}\NormalTok{)}
\FunctionTok{setwd}\NormalTok{(tmpwd)}
\CommentTok{\# alternatively you can extract the data you want using the get\_var()function}
\NormalTok{ df }\OtherTok{\textless{}{-}} \FunctionTok{get\_var}\NormalTok{(}\AttributeTok{typeIN =} \StringTok{"annual"}\NormalTok{,}\AttributeTok{plotvar =} \StringTok{"temp\_bottom5m"}\NormalTok{,}\AttributeTok{plothist =}\NormalTok{ F)}
\NormalTok{ df}\SpecialCharTok{$}\NormalTok{plot}
\FunctionTok{head}\NormalTok{(df}\SpecialCharTok{$}\NormalTok{dat)}
\end{Highlighting}
\end{Shaded}
\begin{figure}
\centering
\includegraphics[width=1\textwidth,height=\textheight]{Figs/biascorrected_temp2.png}
\caption{``Raw (top row) and bias corrected (bottom row)bottom
temperature indices based on survey replicated Level3 outputs for the
SEBS''}
\end{figure}
\hypertarget{continuous-timeseries-of-hind-fut}{%
\subsection{Continuous timeseries of hind +
fut}\label{continuous-timeseries-of-hind-fut}}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{suppressMessages}\NormalTok{(}\FunctionTok{source}\NormalTok{(}\StringTok{"R/make.R"}\NormalTok{)) }
\NormalTok{ scens }\OtherTok{\textless{}{-}} \FunctionTok{c}\NormalTok{(}\StringTok{"ssp126"}\NormalTok{, }\StringTok{"ssp585"}\NormalTok{)}
\NormalTok{ GCMs }\OtherTok{\textless{}{-}} \FunctionTok{c}\NormalTok{(}\StringTok{"miroc"}\NormalTok{, }\StringTok{"gfdl"}\NormalTok{, }\StringTok{"cesm"}\NormalTok{ )}
\CommentTok{\# get the variable you want:}
\NormalTok{ df }\OtherTok{\textless{}{-}} \FunctionTok{get\_var}\NormalTok{( }\AttributeTok{typeIN =} \StringTok{"annual"}\NormalTok{, }
\AttributeTok{plotvar =} \StringTok{"temp\_bottom5m"}\NormalTok{,}
\AttributeTok{bcIN =} \FunctionTok{c}\NormalTok{(}\StringTok{"raw"}\NormalTok{,}\StringTok{"bias corrected"}\NormalTok{),}
\AttributeTok{CMIPIN =} \FunctionTok{c}\NormalTok{(}\StringTok{"K20P19\_CMIP5"}\NormalTok{,}\StringTok{"K20P19\_CMIP6"}\NormalTok{), }
\AttributeTok{plothist =}\NormalTok{ T, }\CommentTok{\# ignore the hist runs}
\AttributeTok{removeyr1 =}\NormalTok{ T) }\CommentTok{\# "Remove first year of projection ( burn in)")}
\NormalTok{ df}\SpecialCharTok{$}\NormalTok{plot}\SpecialCharTok{+}\FunctionTok{coord\_cartesian}\NormalTok{(}\AttributeTok{ylim =} \FunctionTok{c}\NormalTok{(}\DecValTok{0}\NormalTok{, }\DecValTok{10}\NormalTok{))}
\end{Highlighting}
\end{Shaded}
\begin{center}\includegraphics{ACLIM2_quickStart_files/figure-latex/ts-1} \end{center}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{head}\NormalTok{(df}\SpecialCharTok{$}\NormalTok{dat)}
\CommentTok{\# concat the hind and fut runs by removing years from projection}
\NormalTok{ stitchDate }\OtherTok{\textless{}{-}} \StringTok{"2020{-}12{-}30"}
\NormalTok{ newdat }\OtherTok{\textless{}{-}} \FunctionTok{stitchTS}\NormalTok{(}\AttributeTok{dat =}\NormalTok{ df}\SpecialCharTok{$}\NormalTok{dat,}
\AttributeTok{maxD =}\NormalTok{ stitchDate)}
\CommentTok{\# newdat has the full set of data}
\CommentTok{\# select miroc\_ssp126}
\FunctionTok{head}\NormalTok{(newdat}\SpecialCharTok{\%\textgreater{}\%}\NormalTok{dplyr}\SpecialCharTok{::}\FunctionTok{filter}\NormalTok{(GCM\_scen}\SpecialCharTok{==}\FunctionTok{paste0}\NormalTok{(GCMs[}\DecValTok{1}\NormalTok{],}\StringTok{"\_"}\NormalTok{,scens[}\DecValTok{1}\NormalTok{])))}
\FunctionTok{tail}\NormalTok{(newdat}\SpecialCharTok{\%\textgreater{}\%}\NormalTok{dplyr}\SpecialCharTok{::}\FunctionTok{filter}\NormalTok{(GCM\_scen}\SpecialCharTok{==}\FunctionTok{paste0}\NormalTok{(GCMs[}\DecValTok{1}\NormalTok{],}\StringTok{"\_"}\NormalTok{,scens[}\DecValTok{1}\NormalTok{])))}
\NormalTok{ pp }\OtherTok{\textless{}{-}} \FunctionTok{plotTS}\NormalTok{(newdat}\SpecialCharTok{\%\textgreater{}\%}\FunctionTok{mutate}\NormalTok{(}\AttributeTok{mn\_val=}\NormalTok{val\_use) )}