packages <- c("qs", "dplyr", "ggplot2", "sf", "lubridate", "here", "ows4R", "patchwork", "kableExtra")
lapply(packages, function(pkg) {
if (!require(pkg, character.only = TRUE)) install.packages(pkg)
library(pkg, character.only = TRUE)
})
qs_file <- "global_effort_tunaatlasird_level0_1950_2023.qs"
if (!file.exists(qs_file)) {
download.file("https://zenodo.org/record/15221705/files/global_effort_tunaatlasird_level0_1950_2023.qs?download=1", qs_file, mode = "wb")
}
effort_data <- qs::qread(qs_file)
effort_data$geom <- NULL
This dataset provides monthly records of tuna and tuna-like species effort at the global scale between 1950 and 2023. Here is a description of the columns:
kableExtra::kable(head(effort_data))
| measurement_value | measurement_unit | measurement_unit_label | source_authority | gear_type | gear_type_label | fishing_fleet | fishing_fleet_label | fishing_mode | time_start | time_end | gridtype | geographic_identifier |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | SUC.SETS | Number of successful sets | ICCAT | 01.1 | Purse seines | ALB | Albania | UNK | 2014-06-01 | 2014-06-30 | 1deg_x_1deg | 5139015 |
| 1 | SUC.SETS | Number of successful sets | ICCAT | 01.1 | Purse seines | ALB | Albania | UNK | 2015-06-01 | 2015-06-30 | 1deg_x_1deg | 5139015 |
| 1 | SUC.SETS | Number of successful sets | ICCAT | 01.1 | Purse seines | ALB | Albania | UNK | 2016-06-01 | 2016-06-30 | 1deg_x_1deg | 5135013 |
| 2 | SUC.SETS | Number of successful sets | ICCAT | 01.1 | Purse seines | ALB | Albania | UNK | 2017-06-01 | 2017-06-30 | 1deg_x_1deg | 5139015 |
| 3 | SUC.SETS | Number of successful sets | ICCAT | 01.1 | Purse seines | ALB | Albania | UNK | 2018-06-01 | 2018-06-30 | 1deg_x_1deg | 5139015 |
| 1 | SUC.SETS | Number of successful sets | ICCAT | 01.1 | Purse seines | ALB | Albania | UNK | 2019-06-01 | 2019-06-30 | 1deg_x_1deg | 5139015 |
dplyr::glimpse(effort_data)
## Rows: 353,038
## Columns: 13
## $ measurement_value <dbl> 1, 1, 1, 2, 3, 1, 9, 26, 14, 51, 14, 6, 9, 67, …
## $ measurement_unit <chr> "SUC.SETS", "SUC.SETS", "SUC.SETS", "SUC.SETS",…
## $ measurement_unit_label <chr> "Number of successful sets", "Number of success…
## $ source_authority <chr> "ICCAT", "ICCAT", "ICCAT", "ICCAT", "ICCAT", "I…
## $ gear_type <chr> "01.1", "01.1", "01.1", "01.1", "01.1", "01.1",…
## $ gear_type_label <chr> "Purse seines", "Purse seines", "Purse seines",…
## $ fishing_fleet <chr> "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "EUHR…
## $ fishing_fleet_label <chr> "Albania", "Albania", "Albania", "Albania", "Al…
## $ fishing_mode <chr> "UNK", "UNK", "UNK", "UNK", "UNK", "UNK", "UNK"…
## $ time_start <chr> "2014-06-01", "2015-06-01", "2016-06-01", "2017…
## $ time_end <chr> "2014-06-30", "2015-06-30", "2016-06-30", "2017…
## $ gridtype <chr> "1deg_x_1deg", "1deg_x_1deg", "1deg_x_1deg", "1…
## $ geographic_identifier <chr> "5139015", "5139015", "5135013", "5139015", "51…
source_authority: The source RFMO (e.g., CCSBT,
IOTC)fishing_fleet: Code for the flag or national fleet
(e.g., AUS)time_start / time_end: Temporal coverage
of the observation (monthly granularity)geographic_identifier: Unique spatial ID for each grid
cellgear_type: Code describing the type of gear usedfishing_mode: Code describing the fishing mode or
school associationmeasurement_unit: Unit of measurement used for effort
(e.g., Days, Hours)measurement_value: Numeric value of the reported
effortGRIDTYPE: Type of grid used (e.g., 1deg_x_1deg)gear_type_label: Human-readable label for the gear
typefishing_fleet_label: Label for the fleet or flag
statespecies_label: Common name of the speciesspecies_definition: Scientific name of the speciesgeom: Geometry in WKT format for mapping purposesfishing_mode_label: Human-readable label for fishing
mode)summary(effort_data$measurement_value)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0 4 22 42796 2146 14188790
kableExtra::kable(table(effort_data$measurement_unit))
| Var1 | Freq |
|---|---|
| BOATS | 60 |
| D.FISH.G | 6759 |
| DAYS | 9396 |
| FDAYS | 37098 |
| FHOURS | 84385 |
| HOOKS | 95420 |
| HOURS | 2741 |
| Hours.FAD | 24919 |
| Hours.FSC | 9224 |
| Hours.STD | 32836 |
| HRSRH | 46 |
| KM.SETS | 15 |
| LINE.DAYS | 275 |
| LINES | 1 |
| MD | 83 |
| N.POLE-D | 228 |
| NETS | 488 |
| NO.FADS.VIS | 42 |
| NO.MTZAS | 2 |
| NO.NETS | 17 |
| NO.TRAPS | 173 |
| SETS | 11339 |
| SUC.D.FI | 1274 |
| SUC.SETS | 22351 |
| TRAP D | 366 |
| TRIPS | 13500 |
First let’s download the geometry.
cwp_grid_file <- here("data/cl_areal_grid.csv")
if (!file.exists(cwp_grid_file)) {
message("Downloading cl_area from github repo")
zip_url <- "https://github.com/fdiwg/fdi-codelists/raw/main/global/cwp/cl_areal_grid.zip"
zip_path <- here("data/cwp_grid.zip")
download.file(zip_url, zip_path, mode = "wb")
unzip(zip_path, exdir = here("data"))
}
cwp_grid <- st_read(cwp_grid_file)
## Reading layer `cl_areal_grid' from data source
## `/home/jovyan/firms-gta/geoflow-tunaatlas/data/cl_areal_grid.csv'
## using driver `CSV'
cwp_grid <- st_as_sf(
cwp_grid,
wkt = "geom_wkt",
crs = 4326
) %>%
dplyr::rename(cwp_code = CWP_CODE) %>%
dplyr::rename(geom = geom_wkt)
qs_file <- "UN_CONTINENT2.qs"
if (!file.exists(qs_file)) {
message("Downloading UN_CONTINENT2 from FAO GeoServer...")
WFS <- WFSClient$new(
url = "https://www.fao.org/fishery/geoserver/fifao/wfs",
serviceVersion = "1.0.0",
logger = "INFO"
)
continent <- WFS$getFeatures("fifao:UN_CONTINENT2")
# Save to .qs for faster reloads later
qs::qsave(continent, qs_file)
} else {
message("Loading cached UN_CONTINENT2 from local file...")
continent <- qs::qread(qs_file)
}
sf::st_crs(continent) <- 4326
This map displays the spatial distribution of effort, aggregated by geographic grid cell. The measurement_value is summed for each area, and only the top 6 values are shown.
top_units <- effort_data %>%
dplyr::group_by(measurement_unit) %>%
dplyr::summarise(filtertop = sum(measurement_value)) %>%
dplyr::arrange(desc(filtertop)) %>%
dplyr::slice_head(n = 6) %>%
dplyr::pull(measurement_unit)
effort_summary_by_unit <- effort_data %>%
dplyr::filter(measurement_unit %in% top_units) %>%
dplyr::group_by(geographic_identifier, measurement_unit) %>%
dplyr::summarise(total = sum(measurement_value, na.rm = TRUE), .groups = "drop")
effort_summary_geom <- effort_summary_by_unit %>%
dplyr::inner_join(cwp_grid %>% dplyr::select(cwp_code, geom), by = c("geographic_identifier" = "cwp_code")) %>%
sf::st_as_sf()
plots <- effort_summary_geom %>%
dplyr::group_split(measurement_unit) %>%
purrr::map(function(df) {
unit <- unique(df$measurement_unit)
ggplot2::ggplot() +
ggplot2::geom_sf(data = continent, fill = "gray90", color = "gray60") +
ggplot2::geom_sf(data = df, ggplot2::aes(fill = total), color = NA) +
ggplot2::scale_fill_viridis_c(option = "plasma", trans = "log", na.value = "transparent") +
ggplot2::labs(title = paste("Unit:", unit), fill = "effort Total") +
ggplot2::theme_minimal()
})
patchwork::wrap_plots(plots, ncol = 2)
effort_data %>%
dplyr::group_by(year = lubridate::year(time_start), measurement_unit) %>%
dplyr::summarise(total = sum(measurement_value, na.rm = TRUE)) %>%
ggplot2::ggplot(ggplot2::aes(x = year, y = total)) +
ggplot2::geom_line() +
ggplot2::facet_wrap(~measurement_unit, scales = "free_y") +
ggplot2::labs(title = "Total effort by year and 'measurement_unit'", y = "Measurement_value", x = "Year")