generated from SEFSC/SEFSC-Template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09add5c
commit a32de68
Showing
7 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
indicator_processing/fishery_dependent/compile_indicators.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# M. Karnauskas 10/19/2023 | ||
# compile pelagic:demersal ratio and Lmax indicators | ||
# uses logbook data for PR and USVI | ||
# need to run first: | ||
# INDICATOR_fishery_indicators_PR.R | ||
# INDICATOR_fishery_indicators_STT.R | ||
# INDICATOR_fishery_indicators_STX.R | ||
# then compile outputs here | ||
|
||
|
||
# specification file and libraries ----------------------------- | ||
rm(list = ls()) | ||
|
||
library(maps) | ||
library(plotTimeSeries) | ||
|
||
dir("indicator_data/fish-dep-indicators/") | ||
|
||
load("indicator_data/fish-dep-indicators/Lmax_PR.RData") | ||
pr <- findat | ||
|
||
load("indicator_data/fish-dep-indicators/Lmax_STT.RData") | ||
st <- findat | ||
|
||
load("indicator_data/fish-dep-indicators/Lmax_STX.RData") | ||
sx <- findat | ||
|
||
yrs <- (min(c(pr$V1, st$yrs, sx$yrs))) : (max(c(pr$V1, st$yrs, sx$yrs))) | ||
|
||
mat <- data.frame(matrix(data = NA, nrow = length(yrs), ncol = 3)) | ||
rownames(mat) <- yrs | ||
mat | ||
|
||
mat[match(pr$V1, yrs), 1] <- pr$lmax | ||
mat[match(st$yrs, yrs), 2] <- st$lmax | ||
mat[match(sx$yrs, yrs), 3] <- sx$lmax | ||
|
||
datdata <- yrs | ||
inddata <- data.frame(mat) | ||
labs <- c("Average maximum length of species in catch", "length (cm)", "Puerto Rico", | ||
"Average maximum length of species in catch", "length (cm)", "St. Thomas and St. John", | ||
"Average maximum length of species in catch", "length (cm)", "St. Croix") | ||
indnames <- data.frame(matrix(labs, nrow = 3, byrow = F)) | ||
ind <- list(labels = indnames, indicators = inddata, datelist = datdata) #, ulim = ulidata, llim = llidata) | ||
|
||
class(ind) <- "indicatordata" | ||
plotIndicatorTimeSeries(ind, coltoplot = 1:3, plotrownum = 3, sublabel = T, sameYscale = F) | ||
|
||
save(ind, file = "indicator_objects/mean_Lmax.RData") | ||
|
||
Lmax <- mat | ||
|
||
|
||
# P:D ratios ----------------------------- | ||
|
||
rm(list = ls()[-match(c("Lmax"), ls())]) | ||
|
||
dir("indicator_data/fish-dep-indicators/") | ||
|
||
load("indicator_data/fish-dep-indicators/PDRatioPR.RData") | ||
pr <- pdrat | ||
|
||
load("indicator_data/fish-dep-indicators/PDRatioSTT.RData") | ||
st <- pdrat | ||
|
||
load("indicator_data/fish-dep-indicators/PDRatioSTX.RData") | ||
sx <- pdrat | ||
|
||
yrspr <- as.numeric(names(pr)) | ||
yrsst <- as.numeric(names(st)) | ||
yrssx <- as.numeric(names(sx)) | ||
|
||
yrs <- (min(c(yrspr, yrsst, yrssx))) : (max(c(yrspr, yrsst, yrssx))) | ||
|
||
mat <- data.frame(matrix(data = NA, nrow = length(yrs), ncol = 3)) | ||
rownames(mat) <- yrs | ||
mat | ||
|
||
mat[match(yrspr, yrs), 1] <- pr | ||
mat[match(yrsst, yrs), 2] <- st | ||
mat[match(yrssx, yrs), 3] <- sx | ||
|
||
datdata <- yrs | ||
inddata <- data.frame(mat) | ||
labs <- c("Ratio of pelagic to demersal catch", "landings ratio", "Puerto Rico", | ||
"Ratio of pelagic to demersal catch", "landings ratio", "St. Thomas and St. John", | ||
"Ratio of pelagic to demersal catch", "landings ratio", "St. Croix") | ||
indnames <- data.frame(matrix(labs, nrow = 3, byrow = F)) | ||
ind <- list(labels = indnames, indicators = inddata, datelist = datdata) #, ulim = ulidata, llim = llidata) | ||
|
||
class(ind) <- "indicatordata" | ||
plotIndicatorTimeSeries(ind, coltoplot = 1:3, plotrownum = 3, sublabel = T, sameYscale = F) | ||
|
||
save(ind, file = "indicator_objects/PD_ratio.RData") | ||
|
||
|
||
# compare indicators -------------------------------- | ||
|
||
plot(Lmax[, 1], mat[, 1]) | ||
tecor.test(Lmax[, 1], mat[, 1], na.action=na.omit) | ||
|
||
plot(Lmax[, 2], mat[, 2]) | ||
cor.test(Lmax[, 2], mat[, 2], na.action=na.omit) | ||
|
||
plot(Lmax[, 3], mat[, 3]) | ||
cor.test(Lmax[, 3], mat[, 3], na.action=na.omit) | ||
|
||
# indicators are very highly correlated | ||
# use P:D ratio only as it is more direct indicator of what is going on | ||
|
||
|