Skip to content

Commit

Permalink
clean 2 automation files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandy Karnauskas authored and Mandy Karnauskas committed Oct 18, 2024
1 parent a18f36f commit 2bb2a35
Show file tree
Hide file tree
Showing 136 changed files with 1,090 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .quarto/cites/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Report_book_files\\Performance_indicators.qmd":[],"index.qmd":[],"Report_book_files\\Report4.qmd":[],"Report_book_files\\Intro_text.qmd":[],"Report_book_files\\Risk_indicators.qmd":[],"OA.qmd":[],"Lab-report\\OA.qmd":[],"Report_book_files\\Discussion_material.qmd":[],"Report_book_files\\FMP_objectives.qmd":[]}
{"Report_book_files\\Performance_indicators.qmd":[],"Lab-report\\OA.qmd":[],"Report_book_files\\Report4.qmd":[],"index.qmd":[],"Report_book_files\\Discussion_material.qmd":[],"Report_book_files\\Intro_text.qmd":[],"Report_book_files\\Risk_indicators.qmd":[],"OA.qmd":[],"Report_book_files\\FMP_objectives.qmd":[]}
Binary file modified Average maximum length of catch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
885 changes: 885 additions & 0 deletions _book/Report_book_files/Performance_indicators.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _book/indicator_plots/FRsection_plot_final.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 added _book/indicator_plots/GDP_plot_final.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 added _book/indicator_plots/PD_ratio_plot_final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _book/indicator_plots/RVC_PR_plot_final.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 added _book/indicator_plots/RVC_STSJ_plot_final.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 added _book/indicator_plots/RVC_STX_plot_final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 _book/indicator_plots/cruise_plot_final.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 added _book/indicator_plots/enforcement_plot_final.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 added _book/indicator_plots/fish_density_plot_final.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 added _book/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 added _book/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 added _book/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.
Binary file added _book/indicator_plots/gini_plot_final.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 _book/indicator_plots/marine_debris_plot_final.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 added _book/indicator_plots/oceanNAICS_plot_final.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 added _book/indicator_plots/outreach_plot_final.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 added _book/indicator_plots/per_landings_PR.png
Binary file added _book/indicator_plots/per_landings_STT.png
Binary file added _book/indicator_plots/per_landings_STX.png
Binary file modified _book/indicator_plots/pollution_plot_final.png
Binary file modified _book/indicator_plots/population_plot_final.png
Binary file added _book/indicator_plots/tier3_plot_final.png
Binary file added _book/indicator_plots/unemployment_plot_final.png
80 changes: 80 additions & 0 deletions _book/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,85 @@
"crumbs": [
"<span class='chapter-number'>4</span>  <span class='chapter-title'>4. Risks to meeting fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html",
"href": "Report_book_files/Performance_indicators.html",
"title": "5. Tracking performance toward fishery management objectives",
"section": "",
"text": "5.1 Food production",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#food-production",
"href": "Report_book_files/Performance_indicators.html#food-production",
"title": "5. Tracking performance toward fishery management objectives",
"section": "",
"text": "Fishery independent surveys of economically important species\nIndicator 16 - abundance of economically important fish\n\n\n\nRVC PR\n\n\n\n\n\nRVC STSJ\n\n\n\n\n\nRVC STX\n\n\nIndicator 17 - abundance of commercial fish and slope of the size spectrum based on TCRMP and PRCRMP\n\n\n\nfish density\n\n\n\n\nPelagic:demersal ratio\nIndicator 18\n\n\n\nPD ratio\n\n\n\n\nMaximum length and size structure\nIndicator 19 - Lmax indicator\n\n\n\nPR Lmax\n\n\n\n\n\nSTT Lmax\n\n\n\n\n\nSTX Lmax\n\n\n\n\nCommercial landings\nIndicator 20 - total landings\n\n\n\nTotal landings",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#socioeconomic-health",
"href": "Report_book_files/Performance_indicators.html#socioeconomic-health",
"title": "5. Tracking performance toward fishery management objectives",
"section": "5.2 Socioeconomic health",
"text": "5.2 Socioeconomic health\n\nTotal, lobster and conch revenues\nIndicator 21 - percent revenues by species group\n \n\n\nTotal, lobster and conch trips\nIndicator 22 - number of trips\n \n\n\nOcean economy establishments, employment, and wages\nIndicator 23\n\n\n\nOcean economy\n\n\n\n\nGDP\nIndicator 24\n\n\n\nGDP\n\n\n\n\nUnemployment\nIndicator 25\n\n\n\nUnemployment",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#equity",
"href": "Report_book_files/Performance_indicators.html#equity",
"title": "5. Tracking performance toward fishery management objectives",
"section": "5.3 Equity",
"text": "5.3 Equity\n\nGini coefficient for distribution of landings and revenue\nIndicator 26\n\n\n\nGini coefficient\n\n\n\n\nEnvironmental justice, economic, and gentrification pressure\nIndicator 27",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#engagement-and-participation",
"href": "Report_book_files/Performance_indicators.html#engagement-and-participation",
"title": "5. Tracking performance toward fishery management objectives",
"section": "5.4 Engagement and participation",
"text": "5.4 Engagement and participation\n\nRecreational landings\nIndicator 28\n\n\n\nRec catch\n\n\n\n\nCommercial fishing engagement and reliance\nIndicator 29",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#bycatch-reduction",
"href": "Report_book_files/Performance_indicators.html#bycatch-reduction",
"title": "5. Tracking performance toward fishery management objectives",
"section": "5.5 Bycatch reduction",
"text": "5.5 Bycatch reduction\n\nChanges in gear type\nIndicator 30\n \n\n\n\ndiving trips\n\n\n\n\n\nNon-selective gears",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#governance",
"href": "Report_book_files/Performance_indicators.html#governance",
"title": "5. Tracking performance toward fishery management objectives",
"section": "5.5 Governance",
"text": "5.5 Governance\n\nNumber of new regulations\nIndicator 31\n\n\n\nRegulations\n\n\n\n\nPercent of species with informative catch limits\nIndicator 32\n\n\n\nTier 3 plot\n\n\n\n\nNumber of education and outreach events\nIndicator 33\n\n\n\nOutreach\n\n\n\n\nNumber of enforcement actions\nIndicator 34\n\n\n\nEnforcement",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
},
{
"objectID": "Report_book_files/Performance_indicators.html#protection-of-ecosystems",
"href": "Report_book_files/Performance_indicators.html#protection-of-ecosystems",
"title": "5. Tracking performance toward fishery management objectives",
"section": "5.6 Protection of ecosystems",
"text": "5.6 Protection of ecosystems\n\nPercent coral cover and coral species diversity\nIndicator 35\n\n\n\nCoral",
"crumbs": [
"<span class='chapter-number'>5</span>  <span class='chapter-title'>5. Tracking performance toward fishery management objectives</span>"
]
}
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added indicator_objects/PD_ratio.RData
Binary file not shown.
Binary file added indicator_objects/PR_Lmax_classes.RData
Binary file not shown.
Binary file added indicator_objects/STT_Lmax_classes.RData
Binary file not shown.
Binary file added indicator_objects/STX_Lmax_classes.RData
Binary file not shown.
Binary file added indicator_objects/disturbance.RData
Binary file not shown.
Binary file added indicator_objects/gini_revenue.RData
Binary file not shown.
Binary file added indicator_objects/mean_Lmax.RData
Binary file not shown.
Binary file added indicator_objects/prop_diving_trips.RData
Binary file not shown.
Binary file added indicator_objects/prop_trips_bycatch.RData
Binary file not shown.
Binary file removed indicator_objects_old/ACEindex.RData
Binary file not shown.
Binary file removed indicator_objects_old/Carib_SST.RData
Binary file not shown.
Binary file removed indicator_objects_old/DegreeHeatingWeeks.RData
Binary file not shown.
Binary file removed indicator_objects_old/FRsection.RData
Binary file not shown.
Binary file removed indicator_objects_old/GDP.RData
Binary file not shown.
Binary file removed indicator_objects_old/OA.RData
Binary file not shown.
Binary file removed indicator_objects_old/PD_ratio.RData
Binary file not shown.
Binary file removed indicator_objects_old/PR_Lmax_classes.RData
Binary file not shown.
Binary file removed indicator_objects_old/PR_mean_Lmax.RData
Binary file not shown.
Binary file removed indicator_objects_old/RVC_PR.RData
Binary file not shown.
Binary file removed indicator_objects_old/RVC_STSJ.RData
Binary file not shown.
Binary file removed indicator_objects_old/RVC_STX.RData
Binary file not shown.
Binary file removed indicator_objects_old/STT_Lmax_classes.RData
Binary file not shown.
Binary file removed indicator_objects_old/STX_Lmax_classes.RData
Binary file not shown.
Binary file removed indicator_objects_old/Sargassum.RData
Binary file not shown.
Binary file removed indicator_objects_old/avgLmax.RData
Binary file not shown.
Binary file removed indicator_objects_old/carib_Chl.RData
Binary file not shown.
Binary file removed indicator_objects_old/coral_spprichness_cover.RData
Binary file not shown.
Binary file removed indicator_objects_old/cruise.RData
Binary file not shown.
Binary file removed indicator_objects_old/disturbance.RData
Binary file not shown.
Binary file removed indicator_objects_old/earthquakes.RData
Binary file not shown.
Binary file removed indicator_objects_old/enforcement.RData
Binary file not shown.
Binary file removed indicator_objects_old/fish_density.RData
Binary file not shown.
Binary file removed indicator_objects_old/gini.RData
Binary file not shown.
Binary file removed indicator_objects_old/gini_landings.RData
Binary file not shown.
Binary file removed indicator_objects_old/gini_revenue.RData
Binary file not shown.
Binary file removed indicator_objects_old/marine_debris.RData
Binary file not shown.
Binary file removed indicator_objects_old/mean_Lmax.RData
Binary file not shown.
Binary file removed indicator_objects_old/oceanNAICS.RData
Binary file not shown.
Binary file removed indicator_objects_old/outreach.RData
Binary file not shown.
Binary file removed indicator_objects_old/pollution.RData
Binary file not shown.
Binary file removed indicator_objects_old/population.RData
Binary file not shown.
Binary file removed indicator_objects_old/prop_diving_trips.RData
Binary file not shown.
Binary file removed indicator_objects_old/prop_trips_bycatch.RData
Binary file not shown.
Binary file removed indicator_objects_old/regulations.RData
Binary file not shown.
Binary file removed indicator_objects_old/tier3.RData
Binary file not shown.
Binary file removed indicator_objects_old/total_landings.RData
Binary file not shown.
Binary file removed indicator_objects_old/total_rec_catch.RData
Binary file not shown.
Binary file removed indicator_objects_old/turbidity.RData
Binary file not shown.
Binary file removed indicator_objects_old/unemployment.RData
Binary file not shown.
Binary file added indicator_plots/ACEindex_plot_final.png
Binary file added indicator_plots/Carib_SST_plot_final.png
Binary file added indicator_plots/DegreeHeatingWeeks_plot_final.png
Binary file added indicator_plots/FRsection_plot_final.png
Binary file added indicator_plots/GDP_plot_final.png
Binary file added indicator_plots/NMDSgear_PR.png
Binary file added indicator_plots/OA_plot_final.png
Binary file added indicator_plots/PD_ratio_plot_final.png
Binary file added indicator_plots/PR_Lmax_classes_plot_final.png
Binary file added indicator_plots/RVC_PR_plot_final.png
Binary file added indicator_plots/RVC_STSJ_plot_final.png
Binary file added indicator_plots/RVC_STX_plot_final.png
Binary file added indicator_plots/STT_Lmax_classes_plot_final.png
Binary file added indicator_plots/STX_Lmax_classes_plot_final.png
Binary file added indicator_plots/Sargassum_plot_final.png
Binary file added indicator_plots/avgLmax_plot_final.png
Binary file added indicator_plots/carib_Chl_plot_final.png
Binary file added indicator_plots/cruise_plot_final.png
Binary file added indicator_plots/disturbance_plot_final.png
Binary file added indicator_plots/earthquakes_plot_final.png
Binary file added indicator_plots/enforcement_plot_final.png
Binary file added indicator_plots/fish_density_plot_final.png
Binary file added indicator_plots/gearTypes_PR.png
Binary file added indicator_plots/gini_plot_final.png
Binary file added indicator_plots/marine_debris_plot_final.png
Binary file added indicator_plots/oceanNAICS_plot_final.png
Binary file added indicator_plots/outreach_plot_final.png
Binary file added indicator_plots/per_landings_PR.png
Binary file added indicator_plots/per_landings_STT.png
Binary file added indicator_plots/per_landings_STX.png
Binary file added indicator_plots/pollution_plot_final.png
Binary file added indicator_plots/population_plot_final.png
Binary file added indicator_plots/prop_diving_trips_plot_final.png
Binary file added indicator_plots/prop_trips_bycatch_plot_final.png
Binary file added indicator_plots/tier3_plot_final.png
Binary file added indicator_plots/total_landings_plot_final.png
Binary file added indicator_plots/total_rec_catch_plot_final.png
Binary file added indicator_plots/turbidity_plot_final.png
Binary file added indicator_plots/unemployment_plot_final.png
20 changes: 20 additions & 0 deletions indicator_processing/CalculateAllIndicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,28 @@
# load libraries ---------------------------------
rm(list = ls())

