Skip to content

Commit

Permalink
Added Wolffish (left them out for some reason).
Browse files Browse the repository at this point in the history
  • Loading branch information
gambler1650 committed Sep 26, 2024
1 parent a3d1bd9 commit 470cbb9
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
41 changes: 41 additions & 0 deletions R/get_thresholds_NRHA_atlantis.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Use pulled survdat.rds file to get environmental thresholds for Atlantis groups
library(dplyr)
library(here)
# Get output data
NRHA_dt <-read.csv(here("data","NRHA_data.csv"))
atlantis_groups_dt <- read.csv(here("inputs","atlantis_codes_svspp_survey_thresholds.csv"))
# Modify data tables for ease of use
colnames(atlantis_groups_dt)[2] <- "COMNAME"
atlantis_groups_dt <- group_by(atlantis_groups_dt,Code)
atlantis_NRHA_dt <- inner_join(NRHA_dt,atlantis_groups_dt,by="COMNAME")

# The data includes a lot of 0's in the surface temperature data and some above 40 (104 F)
# for the surface temperature data. This constricts the ranges to exclude 0's and temperatures above 40.
atlantis_NRHA_dt$BottTEMP[(atlantis_NRHA_dt$BottTEMP == 0) | (atlantis_NRHA_dt$BottTEMP > 40)] <- NA
atlantis_NRHA_dt$SurfTEMP[(atlantis_NRHA_dt$SurfTEMP == 0) | (atlantis_NRHA_dt$SurfTEMP > 40)] <- NA

atlantis_NRHA_summary_table <- group_by(atlantis_NRHA_dt,Code,SEASON)
atlantis_NRHA_summary_table_SEASON <- summarise(atlantis_NRHA_summary_table, min_bottom_temp = min(BottTEMP, na.rm=T), max_bottom_temp = max(BottTEMP, na.rm=T),
min_surface_temp = min(SurfTEMP,na.rm=T), max_surface_temp = max(SurfTEMP,na.rm=T),
min_bottom_sal = min(BottSALIN,na.rm=T), max_bottom_sal = max(BottSALIN,na.rm=T),
min_surface_sal = min(SurfSALIN,na.rm=T), max_surface_sal = max(SurfSALIN,na.rm=T))

atlantis_NRHA_summary_table_SPECIES <- group_by(atlantis_NRHA_dt,Code)
atlantis_NRHA_summary_table_SPECIES <- summarise(atlantis_NRHA_summary_table_SPECIES, min_bottom_temp = min(BottTEMP, na.rm=T), max_bottom_temp = max(BottTEMP, na.rm=T),
min_surface_temp = min(SurfTEMP,na.rm=T), max_surface_temp = max(SurfTEMP,na.rm=T),
min_bottom_sal = min(BottSALIN,na.rm=T), max_bottom_sal = max(BottSALIN,na.rm=T),
min_surface_sal = min(SurfSALIN,na.rm=T), max_surface_sal = max(SurfSALIN,na.rm=T))

# Removes infinity values from the outputs and sets to NA
atlantis_NRHA_summary_table_SEASON$min_bottom_sal[(atlantis_NRHA_summary_table_SEASON$min_bottom_sal == 'Inf') | (atlantis_NRHA_summary_table_SEASON$min_bottom_sal == '-Inf')] <- 'NA'
atlantis_NRHA_summary_table_SEASON$max_bottom_sal[(atlantis_NRHA_summary_table_SEASON$max_bottom_sal == 'Inf') | (atlantis_NRHA_summary_table_SEASON$max_bottom_sal == '-Inf')] <- 'NA'
atlantis_NRHA_summary_table_SEASON$min_surface_sal[(atlantis_NRHA_summary_table_SEASON$min_surface_sal == 'Inf') | (atlantis_NRHA_summary_table_SEASON$min_surface_sal == '-Inf')] <- 'NA'
atlantis_NRHA_summary_table_SEASON$max_surface_sal[(atlantis_NRHA_summary_table_SEASON$max_surface_sal == 'Inf') | (atlantis_NRHA_summary_table_SEASON$max_surface_sal == '-Inf')] <- 'NA'

atlantis_NRHA_summary_table_SPECIES$min_bottom_sal[(atlantis_NRHA_summary_table_SPECIES$min_bottom_sal == 'Inf') | (atlantis_NRHA_summary_table_SPECIES$min_bottom_sal == '-Inf')] <- 'NA'
atlantis_NRHA_summary_table_SPECIES$max_bottom_sal[(atlantis_NRHA_summary_table_SPECIES$max_bottom_sal == 'Inf') | (atlantis_NRHA_summary_table_SPECIES$max_bottom_sal == '-Inf')] <- 'NA'
atlantis_NRHA_summary_table_SPECIES$min_surface_sal[(atlantis_NRHA_summary_table_SPECIES$min_surface_sal == 'Inf') | (atlantis_NRHA_summary_table_SPECIES$min_surface_sal == '-Inf')] <- 'NA'
atlantis_NRHA_summary_table_SPECIES$max_surface_sal[(atlantis_NRHA_summary_table_SPECIES$max_surface_sal == 'Inf') | (atlantis_NRHA_summary_table_SPECIES$max_surface_sal == '-Inf')] <- 'NA'

