-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple_MixFishSim_Example_HabTest.Rmd
691 lines (542 loc) · 19.3 KB
/
Simple_MixFishSim_Example_HabTest.Rmd
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
---
title: "Simple MixFishSim Example"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Simple MixFishSim Example}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
This is a simple example of how to use \textbf{'MixFishSim'} to generate
simulations of the dynamics in a mixed fishery. We describe how to calibrate
the habitat fields, the population models, the fishery model and implement a
simple fixed spatial closure. \\
First, load the packages and set a seed for reproducibility.
# Load MixFishSim
```{r packages}
#install.packages('devtools')
#install.packages('githubinstall')
#library(devtools)
#library(githubinstall)
#githubinstall("MixFishSim")
#install_github("pdolder/MixFishSim")
#install.packages('Rcpp')
#install.packages('Rtools')
#install.packages('MixFishSim')
library(MixFishSim)
library(knitr)
opts_chunk$set(tidy = TRUE)
#library(reshape2)
set.seed(123)
```
# Initialise the simulation
This vignette is a paired down example of how to construct a simulation using
MixFishSim. We include only a basic example and encourage users to explore the
other features of the package. \\
## Base parameters
First we specify the basic parameters of the simulation. This includes the
dimensions of the spatial domain, the number of years to simulate, the number
of fleets and vessels per fleet and the number of species and how often (in
weeks) the fish move.
The object returned is used internally by MixFishSim a list with two levels:
* sim$idx : The different units of different processes
* sim$brk.idx: breaks for each of the key processes in units of a timestep
```{r basic}
sim <- init_sim(nrows = 100, ncols = 100, n_years = 2, n_tows_day = 4,
n_days_wk_fished = 5, n_fleets = 2, n_vessels = 20, n_species =
6, move_freq = 2)
class(sim)
sim$idx
names(sim$brk.idx)
```
## Habitat setup
This function creates the spatial fields which support the fish populations and
determine their spatial distributions. You define the parameters for the
matern covariance function for each population and optionally the location of
any spawning closure areas.
It returns a list of suitable habitat for each species (hab), the habitat as
adjusted during the spawning period (spwn_hab) and the binary location of
spawning areas (spwn_loc). It also returns the locations as x1,x2,y1,y2 and the
multiplier of attractiveness to the spawning area during spawning periods
(spwn_mult).
If plot.dist = TRUE, it returns the plots to a file.
```{r habitat}
source("R/BENS_create_hab.R")
source("R/BENS_plot_habitat.R")
#setup controls outside to use in muiltiple places
# #original from example script
# spp.ctrl = list(
# "spp.1" = list('nu' = 1/0.015,
# 'var' = 1,
# 'scale' = 1,
# 'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
# "spp.2" = list('nu' = 1/0.05,
# 'var' = 2,
# 'scale' = 12,
# 'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
# plot.dist = TRUE,
# plot.file = "C:/Users/benjamin.levy/Desktop/Github/READ-PDB-blevy2-toy/testfolder"
# )
#vary nu
spp.ctrl = list(
"spp.1" = list('nu' = .5,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.2" = list('nu' = 2,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.3" = list('nu' = 20,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.4" = list('nu' = 45,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.5" = list('nu' = 1/0.015, #66
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.6" = list('nu' = 100,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#vary var
spp.ctrl = list(
"spp.1" = list('nu' = 66,
'var' = .5,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.2" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.3" = list('nu' = 66,
'var' = 3,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.4" = list('nu' = 66,
'var' = 10,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.5" = list('nu' = 66,
'var' = 30,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.6" = list('nu' = 66,
'var' = 100,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#vary scale
spp.ctrl = list(
"spp.1" = list('nu' = 66,
'var' = 1,
'scale' = .5,
'Aniso' = matrix(nc = 2, c(0.1, -2, 1, 0.2))),
"spp.2" = list('nu' = 66,
'var' = 1,
'scale' = 2,
'Aniso' = matrix(nc = 2, c(0.1, -2, 1, 0.2))),
"spp.3" = list('nu' = 66,
'var' = 1,
'scale' = 6,
'Aniso' = matrix(nc = 2, c(0.1, -2, 1, 0.2))),
"spp.4" = list('nu' = 66,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(0.1, -2, 1, 0.2))),
"spp.5" = list('nu' = 66,
'var' = 1,
'scale' = 20,
'Aniso' = matrix(nc = 2, c(0.1, -2, 1, 0.2))),
"spp.6" = list('nu' = 66,
'var' = 1,
'scale' = 50,
'Aniso' = matrix(nc = 2, c(0.1, -2, 1, 0.2))),
plot.dist = TRUE,
plot.file = "testfolder"
)
set.seed(123)
#vary scale to recreate out population 1 supplemental images from publication
spp.ctrl = list(
"spp.1" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 6,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.2" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 7,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.3" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 8,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.4" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 9,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.5" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
"spp.6" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 11,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#vary scale to recreate out population 2 supplemental images from publication
spp.ctrl = list(
"spp.1" = list('nu' = 1/0.05,
'var' = 2,
'scale' = 8,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
"spp.2" = list('nu' = 1/0.05,
'var' = 2,
'scale' = 9,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
"spp.3" = list('nu' = 1/0.05,
'var' = 2,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
"spp.4" = list('nu' = 1/0.05,
'var' = 2,
'scale' = 11,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
"spp.5" = list('nu' = 1/0.05,
'var' = 2,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
"spp.6" = list('nu' = 1/0.05,
'var' = 2,
'scale' = 13,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#vary Aniso
spp.ctrl = list(
"spp.1" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1,0,0,1))),
"spp.2" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1,-1,1,-1))),
"spp.3" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1, 2, -1, 2))),
"spp.4" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(-1,-1,-1,-1))),
"spp.5" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1, -1.5, 1.5, 2))),
"spp.6" = list('nu' = 66,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1.5, 3, -3, 4))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#vary Aniso with SW-NE similarity (opposite antidiag sign)
spp.ctrl = list(
"spp.1" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -1, 1, 1))),
"spp.2" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.3" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.4" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.5" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.6" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#vary Aniso with SW-NE similarity (opposite antidiag sign)
spp.ctrl = list(
"spp.1" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -1, 1, 1))),
"spp.2" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.3" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.4" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.5" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.6" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 10,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
plot.dist = TRUE,
plot.file = "testfolder"
)
#tests of generic setups to hone in on appropriate scale value
spp.ctrl = list(
"spp.1" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 2,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.2" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 12,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.3" = list('nu' = 1/0.05,
'var' = 1,
'scale' = 20,
'Aniso' = matrix(nc = 2, c(1, -2, 1, 2))),
"spp.4" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 40,
'Aniso' = matrix(nc = 2, c(1.5, -3, 3, 4))),
"spp.5" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 50,
'Aniso' = matrix(nc = 2, c(1.5, -3, 3, 4))),
"spp.6" = list('nu' = 1/0.015,
'var' = 1,
'scale' = 60,
'Aniso' = matrix(nc = 2, c(1.5, -3, 3, 4))),
plot.dist = TRUE,
plot.file = "testfolder"
)
source("R/BENS_create_hab.R")
source("R/BENS_plot_habitat.R")
hab <- BENS_create_hab(sim_init = sim,
spp.ctrl = spp.ctrl,
spawn_areas = list(
"spp1" = list(
'area1' = c(2,5,2,5), #of the form c(x1, x2, y1, y2) THESE ARE BOUNDARIES OF MATRIX VALUES
'area2' = c(6,8,6,8) #of the form c(x1, x2, y1, y2) IE, X FROM 2 TO 5 AND Y FROM 2 TO 5
),
"spp2" = list(
'area1' = c(5,6,6,6)
),
"spp3" = list(
'area1' = c(2,5,2,5), #of the form c(x1, x2, y1, y2) THESE ARE BOUNDARIES OF MATRIX VALUES
'area2' = c(6,8,6,8) #of the form c(x1, x2, y1, y2) IE, X FROM 2 TO 5 AND Y FROM 2 TO 5
),
"spp4" = list(
'area1' = c(5,6,6,6)
),
"spp5" = list(
'area1' = c(2,5,2,5), #of the form c(x1, x2, y1, y2) THESE ARE BOUNDARIES OF MATRIX VALUES
'area2' = c(6,8,6,8) #of the form c(x1, x2, y1, y2) IE, X FROM 2 TO 5 AND Y FROM 2 TO 5
),
"spp6" = list(
'area1' = c(5,6,6,6)
),
spwn_mult = 10,
plot.dist = TRUE,
plot.file = "testfolder" ),
#created this new part defining strata
strata = list( #Form: upper left, upper right, lower left, lower right
"strata1" = c(1,sim$idx[["nrows"]]/2,1,sim$idx[["ncols"]]/2), #of the form c(x1, x2, y1, y2) THESE ARE BOUNDARIES OF STRATA VALUES
"strata2" = c(1,sim$idx[["nrows"]]/2,sim$idx[["ncols"]]/2+1,sim$idx[["ncols"]]),
"strata3" = c(sim$idx[["nrows"]]/2 + 1,sim$idx[["nrows"]], 1 ,sim$idx[["ncols"]]/2),
"strata4" = c(sim$idx[["nrows"]]/2 + 1,sim$idx[["nrows"]],sim$idx[["ncols"]]/2 +1 , sim$idx[["ncols"]])
)
)
#print(hab)
source("R/BENS_plot_habitat.R")
## Plot the unadjusted habitat fields
BENS_plot_habitat(hab = hab$hab, spp.ctrl = spp.ctrl)
#old version
plot_habitat(hab$hab)
## Plot the adjusted habitat fields
plot_habitat(hab$spwn_hab)
```
## Population models
Now we need to set up the population models for the simulations. We do this
with the init_pop function. We set the initial population biomasses, movement
rates, recruitment parameter and growth and natural mortality rates.
The object created stores all the starting conditions and containers for
recording the changes in the populations during the simulations.
We can plot the starting distributions for each population as a check.
```{r pop_init}
Pop <- init_pop(sim_init = sim, Bio = c("spp1" = 1e5, "spp2" = 1e5),
hab = hab[["hab"]], start_cell = c(5,5),
lambda = c("spp1" = 0.1, "spp2" = 0.1),
init_move_steps = 20,
rec_params = list("spp1" = c("model" = "BH", "a" = 54, "b" = 2, "cv" = 0.7),
"spp2" = c("model" = "BH", "a" = 27, "b" = 4,"cv" = 0.3)),
rec_wk = list("spp1" = 3:6, "spp2" = 4:8),
spwn_wk = list("spp1" = 4:8, "spp2" = 4:8),
M = c("spp1" = 0.2, "spp2" = 0.2),
K = c("spp1" = 0.3, "spp2" = 0.3)
)
names(Pop)
Pop$dem_params
image(Pop$Start_pop[[1]], main = "spp1 starting biomass")
image(Pop$Start_pop[[2]], main = "spp2 starting biomass")
```
## Population movement
Now we set up the population tolerance to different temperatures which
determines how the populations move during the course of a year. We can then
plot the combined spatiotemporal suitable habitat to examine how these
interact.
```{r temp}
moveCov <- init_moveCov(sim_init = sim, steps = 52,
spp_tol = list("spp1" = list("mu" = 12, "va" = 8),
"spp2" = list("mu" = 15, "va" = 7)
)
)
plot(norm_fun(x = 0:25, mu = 12, va = 8)/max(norm_fun(0:25, 12, 8)),
type = "l", xlab = "Temperature", ylab = "Tolerance", lwd = 2)
lines(norm_fun(x = 0:25, mu = 15, va = 7)/ max(norm_fun(0:25, 15, 7)),
type = "l", col = "blue", lwd = 2)
legend(x = 2, y = 0.9, legend = c("spp1", "spp2"), lwd = 2, col = c("black", "blue"))
plot_spatiotemp_hab(hab = hab, moveCov = moveCov, spwn_wk = list("spp1" = 4:8, "spp2" = 4:8), plot.file = "testfolder")
```
## Fleet models
Here we initialise the fleet with fish landings price per tonne, catchability
coefficients per population, fuel cost, the coefficients for the step function
and fleet behaviour.
We can plot the behaviour of the step function to check its suitable for our
simulations. This determines the relationship between the monetary value gained
from a fishing tow and the next move by the vessel when using the correlated
random walk function.
```{r fleets}
fleets <- init_fleet(sim_init = sim, VPT = list("spp1" = 4, "spp2" = 3),
Qs = list("fleet 1" = c("spp1" = 1e-5, "spp2" = 3e-5),
"fleet 2" = c("spp1" = 5e-5, "spp2" = 1e-5)
),
fuelC = list("fleet1" = 3, "fleet 2" = 8),
step_params = list("fleet 1" = c("rate" = 3, "B1" = 1, "B2" = 2, "B3" = 3),
"fleet 2" = c("rate" = 3, "B1" = 2, "B2" = 4, "B3" = 4)
),
past_knowledge = TRUE,
past_year_month = TRUE,
past_trip = TRUE,
threshold = 0.7
)
test_step(step_params = fleets$fleet_params[[1]]$step_params, rev.max = 1e2)
test_step(step_params = fleets$fleet_params[[2]]$step_params, rev.max = 1e2)
```
## Spatial closure
We set up a spatial closure. There are multiple options in defining
this, but we simply define a static fixed site closure for demonstration
purposes.
```{r close}
#practice creating a larger data.frame than just single points
library(tidyr)
#set x and y min/max which are coordinates on the grid
xmin <- 6
xmax <- 10
ymin <- 26
ymax <- 40
x <- xmin:xmax
y<- ymin:ymax
#View(crossing(x,y))
closure <- init_closure(input_coords = data.frame(x = x, y = y),
spp1 = "spp1", year_start = 2)
```
## Survey
Its also possible to define a survey design using the init_survey function, but
we do not do so for this demonstration. Please refer to the function help file
if this is required.
```{r survey}
source("R/BENS_init_survey.R")
surv_fixed <- BENS_init_survey(sim_init = sim,design = 'fixed_station', n_stations = 50, start_day = 1, stations_per_day = 5, Qs = c("spp1" = 0.1, "spp2"= 0.2))
#CURRENTLY NEED TO MAKE SURE THAT N_STATIONS*#YEARS / #STRATA IS A WHOLE NUMBER OTHERWISE DAY, TOW, YEAR WONT LINEUP WITH NUMBER OF STATIONS
#ALSO NEED N_STATION TO BE DIVISIBLE BY STATIONS_PER_DAY
surv_random <- BENS_init_survey(sim_init = sim,design = 'random_station', n_stations = 50, start_day = 1, stations_per_day = 5, Qs = c("spp1" = 0.1, "spp2"= 0.2), strata_coords = hab$strata, strata_num = hab$stratas )
```
## Run simulation
Finally we run the simulation. The output is a list of objects containing all
the information on fisheries catches, the population dynamics and population
distributions. These can be examined with some inbuilt plotting functions.
```{r sim}
source("R/run_sim.R")
res <- run_sim(sim_init = sim,
pop_init = Pop,
move_cov = moveCov,
fleets_init = fleets,
hab_init = hab,
save_pop_bio = TRUE,
survey = surv_fixed,
closure = closure,
InParallel = TRUE)
```
## Summary plots
There are a series of input plotting functions to visualise the results of the
simulation. For example, we can explore:
* the population dynamics for each species
* Seasonal patterns in exploitation
* the location choice of a vessel
* the realised step function for a vessel
Users will wish to define their own plots, depending on the issues of interest
and all the results are saved in the output from the run_sim function.
```{r plots}
## Biological
p1 <- plot_pop_summary(results = res,
timestep = "annual",
save = TRUE,
save.location = "C:/Users/benjamin.levy/Desktop/Github/READ-PDB-blevy2-toy/testfolder"
)
plot_pop_summary(results = res, timestep = "daily", save = TRUE, save.location = "C:/Users/benjamin.levy/Desktop/Github/READ-PDB-blevy2-toy/testfolder")
p1
p2 <- plot_daily_fdyn(res)
p2
## Fishery
logs <- combine_logs(res[["fleets_catches"]])
p3 <- plot_vessel_move(sim_init = sim, logs = logs, fleet_no = 1, vessel_no = 5,
year_trip = 5, trip_no = 10)
p3
p4 <- plot_realised_stepF(logs = logs, fleet_no = 1, vessel_no = 1)
p4
#try some new ones
#plot survey 2 ways
p5 <- plot_survey(survey = res$survey, type = "spatial")
p5
p6 <- plot_survey(survey = res$survey, type = "index")
p6
#spatio temporal population plots
source("R/Bens_plot_pop_spatiotemp.R")
p7 <- Bens_plot_pop_spatiotemp(results = res,
save = TRUE,
save.location = "C:/Users/benjamin.levy/Desktop/Github/READ-PDB-blevy2-toy/testfolder"
)
p7
```
Note in our example how the fishing mortality rate for species 2 changes
following the spatial closure, which was set to cover some of the core
distribution of the population.