# NOT RUN {
y <- system.file("das_sample.das", package = "swfscDAS")
y.proc <- das_process(y)
y.eff <- das_effort(y.proc, method = "section", num.cores = 1)
stratum.file <- system.file("das_sample_stratum.csv", package = "swfscDAS")
das_intersects_strata(y.eff, list(InPoly = stratum.file), x.lon = "Lon", x.lat = "Lat")
das_intersects_strata(y.proc, list(stratum.file))
# Visualize effort midpoints and stratum polygon
require(sf)
y.eff.strata <- das_intersects_strata(y.eff, list(InPoly = stratum.file))
segdata <- st_as_sf(y.eff.strata$segdata, coords = c("mlon", "mlat"), crs = 4326)
# Make stratum polygon
stratum.df <- read.csv(stratum.file)
stratum.sfc <- st_sfc(
st_polygon(list(matrix(c(stratum.df$Lon, stratum.df$Lat), ncol = 2))),
crs = 4326
)
plot(segdata["InPoly"], axes = TRUE, reset = FALSE,
xlim = c(-137, -142.5), ylim = c(42, 47))
plot(stratum.sfc, add = TRUE)
# }
Run the code above in your browser using DataLab