1 : |
ulcessvp |
10 |
####################################################################################################
|
2 : |
|
|
# SOURCE FILE TO RUN ALL PLOT-SCRIPTS
|
3 : |
|
|
# From this source-script we can execute the 3 kinds of plots groups (diagnosis, results and
|
4 : |
|
|
# projections) together or separately in one or three pdf documents selecting pdfPlot TRUE or FALSE
|
5 : |
|
|
# created: camilo.saavedra@vi.ieo.es (02/07/2013)
|
6 : |
|
|
####################################################################################################
|
7 : |
|
|
|
8 : |
|
|
# VERY IMPORTANT: Set working directory to source file location
|
9 : |
|
|
# setwd("~/scripts/")
|
10 : |
|
|
|
11 : |
|
|
# Select some figures before plotting. Name and number of documents withing plots
|
12 : |
|
|
runN <- "1" # Ordinal number of the run
|
13 : |
|
|
load("R.data/annualUpdate.RData") # Load annual updated data used for pdf names
|
14 : |
|
|
|
15 : |
|
|
##################### CHOOSE HOW DO YOU WANT TO PRINT YOUR PLOTS ###################################
|
16 : |
|
|
|
17 : |
|
|
# Executing pdf objects: The four pdf objects must be executed
|
18 : |
|
|
pdfPlot <- FALSE # If TRUE writes all plots in one pdf, if FALSE writes each plot in various pdf
|
19 : |
|
|
pdfDiag <- FALSE # If TRUE writes all diagnosis plots in one pdf, if FALSE writes in various pdf
|
20 : |
|
|
pdfResu <- FALSE # If TRUE writes all results plots in one pdf, if FALSE writes in various pdf
|
21 : |
|
|
pdfPrj <- FALSE # If TRUE writes all projections plots in one pdf, if FALSE writes in various pdf
|
22 : |
|
|
|
23 : |
|
|
# Check and transform all pdf objects to FALSE if pdfPlot is TRUE
|
24 : |
|
|
if(pdfPlot) {pdfDiag <- FALSE; pdfResu <- FALSE; pdfProj <- FALSE}
|
25 : |
|
|
|
26 : |
|
|
################################## PLOTS ###########################################################
|
27 : |
|
|
|
28 : |
|
|
# Select the working directory to execute the next source scripts
|
29 : |
|
|
wd <- getwd()
|
30 : |
|
|
|
31 : |
|
|
# Opens pdf document if we want to plot all figures in the same document (pdfPlot=TRUE)
|
32 : |
|
|
if(pdfPlot) {
|
33 : |
|
|
plotName <- paste("WGHMM", substr((lastYear+1), 3,4), ".", runN, sep="") # pdf name
|
34 : |
|
|
pdf(file=paste("../plots/", plotName, ".pdf", sep=""), height=7, width=10.5)}
|
35 : |
|
|
|
36 : |
|
|
############################### Diagnosis plots ####################################################
|
37 : |
|
|
|
38 : |
|
|
setwd(paste(wd, "/scripts.diag", sep=""))
|
39 : |
|
|
|
40 : |
|
|
if(pdfDiag) {
|
41 : |
|
|
plotName <- paste("WGHMM", substr((lastYear+1), 3,4), ".", runN, sep="") # pdf name
|
42 : |
|
|
pdf(file=paste("../../plots/plots.diag/", plotName, ".Diag",".pdf", sep=""), height=7, width=10.5)}
|
43 : |
|
|
|
44 : |
|
|
##### Convergence plots #####
|
45 : |
|
|
#source ("plot_Sensitivity.r")
|
46 : |
|
|
# input function: "../functions/pdfPlot.r"
|
47 : |
|
|
# input file: "../../model/sens.txt"
|
48 : |
|
|
# output plot: "../../plots/plots.diag/plot_SensFree.pdf"
|
49 : |
|
|
# output plot: "../../plots/plots.diag/plot_SensFix.pdf"
|
50 : |
|
|
|
51 : |
|
|
##### Summary of likelihood scores #####
|
52 : |
|
|
source ("plot_LikeSummary.r")
|
53 : |
|
|
# input function: "../functions/pdfPlot.r"
|
54 : |
|
|
# input file: "../../out/hke.lik.summ.out"
|
55 : |
|
|
# output plot: "../../plots/plots.diag/plot_LikeWeight.pdf"
|
56 : |
|
|
# output plot: "../../plots/plots.diag/plot_LikeSumm.pdf"
|
57 : |
|
|
|
58 : |
|
|
##### Catchability in abundance indices (sp and pt surveys) by 15 cm length class #####
|
59 : |
|
|
source ("plot_INDEX.r")
|
60 : |
|
|
# input function: "../functions/pdfPlot.r"
|
61 : |
|
|
# input file for every length range (N = 1:3 ranges): "../../out/SpIndex15.N.print"
|
62 : |
|
|
# output plot: "../plots/plots.diag/plot_INDEX-ObsExp.pdf"
|
63 : |
|
|
|
64 : |
|
|
##### Catchability in abundance indices (sp and pt) by 15cm length class (25-40; 40-55; 55-70) #####
|
65 : |
|
|
source ("plot_CPUE.r")
|
66 : |
|
|
# input function: "../functions/pdfPlot.r"
|
67 : |
|
|
# input file: "../../out/SpCPUE15cm.1.print"
|
68 : |
|
|
# input file: "../../out/SpCPUE15cm.2.print"
|
69 : |
|
|
# input file: "../../out/SpCPUE15cm.3.print"
|
70 : |
|
|
# input file: "../../data/ld-15cm-sp_cpue.in"
|
71 : |
|
|
# input file: "../../out/Sp85CPUE15cm.1.print"
|
72 : |
|
|
# input file: "../../out/Sp85CPUE15cm.2.print"
|
73 : |
|
|
# input file: "../../out/Sp85CPUE15cm.3.print"
|
74 : |
|
|
# input file: "../../data/ld-15cm-sp_cpue85.in"
|
75 : |
|
|
# input file: "../../out/PtCPUE15cm.1.print"
|
76 : |
|
|
# input file: "../../out/PtCPUE15cm.2.print"
|
77 : |
|
|
# input file: "../../out/PtCPUE15cm.3.print"
|
78 : |
|
|
# input file: "../../data/ld-15cm-pt_cpue.in"
|
79 : |
|
|
# output plot: "../plots/plots.diag/plot_CPUE-ObsExp.pdf"
|
80 : |
|
|
|
81 : |
|
|
##### Landings observed and expected (histogram and density plots) #####
|
82 : |
|
|
source ("plot_ObsExp.r")
|
83 : |
|
|
# input function: "../functions/pdfPlot.r"
|
84 : |
|
|
# input file: "../../out/expected.landings.ld"
|
85 : |
|
|
# input file: "../../out/expected.landings1.ld"
|
86 : |
|
|
# input file: "../../out/expected.cdlandings.ld"
|
87 : |
|
|
# input file: "../../out/expected.discards.ld"
|
88 : |
|
|
# input file: "../../out/expected-sp_surv.ld"
|
89 : |
|
|
# input file: "../../out/expected-pt_surv.ld"
|
90 : |
|
|
# input file: "../../out/expected-cdAut_surv.ld"
|
91 : |
|
|
# input file: "../../data/ld-2cm-land82-93.in"
|
92 : |
|
|
# input file: "../../data/ld-2cm-land94-end.in"
|
93 : |
|
|
# input file: "../../data/ld-2cm-land-Cd94-04.in"
|
94 : |
|
|
# input file: "../../data/ld-2cm-disc.in"
|
95 : |
|
|
# input file: "../../data/ld-2cm-sp-surv.in"
|
96 : |
|
|
# input file: "../../data/ld-2cm-cdAut-surv.in"
|
97 : |
|
|
# input file: "../../data/ld-2cm-pt-surv.in"
|
98 : |
|
|
# output plot: "../../plots/plots.diag/plot_ObsExp.pdf"
|
99 : |
|
|
# output plot: "../../plots/plots.diag/plot_ObsExpSurvey.pdf"
|
100 : |
|
|
|
101 : |
|
|
##### Landings observed and expected (bubles plots) #####
|
102 : |
|
|
source ("plot_ObsExpBuble.r")
|
103 : |
|
|
# input function: "../functions/pdfPlot.r"
|
104 : |
|
|
# input file: "../../model/hke.likelihood"
|
105 : |
|
|
# input file: "../../out/expected.landings1.ld"
|
106 : |
|
|
# input file: "../../out/expected.landings.ld"
|
107 : |
|
|
# input file: "../../out/expected.cdlandings.ld"
|
108 : |
|
|
# input file: "../../out/expected.discards.ld"
|
109 : |
|
|
# input file: "../../out/expected-sp_surv.ld"
|
110 : |
|
|
# input file: "../../out/expected-pt_surv.ld"
|
111 : |
|
|
# input file: "../../out/expected-cdAut_surv.ld"
|
112 : |
|
|
# output plot: "../../plots/plots.diag/plots_ObsExpBuble.pdf"
|
113 : |
|
|
# output plot: "../../plots/plots.diag/plots_ObsExpBubleSurvey.pdf"
|
114 : |
|
|
|
115 : |
|
|
if (pdfDiag){dev.off()}
|
116 : |
|
|
setwd(wd)
|
117 : |
|
|
|
118 : |
|
|
############################# Results plots ########################################################
|
119 : |
|
|
|
120 : |
|
|
setwd(paste(wd, "/scripts.results", sep=""))
|
121 : |
|
|
|
122 : |
|
|
if(pdfResu) {
|
123 : |
|
|
plotName <- paste("WGHMM", substr((lastYear+1), 3,4), ".", runN, sep="") # pdf name
|
124 : |
|
|
pdf(file=paste("../../plots/plots.results/", plotName, ".Results",".pdf", sep=""), height=7, width=10.5)}
|
125 : |
|
|
|
126 : |
|
|
##### PLot selectivity for sp and pt survey and for total catches ######
|
127 : |
|
|
#source("plot_Selectivity.r")
|
128 : |
|
|
# input function: "../functions/pdfPlot.r"
|
129 : |
|
|
# input function: "../functions/logit.r"
|
130 : |
|
|
# input function: "../functions/andersen.r"
|
131 : |
|
|
# input file: "../../model/params.out"
|
132 : |
|
|
# output file: "../../plots/plots.results/plot_SelectPattern.pdf"
|
133 : |
|
|
|
134 : |
|
|
##### PLot growth curve #####
|
135 : |
|
|
source("plot_Growth.r")
|
136 : |
|
|
# input function: "../functions/pdfPlot.r"
|
137 : |
|
|
# source file: "../functions/vonb.r"
|
138 : |
|
|
# input file: "../../model/params.out"
|
139 : |
|
|
# output file: "../../plots/plots.results/plot_GrowthVB.pdf"
|
140 : |
|
|
|
141 : |
|
|
##### Summary tables hkeLen and hkeAge #####
|
142 : |
|
|
source("table_Summary.r")
|
143 : |
|
|
# input data: "../R.data/annualUpdate.RData"
|
144 : |
|
|
# input file: "../../out/hkeLenN.out"
|
145 : |
|
|
# input file: "../../out/hkeLenC.out"
|
146 : |
|
|
# input file: "../../out/hkeLenL.out"
|
147 : |
|
|
# input file: "../../out/hkeLenD.out"
|
148 : |
|
|
# input file: "../../data/RData.matOgives"
|
149 : |
|
|
# input file: "../../out/hkeAgeN.out"
|
150 : |
|
|
# input file: "../../out/hkeAgeC.out"
|
151 : |
|
|
# input file: "../../out/hkeAgeL.out"
|
152 : |
|
|
# input file: "../../out/hkeAgeD.out"
|
153 : |
|
|
# input file: "../../out/hke.std.out"
|
154 : |
|
|
# output data: "../R.data/hakeLen.RData"
|
155 : |
|
|
# output data: "../R.data/hakeAge.RData"
|
156 : |
|
|
# output file: "../../tables/tables.results/hkeLen.csv"
|
157 : |
|
|
# output file: "../../tables/tables.results/hkeAge.csv"
|
158 : |
|
|
|
159 : |
|
|
##### Summary plot Gadget #####
|
160 : |
|
|
source("plot_Summary.r")
|
161 : |
|
|
# input function: "../functions/pdfPlot.r"
|
162 : |
|
|
# input file: "../../tables/tables.results/hkeLen.csv"
|
163 : |
|
|
# input file: "../../tables/tables.results/hkeAge.csv"
|
164 : |
|
|
# output data: "../R.data/sumDat.RData"
|
165 : |
|
|
# output table: "../../tables/tables.results/sumDat.csv"
|
166 : |
|
|
# output table: "../../tables/tables.results/tab_summary.pdf"
|
167 : |
|
|
# output plot: "../../plots/plots.results/plot_StkRec-Refpts.pdf"
|
168 : |
|
|
# output plot: "../../plots/plots.results/plot_Summary.pdf"
|
169 : |
|
|
# output plot: "../../plots/plots.results/FComp.pdf"
|
170 : |
|
|
|
171 : |
|
|
##### F by quarter #####
|
172 : |
|
|
source("plot_FQuarter.r")
|
173 : |
|
|
# input function: "../functions/pdfPlot.r"
|
174 : |
|
|
# input data: "../R.data/annualUpdate.RData"
|
175 : |
|
|
# input file: "../../out/hkeAgeC.out"
|
176 : |
|
|
# output file: "../../plots/plots.results/plot_FQuarter.pdf"
|
177 : |
|
|
|
178 : |
|
|
##### Mean length at age #####
|
179 : |
|
|
source("plot_LenAtAge.r")
|
180 : |
|
|
# input function: "../functions/pdfPlot.r"
|
181 : |
|
|
# input file: "../../out/hke.std.out"
|
182 : |
|
|
# output plot: "../../plots/plots.results/plot_LengthAtAge.pdf"
|
183 : |
|
|
|
184 : |
|
|
##### N and C by length #####
|
185 : |
|
|
source("plot_ByLength.r")
|
186 : |
|
|
#
|