write.csv(atlantis_NRHA_summary_table_SEASON,here("thresholds","atlantis_seasonal_thresholds_NRHA.csv"),row.names=FALSE)
write.csv(atlantis_NRHA_summary_table_SPECIES,here("thresholds","atlantis_group_thresholds_NRHA.csv"),row.names=FALSE)
1 change: 1 addition & 0 deletions inputs/atlantis_codes_svspp_survey_thresholds.csv
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ FDF,Cunner,176
TAU,Tautog,177
FDF,Oyster toadfish,185
FDF,Wrymouth,191
WOL,Atlantic wolffish,192
OPT,Ocean pout,193
FDF,Northern puffer,196
GOO,Goosefish,197
Expand Down
1 change: 1 addition & 0 deletions thresholds/atlantis_group_thresholds_NRHA.csv
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"TYL",7.95,17.95,6.64,28.8,"33.118","36.359","32.057","36.43"
"WHK",1.3,25.3,0.6,29.13,"20.25","38.78","0.05","36.389"
"WIF",-1.4,28.15999985,-1.4,32.3,"5.7","38.78","0","36"
"WOL",1.5,14.8,1.5,20.2,"31.294","35.051","28.3","33.877"
"WPF",-1.2,38.1,-0.9,32,"0.5","41.5","0","36.94"
"WSK",-1.4,23.6,-1.4,24.41538,"11.58998","36.431","11","36.43"
"WTF",1.5,26.1,1.5,26.73,"20.25","35.894","11","36.478"
Expand Down
1 change: 1 addition & 0 deletions thresholds/atlantis_group_thresholds_survdat.csv
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"TYL",3.25,19.66,2,28.8,"31.032","36.359","31.017","36.43"
"WHK",1.6,25.3,0.6,29.13,"29.029","35.835","24.249","36.389"
"WIF",-1.4,23.12,-1.4,27,"26.547","35.459","15.925","35.679"
"WOL",1.3,14.8,0.5,21.4,"31.294","35.051","29.283","33.877"
"WPF",-1.2,27.7,-0.9,28.7,"23.267","36.341","15.925","36.354"
"WSK",-1.4,21.88,-1.4,25.2,"24.138","36.431","15.925","36.43"
"WTF",1,18.53,1,26.73,"30.691","35.894","24.249","36.478"
Expand Down
4 changes: 4 additions & 0 deletions thresholds/atlantis_seasonal_thresholds_NRHA.csv
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
"WIF","Spring",0.1,22.70000076,0.1,27.4,"14","35.459","4","35"
"WIF","Summer",4.3,28.15999985,4.7,32.3,"5.7","36","2.3","36"
"WIF","Winter",-1.4,18.9,-1.4,12.5,"7","36.19844","5","35.43703"
"WOL","Fall",3.2,14.8,6.7,18.5,"31.935","35.051","30.345","33.395"
"WOL","Spring",1.5,11.23,1.5,11.9,"31.294","35.048","28.3","33.877"
"WOL","Summer",3.63,10,5.5,20.2,"32.191","34.692","30.105","32.33"
"WOL","Winter",4.7,10.1,3.57,9,"32.112","33.603","31.815","32.08"
"WPF","Fall",5,27.7,6.9,28.87,"0.5","41.5","0.05","36.7"
"WPF","Spring",-0.9,38.1,-0.9,29.4,"2","36.78","0","36.6"
"WPF","Summer",4.4,30.09,4.7,32,"3.6","36.6","4","36.94"
Expand Down
4 changes: 4 additions & 0 deletions thresholds/atlantis_seasonal_thresholds_survdat.csv
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@
"WIF","SPRING",1.23,16,0.9,17.3,"26.547","35.459","15.925","33.888"
"WIF","SUMMER",2.5,21,8.2,27,"30.904","32.774","30.057","32.053"
"WIF","WINTER",-1.4,11.25,-1.4,8.51,"31.076","34.836","29.102","34.121"
"WOL","FALL",2.9,14.8,6.7,18.5,"31.935","35.051","30.345","33.395"
"WOL","SPRING",1.3,11.23,0.5,13.28,"31.294","35.048","29.283","33.877"
"WOL","SUMMER",1.7,10.1,7.9,21.4,"32.191","34.692","30.105","32.33"
"WOL","WINTER",1.8,7.91,0.8,5.1,"32.112","33.603","31.815","32.08"
"WPF","FALL",5.34,27.7,6.3,28.7,"27.223","36.106","20.356","34.822"
"WPF","SPRING",1.4,19.7,1.4,20.6,"23.267","36.341","15.925","36.354"
"WPF","SUMMER",5.1,27.4,9.9,28.2,"30.904","31.594","30.87","31.561"
Expand Down

0 comments on commit 470cbb9

Please sign in to comment.