boatFun: Function to create monthly rasters from original Global...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/FUNCTION_boatFun.R

Description

This function creates a raster stack of year-month total fishing days from original Global Fishing Watch hourly data, in csv.

Usage

1
2
boatFun(orgLs, yrMon, type = NULL, impRes = 0.01, ncores = 1, res = 1,
        ext =  matrix(c(-180, 90,180, 90,180, -90,-180, -90), ncol = 2, byrow = TRUE))

Arguments

orgLs

Vector of path to original GFW daily csv files

yrMon

Vector of year-mon, with the same length as orgLs

type

Character of gear type to analyse. Defaults to NULL, equals to all fishing vessels. Other options can be "drifting_longlines", "purse_seines"

impRes

Numeric, in decimal degrees. Resolution of imput data. Defaults to 0.01 degree.

ncores

Numeric. Number of cores to use for function to run in parallel processing. Defaults to 1 core (no parallel).

res

Numeric, in decimal degrees. Resolution of export data. Defaults to 1 degree.

ext

Matrix of extent of output raster, in decimal degrees. Defaults to c(-180,180,-90,90)

Details

This function can be time-consuming and requires high memory capacity. We advice to use up to 75 percent of available cores and/or break data into chunks whenever possible. Further vessel types can be found on the original GFW data, and can also be used with this function.

Value

Returns a raster stack comprised by each year-month raster

Author(s)

Marisa Vedor, Ivo da Costa, Nuno Queiroz

References

https://globalfishingwatch.org/;

KROODSMA, David A., et al. Tracking the global footprint of fisheries. Science, 2018, 359.6378: 904-908.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import <- '~/r_scripts/1b_boats/examples/'

# List daily 0.01 degree data
orgLs <- list.files(import, '.csv', full.names = TRUE)


# Get year and month of data
yrMonLs <- lapply(strsplit(basename(orgLs), '-'), '[', c(1,2))
yrMonLs <- lapply(yrMonLs, paste, collapse = '-')
yrMonLs <- unlist(yrMonLs)

# Create a raster with sum of boats in each year-month
rstStk <- boatFun(orgLs = orgLs,
                  yrMon = yrMonLs)

GlobalSharkMovement/GSMP_rpackage documentation built on Feb. 13, 2021, 8:01 a.m.