1 Import data

We can visit the EU registry boats website, and import the data on the fleets registred by EU country (23 de feb de 2024). The results are stored in a zip file, with a csv inside: “vesselRegistryListResults.csv”.
We can then open it in R.

Download GBR (UK) after, separately.
The Licence indicator (Y) col shows the active boats (check it).

# import data
# dat <- read.table("vesselRegistryListResults.csv", sep=";", head=TRUE, quote = "")
#dim(dat) #70382 Should be 70 385 lines

# define the period to be 19_09_2024
dat1 <- read.table("vesselRegistryListResults 19_9_2024.csv", sep=";", head=TRUE, quote = "")
dim(dat1) #69261    40
## [1] 69261    40
# data from UK needs to be downloaded separatly.
dat2 <- read.table("vesselRegistryListResults GRB 19_09_2024.csv", sep=";", head=TRUE, quote = "")
dim(dat2) # 1074
## [1] 1089   40
# because it has no license indicator GBR, lets assume they are all ok:
dat2$Licence.indicator = "Y"
            
dat <- bind_rows(dat1, dat2)
# dat %>%
#   group_by(Country.of.Registration, Licence.indicator) %>%
#   summarise(N=n()) %>%
#   pivot_wider(names_from = Country.of.Registration, values_from = N, values_fill=0) %>%
#   kable() %>% kable_classic()
# note the cols VMS.indicator and AIS.indicator

# check for duplicated licenses (should be zero):
# sum(table(dat$CFR)>1) # now there are 6 - probably due to GBR. remove these after

# check missing gear
sum(dat$Main.fishing.gear=="") # 23 missing gears
## [1] 21
dat$Main.fishing.gear <- ifelse(dat$Main.fishing.gear=="","other", dat$Main.fishing.gear)

paste0(unique(dat$Country.of.Registration), collapse = ", ")
## [1] "NLD, BEL, IRL, FRA, BGR, ROU, CYP, MLT, DEU, FIN, SWE, LVA, POL, PRT, DNK, EST, LTU, ESP, HRV, GRC, SVN, ITA, GBR"
# check AIS indicator and homogeneise
# sum(dat$AIS.indicator=="") # 15 missing gears
# sum(is.na(dat$AIS.indicator)) # 15 missing gears
dat$AIS.indicator <- ifelse(is.na(dat$AIS.indicator),"NA", dat$AIS.indicator)

# check missing country
# sum(dat$Country.of.Registration=="")
# sum(is.na(dat$Country.of.Registration))

# range(dat$LOA)

# check countries
# sort(table(dat$Country.of.Registration)) 

# add classifying cols, rm missing LOA, rm countries <200 boats
# rm BEL (eventually) - only LSF
dat <- dat %>% 
  # select only active boats (to check if it is this the variable)
  filter(Licence.indicator == "Y") %>% 
  mutate(
    LOA = as.numeric(LOA),
    Fleet.segment = ifelse(LOA <= 12, "SSF", "LSF"),
    Fleet.segment3 = ifelse(LOA <= 9, "SSF9", Fleet.segment),
    Fleet.segment3 = ifelse(LOA > 9 & LOA <=12, "SSF9.12", Fleet.segment3)) %>% 
  filter(!is.na(LOA))
  # if filtering some countries  
  # !Country.of.Registration %in% c("LTU", "SVN", "ROU", "BEL"))

paste(dat %>% count(Fleet.segment), collapse="; ")
## [1] "c(\"LSF\", \"SSF\"); c(10251, 53460)"
# "c(\"LSF\", \"SSF\"); c(10251, 53460)"

2 SSF main gears distribution

Distribution of tonnage by country (fishing effort indirect indicator).

GNS, GTR, LLS, FPO, PS, DRB, LHP, OTB, other

## [1] "GNS 22750 43 GTR  8819 16 LLS  8451 16 FPO  5155 10 PS  1713  3 DRB   847  2 LHP  1091  2 OTB  1000  2"

