-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
217 lines (151 loc) · 4.76 KB
/
README.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
---
output:
github_document:
html_preview: false
---
[![Build Status](https://travis-ci.org/ices-tools-prod/icesFO.svg?branch=devel)](https://travis-ci.org/ices-tools-prod/icesFO)
[![CRAN Status](http://r-pkg.org/badges/version/icesFO)](https://cran.r-project.org/package=icesFO)
[![CRAN Monthly](http://cranlogs.r-pkg.org/badges/icesFO)](https://cran.r-project.org/package=icesFO)
[![CRAN Total](http://cranlogs.r-pkg.org/badges/grand-total/icesFO)](https://cran.r-project.org/package=icesFO)
[<img align="right" alt="ICES Logo" width="17%" height="17%" src="http://ices.dk/_layouts/15/1033/images/icesimg/iceslogo.png">](http://ices.dk)
icesFO
=======
icesFO Functions to support the creation of ICES Fisheries Overviews, ....
icesFO is implemented as an [R](https://www.r-project.org) package
<!-- and available on [CRAN](https://cran.r-project.org/package=icesFO). -->
and available on GitHub
Installation
------------
icesFO can be installed from GitHub using the `install_github` command from the
`devtools` package:
```R
library(devtools)
install_github("ices-tools-prod/icesFO")
```
Usage
-----
For a summary of the package:
```R
library(icesFO)
?icesFO
```
Development
-----------
icesFO is developed openly on
[GitHub](https://github.com/ices-tools-prod/icesFO).
Feel free to open an
[issue](https://github.com/ices-tools-prod/icesFO/issues) there if you
encounter problems or have suggestions for future versions.
The current development version can be installed using:
```R
library(devtools)
install_github("ices-tools-prod/icesFO@devel")
```
Examples
--------
## Plot ecoregion map
In this example the map of the Greater North Sea ecoregion is plotted
see
```r
?icesFO::plot_ecoregion_map
```
for more details
first download the ices area shape and the ecoregion shape. Both
are converted to sf polygons for easy plotting
```{r download_ecoregion_shape, cache=TRUE}
library(icesFO)
# download data
ices_areas_nrs <- load_areas("Greater North Sea")
ecoregion_nrs <- load_ecoregion("Greater North Sea")
```
then the plot can be made:
```{r plot_ecoregion}
# plot
eco_map <- plot_ecoregion_map(ecoregion_nrs, ices_areas_nrs)
eco_map
```
## Plot ICES official catch statistics
In this example, the plots for ICES official catch statistics for the
Baltic Sea Ecoregion are made. First the data is downloaded and formated
see
```r
?icesFO::plot_catch_trends
```
for more details
```{r download_official_catch, cache=TRUE}
library(icesFO)
# download data
hist <- load_historical_catches()
official <- load_official_catches()
prelim <- load_preliminary_catches(2018)
# format / process
catch_dat <- format_catches(2018, "Baltic Sea Ecoregion", hist, official, prelim)
```
then the plot can be made:
```{r plot_official_catch}
# plot
p <-
plot_catch_trends(catch_dat, type = "COMMON_NAME",
line_count = 5, plot_type = "line")
p
```
## Plot surface swept area ratio plot
In this example the map of the average swept area ration for the
Celtic Sea ecoregion is plotted
see
```r
?icesFO::plot_sar_map
```
for more details
first download the ICES ecoregion shape. Both
are converted to sf polygons for easy plotting
```{r download_ecoregion_shape2, cache=TRUE}
library(icesFO)
# download data
ecoregion_cs <- load_ecoregion("Celtic Seas")
```
Then dowload the SAR data using the icesVMS package.
<div class="alert alert-danger"
<strong>NOTE:</strong> Only users with permission to access aggregated VMS data
can use this service.
</div>
```{r download_sar_shape, cache=TRUE}
remotes::install_github("ices-tools-prod/icesVMS")
library(icesVMS)
# download data
sar <- icesVMS::get_sar_map("Celtic Seas")
# convert to sf
sar$wkt <- sf::st_as_sfc(sar$wkt)
sar <- sf::st_sf(sar, sf_column_name = "wkt", crs = 4326)
```
then the plot can be made:
```{r plot_sar}
# plot
sar_map <- plot_sar_map(sar, ecoregion_cs, what = "subsurface")
sar_map
```
## Plot technical interactions
In this example, the plots of technical interactions between gears are shown
see
```r
?icesFO::compute_technical_interactions
```
for more details
First we get the STECF landings data from the [Baltic Sea Fishery overview repository](https://github.com/ices-taf/2019_BtS_FisheriesOverview).
```{r download_baltic_stecf_data, cache=TRUE}
library(icesTAF)
repoUrl <-
sprintf("https://raw.githubusercontent.com/ices-taf/%s/master/",
"2019_BtS_FisheriesOverview")
STECF_landings <-
read.taf(file.path(repoUrl, "bootstrap/initial/data/STECF_landings.csv"),
fileEncoding = "UTF-8-BOM", check.names = TRUE)
```
then the calculation and plot can be made:
```{r calculate_tech_interaction}
technical_interacton <-
compute_technical_interactions(STECF_landings, catchCoverage = 0.99)
```
```{r plot_tech_interaction}
plot_technical_interactions(technical_interacton$recapLand)
```