packages = c("data.table", "dplyr", "ggplot2", "ggrepel", "httr", "jsonlite", "lubridate",
"maps", "pals", "pdftools", "plotTimeSeries", "readr", "readxl", "rerddap", "rvest",
"stringr", "tidyr", "vegan", "xml2", "modi", "devtools")

## Now load or install & load all
package.check <- lapply(
packages,
FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
}
)

devtools::install_github('jeremiaheb/rvc')
library(rvc)
install_github("MandyKarnauskas-NOAA/plotTimeSeries")
library(plotTimeSeries)

search()

# find root directory for project ---------------

directory <- rprojroot::find_rstudio_root_file()
Expand Down
12 changes: 6 additions & 6 deletions indicator_processing/PlotAllIndicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ dev.off()

### 6 - marine debris

png(filename = "indicator_plots/marine_debris_plot_final.png", width = 10, height = 4, units = "in", res = 300)
load("indicator_objects/marine_debris.RData")
plotIndicatorTimeSeries(ind, coltoplot = 1, plotrownum = 1, plotcolnum = 1, trendAnalysis = FALSE, dateformat = "%b%Y", sublabel = F, widadj = 1, hgtadj = 1, anom = "none", yposadj = 1, cex.axis = 1, cex.lab = 1, cex.main = 1)
dev.off()
#png(filename = "indicator_plots/marine_debris_plot_final.png", width = 10, height = 4, units = "in", res = 300)
#load("indicator_objects/marine_debris.RData")
#plotIndicatorTimeSeries(ind, coltoplot = 1, plotrownum = 1, plotcolnum = 1, trendAnalysis = FALSE, dateformat = "%b%Y", sublabel = F, widadj = 1, hgtadj = 1, anom = "none", yposadj = 1, cex.axis = 1, cex.lab = 1, cex.main = 1)
#dev.off()

