-
Notifications
You must be signed in to change notification settings - Fork 0
/
VME_assessment_output_compilation.R
123 lines (81 loc) · 5.31 KB
/
VME_assessment_output_compilation.R
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
#-------------------------------------------------------------------------------------
# Assessment script ICES VME advice
# last update May 2022 (Anna Downie, Daniel van Denderen)
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
# Notes:
# The outputs are generated following the ICES VME benchmark
# workshop. The workshop report can be found here: xxx
# Before running the script, please download all
# VME and VMS restricted data - these data are on the ICES Sharepoint
# they can be obtained by contacting the chairs of the ICES working
# group on Deep Water Ecology:
# https://www.ices.dk/community/groups/pages/wgdec.aspx
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
# step 1 - assessment year, rlibraries and folder structure
#-------------------------------------------------------------------------------------
datacallyear <- 2021 # VME data call year with latest data
datacallyear_VMS <- 2021 # VMS data call year with latest data
# set path to the VME advice folder
pathdir <- "C:/Users/danie/Documents/Online for git/VME-advice"
# set path to the folder with VMS and VME data (restricted data - outside github)
pathdir_nogit <- "C:/Users/danie/Documents/Online for git/VME-advice_noGIT"
# R libraries used
source(paste(pathdir,"Utilities/Libraries_VMEadvice.R",sep="/"))
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
# step 2 - run scenarios and options to obtain VME polygons
#-------------------------------------------------------------------------------------
# create folder for the VME datacall year
dir.create(paste(pathdir,"2-Data processing",paste("VME_polygons",datacallyear,sep="_"),sep="/"))
# run scenario 1 - option 1 & 2 (warnings are okay)
source(paste(pathdir,"Utilities/Scenario_1_option_1.R",sep="/"))
source(paste(pathdir,"Utilities/Scenario_1_option_2.R",sep="/"))
# run scenario 2 - option 1& 2 (warnings are okay)
refyear <- 2009:datacallyear-1 # specify years to estimate sar threshold
SAR_threshold <- 0.43 # SAR threshold value
source(paste(pathdir,"Utilities/Scenario_2_option_1.R",sep="/"))
source(paste(pathdir,"Utilities/Scenario_2_option_2.R",sep="/"))
# run the combined S1-O2 + S2-O1 scenario (warnings are okay)
# termed S2-O3 in all scripts
source(paste(pathdir,"Utilities/Scenario_2_option_3.R",sep="/"))
rm(list=setdiff(ls(), c("datacallyear","datacallyear_VMS","pathdir","pathdir_nogit")))
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
# step 3 - load fishable domains and obtain fishing layers
#-------------------------------------------------------------------------------------
# load EU + NEAFC polygons with fishable domain
source(paste(pathdir,"Utilities/Footprint_current.R",sep="/"))
# obtain fished area based on the latest VMS datacall
refyear_fished <- 2009:2011
newyear_fished <- (datacallyear_VMS-1):(datacallyear_VMS-3)
source(paste(pathdir,"Utilities/Fishedarea_newVMS.R",sep="/"))
# create new folder for the fishing layers based on latest VMS datacall
dir.create(paste(pathdir,"2-Data processing",paste("Fishing_layers",datacallyear_VMS,sep="_"),sep="/"))
# save save(EUFootp,NEAFCFootp,New_comb,New_mobile,New_static, Ref_comb,Ref_mobile,Ref_static,
file=paste(pathdir,"2-Data processing",paste("Fishing_layers",datacallyear_VMS,sep="_"),
"Fishing_workspace.RData",sep="/")
#------------------------------------------------------------------------------------
# Note on fishable domain:
# if ICES is requested to update the EU fishing footprint
# the Footprint_update_newVMS.R can be run (see folder utilities)
#------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------
# step 4 - prepare all outputs to run the rmarkdowns
#-------------------------------------------------------------------------------------
# Note:
# The script will provide all outputs based on the data call year
# it will overwrite any previous version
# to return to a previous year, change the data call year above and re-run the below
source(paste(pathdir,"Utilities/Compile_spatial_data_layers.R",sep="/"))
save.image(file = paste(pathdir,"2-Data processing/Map_layers_workspace.RData",sep="/"))
# compile output for table 1 of the RMarkdown
source(paste(pathdir,"Utilities/Compile_table1_underlyingdata.R",sep="/"))
#------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------
# step 5 - run the RMD files from the output folder
#------------------------------------------------------------------------------------
# EU_VME.RMD
# ICES_Ecoregions_VME.RMD
# NEAFC_VME.RMD (not yet available)