Skip to contents

Retrieves the seabird numbers density at locations of fishing effort and calculates the overlap: $$\mathbb{O} = \mathrm{effort} \times \frac{y}{A \cdot \sum{y}}$$ where \(y\) is the numbers per grid cell and \(A\) is the cell area size in square kilometres.

Usage

get_overlap(x, y, ...)

# S4 method for class 'sf,sf'
get_overlap(
  x,
  y,
  name,
  group_name = "group",
  effort_name = "effort",
  na_replace = NULL,
  ...
)

Arguments

x

fishing effort as an sf object with POINT geometry.

y

density distribution as an sf object with POLYGON geometry. Densities should be stored in column value.

...

other arguments parsed to methods (currently unused)

name

character object specifying the species code (e.g. DIW).

group_name

column header for x matching layer names in y object.

effort_name

column header for x storing effort.

na_replace

numeric value to replace NA values introduced when x entries are outside the range of the species distribution. If na_replace = NULL (the default) then NA values are retained.

Value

an object of class sf, with additional column for the overlap (e.g. for name = "DIW" then returned object has additional column overlap_diw).

Examples

library(sefraInputs)
library(dplyr)
library(sf)
x <- data.frame(month = "1", lat = -42.5, lon = 87.5, effort = 1.0)
x <- x %>% rowwise(.) %>%
  mutate(., geometry = list(st_point(c(lon, lat)))) %>%
  ungroup(.) %>%
  st_as_sf(., crs = "EPSG:4326")
x <- x %>% st_transform(crs = st_crs(sefraInputs::grid))
y <- sefraInputs::grid %>% mutate(month = "1", value = runif(1224))
get_overlap(x, y, name = "bird", group_name = "month", effort_name = "effort")
#> Simple feature collection with 1 feature and 5 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -5100792 ymin: 671532.1 xmax: -5100792 ymax: 671532.1
#> Projected CRS: +proj=laea +lat_0=-90 +lon_0=170
#> # A tibble: 1 × 6
#>   month   lat   lon effort            geometry overlap_bird
#>   <chr> <dbl> <dbl>  <dbl>         <POINT [m]>        <dbl>
#> 1 1     -42.5  87.5      1 (-5100792 671532.1)        0.732