Skip to content

Commit

Permalink
update code to write layers
Browse files Browse the repository at this point in the history
  • Loading branch information
colinpmillar committed Dec 17, 2019
1 parent 58dd84f commit 0538231
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions data.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# Initial formatting of the data

library(icesTAF)
taf.library(icesFO)
library(dplyr)

Expand All @@ -16,8 +17,8 @@ hist <- read.taf("bootstrap/data/ICES_nominal_catches/ICES_historical_catches.cs
official <- read.taf("bootstrap/data/ICES_nominal_catches/ICES_2006_2017_catches.csv")
prelim <- read.taf("bootstrap/data/ICES_nominal_catches/ICES_preliminary_catches.csv")

catch_dat <-
format_catches(2019, "Baltic Sea",
catch_dat <-
format_catches(2019, "Baltic Sea",
hist, official, prelim, species_list, sid)

write.taf(catch_dat, dir = "data", quote = TRUE)
Expand Down
14 changes: 14 additions & 0 deletions report.R
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,16 @@ effort <-
) %>%
filter(!is.na(mw_fishinghours))

# write layer
write_layer <- function(dat, fname) {
sf::write_sf(dat, paste0("report/", fname, ".shp"))
files <- dir("report", pattern = fname, full = TRUE)
zip(paste0("report/", fname, ".zip"), files, extras = "-j")
file.remove(files)
}
write_layer(effort, "2019_BtS_FO_Figure9")

# save plot
plot_effort_map(effort, ecoregion) +
ggtitle("Average MW Fishing hours 2015-2018")

Expand All @@ -373,6 +383,9 @@ ggplot2::ggsave("2019_BtS_FO_Figure9.png", path = "report", width = 170, height
# A. Swept area map
#~~~~~~~~~~~~~~~#

# write layer
write_layer(sar, "2019_BtS_FO_Figure17")

plot_sar_map(sar, ecoregion, what = "surface") +
ggtitle("Average surface swept area ratio 2015-2018")

Expand All @@ -382,3 +395,4 @@ plot_sar_map(sar, ecoregion, what = "subsurface")+
ggtitle("Average subsurface swept area ratio 2015-2018")

ggplot2::ggsave("2019_BtS_FO_Figure17b.png", path = "report", width = 170, height = 200, units = "mm", dpi = 300)

0 comments on commit 0538231

Please sign in to comment.