Percentage of each gear between countries (<=12 only)
Main.fishing.gear range.freq mean
DRB 20-20 20
FPO 11-53 27
GN 16-16 16
GNS 13-99 59
GTR 10-83 37
LHP 13-27 20
LLS 10-52 25
OT 13-13 13
OTB 11-11 11
PS 17-17 17
TBB 16-16 16


3 Tonnage distribution

Distribution of tonnage by country (fishing effort indirect indicator).


4 LOA distribution

Check the distribution of boat’s LOA (to improve visualization, boats >20m have been added).

# plot boat distribuion ()
dat %>% 
  mutate(LOA = ifelse(LOA>20, 15, LOA)) %>%
  ggplot(aes(x=LOA, fill=Fleet.segment3))+
  geom_histogram(bins=40)+
  geom_vline(xintercept = 12, col=2, linetype=3)+
  scale_fill_brewer(palette="Set2")+
  ggtitle("LOA boats distribution (cut sum at 20 m)")+
  facet_wrap(Country.of.Registration~., scales="free_y",ncol=3)


Let’s make a table to explore a bit more the data.

# table:
dat.group <- dat %>% 
  group_by(Country.of.Registration) %>% 
  summarise(N=n(),
            LSF = sum(Fleet.segment=="LSF"),
            SSF = sum(Fleet.segment=="SSF"),
            SSF9 = sum(Fleet.segment3=="SSF9"),
            per.SSF = round(SSF/(SSF+LSF)*100,3),
            SSF.VMS = sum(VMS.indicator=="Y" & Fleet.segment=="SSF"),
            per.SSF.VMS = round(sum(VMS.indicator=="Y" & Fleet.segment=="SSF")/SSF*100,2),
            SSF.AIS = sum(AIS.indicator=="Y" & Fleet.segment=="SSF"),
            per.SSF.AIS = round(sum(AIS.indicator=="Y" & Fleet.segment=="SSF")/SSF*100,2),
            SSF.ton = sum(Tonnage.GT[Fleet.segment=="SSF"]),
            ) %>% 
  ungroup() 
  

dat.group %>% 
  arrange(desc(SSF), Country.of.Registration) %>%
  rename("Country" = Country.of.Registration) %>%
  kable() %>% 
  kable_classic(full=FALSE)
Country N LSF SSF SSF9 per.SSF SSF.VMS per.SSF.VMS SSF.AIS per.SSF.AIS SSF.ton
GRC 11401 719 10682 9529 93.694 1488 13.93 115 1.08 22722.69
ITA 12277 3422 8855 7274 72.127 4 0.05 594 6.71 18327.79
ESP 8461 2223 6238 5061 73.727 59 0.95 3595 57.63 14696.14
HRV 6195 362 5833 5384 94.157 292 5.01 111 1.90 11169.89
FRA 5957 773 5184 3720 87.024 675 13.02 3735 72.05 23402.19
FIN 3257 54 3203 2914 98.342 0 0.00 17 0.53 7175.19
PRT 3541 496 3045 2674 85.993 39 1.28 1570 51.56 8173.48
EST 2067 33 2034 1917 98.403 0 0.00 0 0.00 2335.85
IRL 1944 243 1701 1229 87.500 1 0.06 0 0.00 6074.68
DNK 1768 287 1481 1227 83.767 5 0.34 4 0.27 4338.47
DEU 1084 217 867 754 79.982 1 0.12 8 0.92 2225.00
SWE 917 123 794 540 86.587 8 1.01 154 19.40 3631.90
MLT 821 56 765 683 93.179 45 5.88 1 0.13 1982.14
CYP 736 41 695 585 94.429 1 0.14 0 0.00 1671.08
POL 783 148 635 462 81.098 3 0.47 76 11.97 2875.19
GBR 1089 472 617 326 56.657 NA NA 0 0.00 4120.90
NLD 763 418 345 256 45.216 0 0.00 50 14.49 898.00
LVA 167 46 121 115 72.455 0 0.00 0 0.00 168.28
SVN 131 15 116 102 88.550 8 6.90 2 1.72 295.07
BGR 106 10 96 91 90.566 8 8.33 2 2.08 167.40
LTU 108 19 89 79 82.407 1 1.12 0 0.00 201.04
ROU 78 14 64 40 82.051 0 0.00 63 98.44 227.66
BEL 60 60 0 0 0.000 0 NaN 0 NaN 0.00
# kk <- dat.group %>% 
#   arrange(Country.of.Registration) %>%
#   rename("Country" = Country.of.Registration)
# write.table(kk, "clipboard",sep="\t")

