Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
CarissaGervasi-NOAA committed May 30, 2024
2 parents c15688c + a333ee9 commit d0a926f
Show file tree
Hide file tree
Showing 15 changed files with 288 additions and 87 deletions.
Binary file added indicator_objects/gini.RData
Binary file not shown.
Binary file added indicator_objects/total_landings.RData
Binary file not shown.
Binary file modified indicator_plots/NMDSgear_STT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified indicator_plots/NMDSgear_STX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified indicator_plots/gearTypes_PR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified indicator_plots/gearTypes_STT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified indicator_plots/gearTypes_STX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions indicator_processing/CalculateAllIndicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ source("indicator_processing/non_automated/Sargassum_inundation.R") # sargassum
source("indicator_processing/non_automated/SAU_recreational_catch.R") # recreational catch based on Sea Around Us database
source("indicator_processing/non_automated/pollution.R") # reported superfund sites etc.

# fishery indicators - includes confidential data ----------------------

confpath <- "C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/"

dir("indicator_processing/fishery_dependent/")

source("indicator_processing/fishery_dependent/INDICATOR_total_landings.R") # calc total landings by group
source("indicator_processing/fishery_dependent/INDICATOR_gearchanges.R") # produces plots but no indicator objects
source("indicator_processing/fishery_dependent/INDICATOR_gini.R") # calculate gini index based on revenues
# not done below

#
source("indicator_processing/fishery_dependent/INDICATOR_disturbance.R") #
source("indicator_processing/fishery_dependent/INDICATOR_fishery_indicators_PR.R") #
source("indicator_processing/fishery_dependent/INDICATOR_fishery_indicators_STT.R") #
source("indicator_processing/fishery_dependent/INDICATOR_fishery_indicators_STX.R") #





###############################################################
Expand Down
29 changes: 19 additions & 10 deletions indicator_processing/fishery_dependent/INDICATOR_disturbance.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@
# code for calculating "disturbance indicator" based on changes in seasonality of landings
# uses logbook data for PR and USVI

# specification file and libraries -----------------------------
rm(list = ls())
setwd("C:/Users/mandy.karnauskas/Desktop/Caribbean-ESR/indicator_processing/fishery_dependent/")

library(maps)
library(plotTimeSeries)

load("indicator_processing/spec_file.RData")

confpath <- "C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/"

# define years --------------------------------

styear <- 1985
enyear <- 2020

# for PUERTO RICO -----------------------------------------------

dat <- read.csv("C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/Jun2022/PR_landings_83_20_wSC_2005cor.csv")
dat <- read.csv(paste0(confpath, "/Jun2022/PR_landings_83_20_wSC_2005cor.csv"))

d <- dat[which(dat$YEAR_LANDED >= styear & dat$YEAR_LANDED <= enyear), ]

Expand Down Expand Up @@ -111,11 +120,11 @@ names(final_PR) <- c("year", "ind", "lli", "uli")

# for STT --------------------------------------------------------

rm(list = ls()[-match(c("final_PR", "styear", "enyear"), ls())])
rm(list = ls()[-match(c("final_PR", "styear", "enyear", "confpath"), ls())])

# load data --------------------------------

dat <- read.csv("C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/STT_landings.csv")
dat <- read.csv(paste0(confpath, "STT_landings.csv"))


# adjust to fishing year ---------------------------------------
Expand Down Expand Up @@ -184,7 +193,7 @@ plot(styear: enyear, dst, type = "b")

# now for separate species ----------------------------------

ref <- read.csv("spp_ref_STT_manualEdit.csv")
ref <- read.csv("indicator_processing/fishery_dependent/spp_ref_STT_manualEdit.csv")
head(ref)
head(d)

Expand Down Expand Up @@ -253,11 +262,11 @@ names(final_ST) <- c("ind", "lli", "uli")

# for STX --------------------------------------------------------

rm(list = ls()[-match(c("final_PR", "final_ST", "styear", "enyear"), ls())])
rm(list = ls()[-match(c("final_PR", "final_ST", "styear", "enyear", "confpath"), ls())])

# load data --------------------------------

dat <- read.csv("C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/STX_072011_present_LANDINGS_trip_2021-03-11.csv")
dat <- read.csv(paste0(confpath, "STX_072011_present_LANDINGS_trip_2021-03-11.csv"))
head(dat)

# adjust to fishing year ---------------------------------------
Expand Down Expand Up @@ -322,7 +331,7 @@ plot(styear: enyear, dst, type = "b")

# now for separate species ----------------------------------

ref <- read.csv("spp_ref_STX_manualEdit.csv")
ref <- read.csv("indicator_processing/fishery_dependent/spp_ref_STX_manualEdit.csv")
head(ref)
head(d)

Expand Down Expand Up @@ -406,8 +415,8 @@ class(s) <- "indicatordata"
plotIndicatorTimeSeries(s, sublabel = T, coltoplot = 1:3, plotrownum = 3, yposadj = 1.2, type = "allLines",
sameYscale = F, trendAnalysis = F)

inddata <- s
save(inddata, file = "C:/Users/mandy.karnauskas/Desktop/Caribbean-ESR/indicator_objects/disturbance.RData")
ind <- s
save(ind, file = "indicator_objects/disturbance.RData")



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
# code for calculating pelagic:demersal ratio and Lmax indicators
# uses logbook data for PR and USVI

# specification file and libraries -----------------------------
rm(list = ls())
library(pals)

library(maps)
library(plotTimeSeries)

load("indicator_processing/spec_file.RData")

confpath <- "C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/MOST_RECENT/"


# input data for Puerto Rico ---------------------------
setwd("C:/Users/mandy.karnauskas/Desktop/Caribbean-ESR/indicator_processing/fishery_dependent/")

dat <- read.csv("C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/Jun2022/PR_landings_83_20_wSC_2005cor.csv")
dat <- read.csv(paste0(confpath, "Jun2022/PR_landings_83_20_wSC_2005cor.csv"))

# define start and end years ---------------------------
styear <- 1990
Expand Down Expand Up @@ -93,7 +101,7 @@ table(is.na(d$PRICE), d$ITIS_COMMON_NAME)

# pull in reference file and merge ------------------------------------

ref <- read.csv("spp_ref_manualEdit.csv")
ref <- read.csv("indicator_processing/fishery_dependent/spp_ref_manualEdit.csv")
head(ref)
head(d)
tail(d)
Expand Down Expand Up @@ -166,7 +174,7 @@ rownames(tab2)[nsp] <- "other"

tabr <- apply(tab2, 2, function(x) x/sum(x))

colgd <- read.csv("cols.csv", header = F)
colgd <- read.csv("indicator_processing/fishery_dependent/cols.csv", header = F)

barplot(tabr, col = as.character(colgd$V2[match(rownames(tabr), colgd$V1)]),
xlim = c(0, ncol(tabr)*1.8), legend.text = rownames(tabr), args.legend = c(x = "right"), las = 2)
Expand Down Expand Up @@ -211,7 +219,7 @@ matplot(pd)
pdrat <- pd[, 2] / pd[, 1]
plot(styear:enyear, pdrat, type = "b")

save(pdrat, file = "C:/Users/mandy.karnauskas/Desktop/Caribbean-ESR/indicator_data/PDRatioPR.RData")
save(pdrat, file = "indicator_data/PDRatioPR.RData")

# make indicator object and plot P:D ratio ------------------
datdata <- styear:enyear
Expand Down
Loading

0 comments on commit d0a926f

Please sign in to comment.