### 7 - identified point source pollution sites

Expand Down Expand Up @@ -141,7 +141,7 @@ dev.off()
### 19 - Lmax indicator

png(filename = "indicator_plots/avgLmax_plot_final.png", width = 7, height = 6, units = "in", res = 300)
load("indicator_objects/avgLmax.RData")
load("indicator_objects/mean_Lmax.RData")
plotIndicatorTimeSeries(ind, coltoplot = 1:3, plotrownum = 3, plotcolnum = 1, trendAnalysis = TRUE, dateformat = "%b%Y", sublabel = TRUE, widadj = 1, hgtadj = 0.5, anom = "none", yposadj = 1, sameYscale = TRUE, cex.axis = 1.2, cex.lab = 1.4, cex.main = 1.5)
dev.off()

Expand Down Expand Up @@ -199,7 +199,7 @@ dev.off()
### 26 - Gini coefficient

png(filename = "indicator_plots/gini_plot_final.png", width = 7, height = 8, units = "in", res = 300)
load("indicator_objects/gini.RData")
load("indicator_objects/gini_revenue.RData")
plotIndicatorTimeSeries(ind, coltoplot = 1:3, plotrownum = 3, plotcolnum = 1, trendAnalysis = TRUE, dateformat = "%b%Y", sublabel = TRUE, widadj = 1, hgtadj = 0.5, anom = "none", yposadj = 1.2, cex.axis = 1.2, cex.lab = 1.5, cex.main = 1.6, sameYscale = TRUE)
dev.off()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,39 @@ plotIndicatorTimeSeries(s, coltoplot = 1:3,plotrownum = 3, sublabel = T, widadj

dev.off()

# figure out what is going on in 2018 with spike in pelagics -------------------

# plot(styear:enyear, pdrat, type = "b", las = 2, pch = 19)
# matplot(styear:enyear, pd, axes = F, type = "b", pch = 19)
# axis(1, at = styear:enyear, las = 2)
#
# tabp <- tab[grep("pelagic", splisref$PD), ]
# tabp <- tabp[order(rowSums(tabp), decreasing = T), ]
#
# matplot(styear:enyear, t(tabp[1:10, ]), type = "l", col = glasbey(10), lwd = 2, lty = 1)
# legend("topright", rownames(tabp)[1:10], col = glasbey(10), lwd = 2, lty = 1)
# abline(v = c(2008, 2019)) # driven ~50% by dolphinfish catch
#
# tabd <- tab[-grep("pelagic", splisref$PD), ]
# tabd <- tabd[order(rowSums(tabd), decreasing = T), ]
#
# matplot(styear:enyear, t(tabd[1:10, ]), type = "b", col = glasbey(10), lwd = 2, lty = 1, pch = 19, las = 2)
# legend("topright", rownames(tabd)[1:10], col = glasbey(10), lwd = 2, lty = 1)
# abline(v = c(2008, 2019))
#

####################### END P:D ratio ################################

# Lmax calculations -----------------------------------------

# based on feedback from seminar -- calculate Lmax based on demersals only

table(dbf$PD, useNA = "always")
table(dbf$PD2, useNA = "always")
dbf <- dbf[which(dbf$PD2 == "demersal"), ]
dim(dbf)
head(dbf)

tab <- tapply(dbf$ADJUSTED_POUNDS, list(dbf$ITIS_SCIENTIFIC_NAME, dbf$YEAR_LANDED), sum, na.rm = T)
tab[is.na(tab)] <- 0
tab
Expand Down Expand Up @@ -364,6 +393,9 @@ sort(table(splisref$famcode[which(splisref$Lmax_cat == "(100,200]")]))

splisref$recLand <- rowSums(tab)

sm <- splisref[which(splisref$Lmax_cat == "(40,60]"), ]
head(sm[order(sm$recLand, decreasing = T), ], 15)

plate <- splisref[which(splisref$Lmax_cat == "(60,100]"), ]
head(plate[order(plate$recLand, decreasing = T), ], 15)
# the 60-100cm category is mostly driven by deepwater snapper species, also yellowtail, hogfish and red hind
Expand Down Expand Up @@ -422,26 +454,6 @@ findat <- data.frame(cbind(styear:enyear, lmax))

save(findat, file = "indicator_data/intermediateFiles/fish-dep-indicators/Lmax_PR.RData")



# figure out what is going on in 2018 with spike in pelagics -------------------

plot(styear:enyear, pdrat, type = "b", las = 2, pch = 19)
matplot(styear:enyear, pd, axes = F, type = "b", pch = 19)
axis(1, at = styear:enyear, las = 2)

tabp <- tab[grep("pelagic", splisref$PD), ]
tabp <- tabp[order(rowSums(tabp), decreasing = T), ]

matplot(styear:enyear, t(tabp[1:10, ]), type = "l", col = glasbey(10), lwd = 2, lty = 1)
legend("topright", rownames(tabp)[1:10], col = glasbey(10), lwd = 2, lty = 1)
abline(v = c(2008, 2019)) # driven ~50% by dolphinfish catch

tabd <- tab[-grep("pelagic", splisref$PD), ]
tabd <- tabd[order(rowSums(tabd), decreasing = T), ]

matplot(styear:enyear, t(tabd[1:10, ]), type = "b", col = glasbey(10), lwd = 2, lty = 1, pch = 19, las = 2)
legend("topright", rownames(tabd)[1:10], col = glasbey(10), lwd = 2, lty = 1)
abline(v = c(2008, 2019))
############# END ######################

print("PR indicators -- SUCCESSFULLY RUN")
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ dev.off()

# Lmax calculations -----------------------------------------

# based on feedback from seminar -- calculate Lmax based on demersals only

table(dbf$PD, useNA = "always")
table(dbf$PD2, useNA = "always")
dbf <- dbf[which(dbf$PD2 == "demersal"), ]
dim(dbf)
head(dbf)

tab <- tapply(dbf$POUNDS_LANDED, list(dbf$SPECIES_NM, dbf$TRIP_YEAR), sum, na.rm = T)
tab[is.na(tab)] <- 0

Expand Down Expand Up @@ -324,6 +332,11 @@ big <- splisref[which(splisref$Lmax_cat == "(100,200]"), ]
head(big[order(big$recLand, decreasing = T), ], 15)
# mainly tunas and mackerels, also red grouper

xl <- splisref[which(splisref$Lmax_cat == "(200,2e+03]"), ]
head(xl[order(xl$recLand, decreasing = T), ], 15)
# mainly tunas and mackerels, also red grouper


# calculate average Lmax indicator -----------------------------------------------

# formula from https://www.sciencedirect.com/science/article/pii/135223109400210C
Expand Down Expand Up @@ -360,7 +373,7 @@ indnames <- data.frame(matrix(labs, nrow = 3, byrow = F))
s <- list(labels = indnames, indicators = inddata, datelist = datdata, ulim = inddata + lmax_sem, llim = inddata - lmax_sem)
class(s) <- "indicatordata"

plotIndicatorTimeSeries(s, coltoplot = 1, sublabel = T, outtype = "png", widadj = 1.65, hgtadj = 0.6)
plotIndicatorTimeSeries(s, coltoplot = 1, sublabel = T, widadj = 1.65, hgtadj = 0.6)

dev.off()

Expand All @@ -369,23 +382,23 @@ findat <- data.frame(cbind(yrs, lmax))
save(findat, file = "indicator_data/intermediateFiles/fish-dep-indicators/Lmax_STT.RData")

# figure out what is going on in 2018 with spike in pelagics -------------------

plot(yrs, pdrat, type = "b", las = 2)
matplot(yrs, pd, axes = F, type = "b")
axis(1, at = yrs, las = 2)

tabp <- tab[grep("pelagic", splisref$PD), ]
tabp <- tabp[order(rowSums(tabp), decreasing = T), ]

matplot(yrs, t(tabp[1:10, ]), type = "l", col = glasbey(10), lwd = 2, lty = 1)
legend("topleft", rownames(tabp)[1:20], col = glasbey(10), lwd = 2, lty = 1, cex = 0.7)
# pelagic catch influenced by dolphinfish and tunas

tabd <- tab[-grep("pelagic", splisref$PD), ]
tabd <- tabd[order(rowSums(tabd), decreasing = T), ]

matplot(yrs, t(tabd[1:20, ]), type = "b", col = glasbey(10), lwd = 2, lty = 1, pch = 19, las = 2)
legend("topright", rownames(tabd)[1:20], col = glasbey(10), lwd = 2, lty = 1)
#
# plot(yrs, pdrat, type = "b", las = 2)
# matplot(yrs, pd, axes = F, type = "b")
# axis(1, at = yrs, las = 2)
#
# tabp <- tab[grep("pelagic", splisref$PD), ]
# tabp <- tabp[order(rowSums(tabp), decreasing = T), ]
#
# matplot(yrs, t(tabp[1:10, ]), type = "l", col = glasbey(10), lwd = 2, lty = 1)
# legend("topleft", rownames(tabp)[1:20], col = glasbey(10), lwd = 2, lty = 1, cex = 0.7)
# # pelagic catch influenced by dolphinfish and tunas
#
# tabd <- tab[-grep("pelagic", splisref$PD), ]
# tabd <- tabd[order(rowSums(tabd), decreasing = T), ]
#
# matplot(yrs, t(tabd[1:20, ]), type = "b", col = glasbey(10), lwd = 2, lty = 1, pch = 19, las = 2)
# legend("topright", rownames(tabd)[1:20], col = glasbey(10), lwd = 2, lty = 1)

############## END ########################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ dev.off()

# Lmax calculations -----------------------------------------

# based on feedback from seminar -- calculate Lmax based on demersals only

table(dbf$PD, useNA = "always")
table(dbf$PD2, useNA = "always")
dbf <- dbf[which(dbf$PD2 == "demersal"), ]
dim(dbf)
head(dbf)

tab <- tapply(dbf$POUNDS_LANDED, list(dbf$SPECIES_NM, dbf$TRIP_YEAR), sum, na.rm = T)
tab[is.na(tab)] <- 0

Expand Down Expand Up @@ -316,7 +324,7 @@ small <- splisref[which(splisref$Lmax_cat == "(0,40]"), ]
head(small[order(small$recLand, decreasing = T), ], 15)
#driven by redband parrotfish and princess parrotfish. also herrings and surgeonfishes

plate <- splisref[which(splisref$Lmax_cat == "(60,100]"), ]
plate <- splisref[which(splisref$Lmax_cat == "(40,60]"), ]
head(plate[order(plate$recLand, decreasing = T), ], 15)
# mainly stoplight and queen parrotfishes. Also blackfin and silk snapper and red hind

Expand Down Expand Up @@ -374,20 +382,20 @@ save(findat, file = "indicator_data/intermediateFiles/fish-dep-indicators/Lmax_S

# look at what is driving PD ratio -------------------

plot(yrs, pdrat, type = "b", las = 2)
matplot(yrs, pd, axes = F, type = "b")
axis(1, at = yrs, las = 2)

tabp <- tab[grep("pelagic", splisref$PD), ]
tabp <- tabp[order(rowSums(tabp), decreasing = T), ]

matplot(yrs, t(tabp), type = "l", col = glasbey(10), lwd = 2, lty = 1)
legend("topleft", rownames(tabp), col = glasbey(10), lwd = 2, lty = 1, cex = 0.7)

tabd <- tab[-grep("pelagic", splisref$PD), ]
tabd <- tabd[order(rowSums(tabd), decreasing = T), ]

matplot(yrs, t(tabd[1:20, ]), type = "b", col = glasbey(10), lwd = 2, lty = 1, pch = 19, las = 2)
legend("topright", rownames(tabd)[1:20], col = glasbey(10), lwd = 2, lty = 1)
# plot(yrs, pdrat, type = "b", las = 2)
# matplot(yrs, pd, axes = F, type = "b")
# axis(1, at = yrs, las = 2)
#
# tabp <- tab[grep("pelagic", splisref$PD), ]
# tabp <- tabp[order(rowSums(tabp), decreasing = T), ]
#
# matplot(yrs, t(tabp), type = "l", col = glasbey(10), lwd = 2, lty = 1)
# legend("topleft", rownames(tabp), col = glasbey(10), lwd = 2, lty = 1, cex = 0.7)
#
# tabd <- tab[-grep("pelagic", splisref$PD), ]
# tabd <- tabd[order(rowSums(tabd), decreasing = T), ]
#
# matplot(yrs, t(tabd[1:20, ]), type = "b", col = glasbey(10), lwd = 2, lty = 1, pch = 19, las = 2)
# legend("topright", rownames(tabd)[1:20], col = glasbey(10), lwd = 2, lty = 1)

print("STX indicators -- SUCCESSFULLY RUN")
Loading

0 comments on commit 2bb2a35

Please sign in to comment.