# check random numbers in the table
# dim(dat[dat$Fleet.segment=="SSF" & dat$VMS.indicator=="Y" & dat$Country.of.Registration == "ESP",])/6285  * 100 # correct in the table.

# # Check vessel type for example, in french boats
# dat %>% 
#   filter(AIS.indicator == "Y", Fleet.segment=="SSF",
#          Country.of.Registration == "FRA") %>% 
#   group_by(Name.of.vessel, Year.of.construction, Date.of.entry.into.service,Event.Start.Date, LOA, Vessel.Type) %>% 
#   summarise(n()) %>% 
#   kable() %>% 
#   kable_classic(full=FALSE)

# check vessels with AIS
# dat %>% filter(CFR=="PRT000000269") 

5 Potential issues

There is curious high number of boats in PRT with AIS indicator. For example, considering only the boats registred for Portugal, it shows 1570 registries with AIS of boats below 12 m lenght. Let’s look into these, excluding Madeira & Azores.

Also, it is curious that in this table, we have boats where the Country.of.Registration is Portugal but the Place.of.registration.name is United Kingdom or Finland. But, let’s ignore all this and proceed with some cool maps.

# but several of these boats might not be correct...

# bivalve dredge boats with AIS in PRT
dat %>% 
  filter(
    Country.of.Registration=="PRT",
    Fleet.segment=="SSF", 
    AIS.indicator=="Y",
    Main.fishing.gear=="DRB",
    !Place.of.registration.name %in% c("Funchal","Porto Santo", "Angra Do Heroísmo","Horta","Lajes","","Santa Cruz Da Flores","Santa Cruz Da Graciosa", "São Roque Do Pico", "Ponta Delgada"), !is.na(Place.of.registration.name)) %>% 
  dplyr::select(Name.of.vessel,  Year.of.construction,Event.Start.Date, Main.fishing.gear, Place.of.registration.name, LOA, AIS.indicator) %>% 
  group_by(Place.of.registration.name) %>% 
  slice(2) %>% 
  ungroup() %>% 
  arrange(Place.of.registration.name) %>% 
  #slice(1:10) %>% 
  kable() %>% 
  kable_classic(full=FALSE)
Name.of.vessel Year.of.construction Event.Start.Date Main.fishing.gear Place.of.registration.name LOA AIS.indicator
DUNA 1998-01-01 2023-05-31 DRB Faro 7.12 Y
PRAIA DA FUZETA 1963-01-01 2022-09-29 DRB Fuzeta 10.90 Y
NOVO MIUDO 1956-01-01 2024-02-23 DRB Olhão 10.00 Y
DRAGÃO DO SADO 2010-02-05 2022-06-07 DRB Setúbal 10.50 Y
RENDEIRO 2004-06-25 2022-05-24 DRB Sines 11.20 Y
PARA SEMPRE 1956-01-01 2022-12-20 DRB Tavira 10.12 Y
# boats with AIS in Setubal port below 10m
dat %>% 
  filter(
    Country.of.Registration=="PRT",
    Fleet.segment=="SSF", 
    AIS.indicator=="Y",
    Place.of.registration.name %in% c("Setúbal", "Sesimbra", "Sines"), 
    !is.na(Place.of.registration.name)) %>% 
  dplyr::select(Name.of.vessel,  Year.of.construction,Event.Start.Date, Main.fishing.gear, Place.of.registration.name, LOA, AIS.indicator) %>% 
  group_by(Place.of.registration.name) %>% 
  slice(2) %>% 
  ungroup() %>% 
  arrange(Place.of.registration.name) %>% 
  #slice(1:10) %>% 
  kable() %>% 
  kable_classic(full=FALSE)
Name.of.vessel Year.of.construction Event.Start.Date Main.fishing.gear Place.of.registration.name LOA AIS.indicator
NOSSA FE 1961-01-01 2022-07-25 FPO Sesimbra 10.30 Y
ANDIE II 1985-01-01 2024-09-05 GNS Setúbal 11.95 Y
PATRICIA CRISTINA 1978-01-01 2022-03-15 LLS Sines 7.09 Y
# check a case study of a portuguese boat. Confirmed ok.
# dat %>% filter(Name.of.vessel == "ADELINO TRANEL") %>% data.frame()

# export table to ANNA
# kk <- dat %>% 
#   filter(Country.of.Registration=="PRT", Fleet.segment=="SSF", AIS.indicator=="Y") %>%
#   arrange(LOA) %>% 
#   dplyr::select(Name.of.vessel,  Year.of.construction,Event.Start.Date, Main.fishing.gear, Place.of.registration.name, LOA, AIS.indicator, MMSI) 
# dim(kk)
# write.csv(kk, file="PRT_AIS_SSF_to_Anna.csv")

Perhaps we can try to check this in the marine traffic website or in Marine traffic, or even (https://marinecadastre.gov/accessais/).

6 Distribution by fleet segment

So, how many boats we have in SSF, LSF. Let’s make a plot to see it easier.

# plot it by number:
ggplotly(
dat %>% 
  ggplot(aes(x=reorder(Country.of.Registration, Country.of.Registration,function(x)-length(x)), fill=Fleet.segment3, shape=Fleet.segment))+
  geom_bar()+
  scale_fill_brewer(palette="Set2")+
  xlab("Country")+
  ggtitle("Number of registred boats, by country")
)

Clearly GRC, ITA, ESP and PRT have many more boats.

7 Static MAP SSF in EU

If we want to make a basic map.

8 Info for SWOT (WKSSFGEO2)

AIS.indicator DRB DRH FPO GNC GND GNS GTN GTR HAR LHP LLD LLS LTL OTB OTM PS PTB PTM SB SDN TBB BTF DRM FIX FPN FYK GEN GN GNF HMD LA LHM LL LNB LNS LVT LX MDV MHI MIS NK NO OFG OTG SPR SSC SX TBS other DRX OT OTT TBN TM LN TB TMS TX
66 1 575 33 59 5834 5 205 11 18 15 2480 3 162 5 800 1 4 13 1 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
N 428 116 2799 36 233 12516 697 7980 95 531 173 4799 157 359 81 686 6 1 123 12 41 1 1 30 8 272 1 9 3 2 14 31 4 16 1 2 1 10 9 89 22 4 25 2 2 5 4 1 12 0 0 0 0 0 0 0 0 0
NA 26 0 279 0 6 0 7 0 0 43 0 0 0 1 7 1 1 0 0 0 11 0 0 2 0 0 2 100 0 5 0 4 14 0 0 0 1 0 0 0 3 0 0 0 0 0 0 0 0 3 81 5 11 4 0 0 0 0
Y 327 2 1502 16 147 4400 50 634 0 499 81 1172 277 478 30 226 23 7 15 2 28 0 1 1 1 7 1 16 1 0 1 41 10 11 1 3 4 20 28 2 1 2 0 0 0 0 0 3 0 0 0 8 13 0 1 2 1 1
AIS.indicator BGR CYP DEU DNK ESP EST FIN FRA GBR GRC HRV IRL ITA LTU LVA MLT NLD POL PRT ROU SVN SWE
N 94 545 516 1041 2643 2034 999 1449 0 10565 3285 1701 3608 89 121 764 295 556 1470 1 114 560
Y 2 0 8 4 3595 0 17 3735 0 115 111 0 594 0 0 1 50 76 1570 63 2 154
0 150 343 436 0 0 2187 0 0 2 2437 0 4653 0 0 0 0 3 5 0 0 80
NA 0 0 0 0 0 0 0 0 617 0 0 0 0 0 0 0 0 0 0 0 0 0

9 Dynamic maps of SSF in EU

require(mapview)

## Two interactive maps with mapview
library(leafsync)
p1 <- eu.map %>% 
  filter(!is.na(SSF)) %>%
  mapview(zcol = "SSF",
          layer.name = "Number of boats in SSF")

p2 <- eu.map %>% 
  filter(!is.na(SSF), per.SSF != 0) %>%
  mapview(
    zcol = "per.SSF",
    col.regions = brewer.pal(11, "RdYlBu"),
    layer.name = "Percentage of SSF"
  )
sync(p1, p2)
## Layers of interactive maps with mapview
eu.map %>% 
  filter(!is.na(SSF)) %>% 
  mapview(zcol="per.SSF")+
eu.map %>% 
  filter(!is.na(SSF)) %>% 
  mapview(zcol="SSF",
          col.regions=brewer.pal(11, "RdYlBu"))+
eu.map %>% 
  filter(!is.na(SSF)) %>% 
  mapview(zcol="SSF9",
          col.regions=brewer.pal(9, "Spectral"))+
eu.map %>% 
  filter(!is.na(SSF)) %>% 
  mapview(zcol="SSF.ton",
          col.regions=brewer.pal(11, "RdYlGn"))

10 Fishing effort of SSF in EU

We can visit the EU FDI public data website, and import the data on the FDI. The results are stored in a file, with a csv inside: “FDI Effort by country.csv”.
We can then open it in R, and select th fleet segments belonging to SSF.
We can than connect the data to geographic polygons these represent, and map KW * days at sea by subregion.

Note that this indicator is not proper for SSF, because most fishing trips last much less than 24h fishing. This data will be improved when high resolution tracking is implemented.

#### FDI data
fdi <- read.csv("./Effort/FDI Effort by country.csv", na.strings = "C")#,sep=";", head=TRUE, quote = "")

## issues with data (check one day)
fdi <- fdi %>% 
  mutate_at(vars(Total.days.at.sea:GT.hours.at.sea), as.numeric)


##############################
# map it by area
##############################

# second file sent by Josefine
require(sf)
ices <- st_read("./ICES_Areas_20160601_cut_dense_3857/ICES_Areas_20160601_cut_dense_3857.shp")
## Reading layer `ICES_Areas_20160601_cut_dense_3857' from data source 
##   `C:\Users\marta.rufino\Google Drive\1_marta\trabalho\rpubs\ICES_Areas_20160601_cut_dense_3857\ICES_Areas_20160601_cut_dense_3857.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 66 features and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -4898058 ymin: 4300621 xmax: 7625385 ymax: 30240970
## Projected CRS: WGS 84 / Pseudo-Mercator
# names(ices)
# head(ices)

# check is it is the same as fdi
fdi$Sub.region <- tolower(fdi$Sub.region)

# filter for the ones present in fdi
ices <- ices %>% 
  filter(Area_Full %in% fdi$Sub.region)
  
# However, this file has some issues. 
# Let's start by making it valid.
ices <- st_make_valid(ices)

# Now, lets make it simpler & smaller
ices2 <- st_simplify(ices, dTolerance = 1000)

# Select only SSF vessels, data from 2022
kk <- fdi %>% 
filter(Vessel.Length.Category %in% c('VL1012','VL0006','VL0612','VL0010','VL0008','VL0812')) %>% 
  filter(Year==2022) %>% 
  group_by(Sub.region) %>% 
  summarise(Total.kW.days.at.Sea = round(sum(Total.kW.days.at.Sea, na.rm=TRUE)/1000))


############
## join the fdi with spatial data
# names(fdi); names(ices)
ices <- left_join(ices, kk, by=c("Area_Full" = "Sub.region"))

require(mapview)
ices %>% 
  filter(!is.na(Total.kW.days.at.Sea)) %>% 
  #filter(Area_Full== "27.3.a.20") %>% 
  mapview(zcol="Total.kW.days.at.Sea")

11 Changes in landed species between countries

#### FDI data
fdi <- read.csv("./Effort/FDI Effort by country.csv", na.strings = "C")#,sep=";", head=TRUE, quote = "")

## issues with data (check one day)
fdi <- fdi %>% 
  mutate_at(vars(Total.days.at.sea:GT.hours.at.sea), as.numeric)

12 ICES VMS data

Trying to get access in the web to the VMS data I aways look into during WKSFD, I found these two packages: icesVMS and VMStools. Let’s start to try the first one.

12.1 icesVMS

The icesVMS was developed by Collin Millar. It has the spatial polygons for the ICES areas, but all reaminig informaiton is restricted to the people directly envolved in the data call.

# install.packages("icesVMS")
require(icesVMS); 
require(sf)

# get the names of the ecoregions
get_ecoregion_list()

# select the one we want:
ii= "Bay of Biscay and the Iberian Coast"

# for example:
check_ecoregion(ii)

NS <- get_csquare(ecoregion = ii, convert2sf = TRUE)
plot(NS["ices_area"], border = "transparent")
NS

check_countries("PT")

benthis_pars <- get_benthis_parameters()
benthis_pars %>% head()
get_metier_lookup()
get_screening_details(530)

## Not run:
# requires authorization
# vms <- get_vms(country = "DK", year = 2021, month = 1)
# get_upload_summary()
# get_effort_map

# ISSUES: when we are required to put a PW it does not respond to close the box. You need to 

12.2 vmsTools

The VMStools…
link1

# library(devtools)
# install_github("nielshintzen/vmstools/vmstools/")
library(vmstools)

data(tacsat); data(eflalo)
tacsat$LE_RECT <- ICESrectangle(tacsat)

plotTools(tacsat,level="ICESrectangle",
          xlim=c(-5,10),ylim=c(48,62),zlim=NULL,
          log=FALSE,gridcell=c(0.1,0.05),
          color=NULL,control.tacsat=list(clm=NULL))

plotTools(eflalo,level="ICESrectangle",
          xlim=c(-5,10),ylim=c(48,62),zlim=NULL,
          log=FALSE,gridcell=c(0.1,0.05),
          color=NULL,control.tacsat=list(clm=NULL))
x

13 Distribution of SSF by port (Portugal only)

We also have port information, which we can add. In this case, besides excluding the Azores and Madeira, I excluded “United Kingdom”,“Latvia”,“Finland”, “Velas”.

# by port
dat %>% 
  filter(Country.of.Registration=="PRT",
         !Place.of.registration.name %in% c("Funchal","Porto Santo", "Angra Do Heroísmo","Horta","Lajes","","Santa Cruz Da Flores","Santa Cruz Da Graciosa", "São Roque Do Pico", "Ponta Delgada","United Kingdom","Latvia","Finland","Velas"), !is.na(Place.of.registration.name)) %>% 
group_by(Place.of.registration.name, Fleet.segment3) %>% 
  summarise(N=n()) %>% 
  pivot_wider(names_from = Fleet.segment3, values_from = N, values_fill=0) %>%
  dplyr::select(Place.of.registration.name, LSF, SSF9.12,SSF9) %>% 
  kable() %>% 
  kable_classic(full=FALSE)
Place.of.registration.name LSF SSF9.12 SSF9
Albufeira 0 1 40
Aveiro 37 5 419
Barreiro 0 2 39
Caminha 7 2 138
Cascais 7 1 22
Douro 4 12 83
Ericeira 0 0 20
Esposende 0 0 40
Faro 4 5 57
Figueira Da Foz 3 13 65
Fuzeta 2 4 53
Lagos 4 6 65
Leixões 19 0 25
Lisboa 2 0 22
Nazaré 2 12 43
Olhão 17 16 77
Peniche 45 20 141
Portimao 19 12 94
Povoa De Varzim 66 9 8
Praia Da Vitória 5 2 11
Quarteira 3 7 66
Sagres 5 4 71
Sesimbra 24 19 82
Setúbal 5 13 151
Sines 14 14 61
São Martinho Do Porto 0 0 24
Tavira 10 26 39
Trafaria 0 0 111
Viana Do Castelo 13 11 83
Vila Do Conde 62 7 20
Vila Do Porto 3 7 16
Vila Franca De Xira 0 0 60
Vila Franca Do Campo 4 6 4
Vila Real De Santo António 31 11 61
Âncora 6 2 15