Skip to content

Commit

Permalink
Changes to code, and new datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
gambler1650 committed Aug 26, 2024
1 parent 77178b9 commit 5855566
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 7 deletions.
12 changes: 9 additions & 3 deletions R/get_thresholds_survdat_atlantis.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ library(here)

survdat_dt <-readRDS(here("data","surveyPull.rds"))
summary_table <- group_by(survdat_dt$survdat,SVSPP,SEASON)

# The data includes a lot of 0's in the surface temperature data and some above 31 (the max reported temperature in the MAB)
# for the surface temperature data. This constricts the ranges to exclude 0's and temperatures above 31.

summary_table$BOTTEMP[(summary_table$BOTTEMP == 0) | (summary_table$BOTTEMP > 31)] <- NA
summary_table$SURFTEMP[(summary_table$SURFTEMP == 0) | (summary_table$SURFTEMP > 31)] <- NA
summary_table_SEASON <- summarise(summary_table, min_bottom_temp = min(BOTTEMP, na.rm=T), max_bottom_temp = max(BOTTEMP, na.rm=T),
min_surface_temp = min(SURFTEMP,na.rm=T), max_surface_temp = max(SURFTEMP,na.rm=T),
min_bottom_sal = min(BOTSALIN,na.rm=T), max_bottom_sal = max(BOTSALIN,na.rm=T),
min_surface_sal = min(SURFSALIN,na.rm=T), max_surface_sal = max(SURFSALIN,na.rm=T))

summary_table_SPECIES <- group_by(survdat_dt$survdat,SVSPP)
summary_table_SPECIES <- group_by(summary_table,SVSPP)
summary_table_SPECIES <- summarise(summary_table_SPECIES, min_bottom_temp = min(BOTTEMP, na.rm=T), max_bottom_temp = max(BOTTEMP, na.rm=T),
min_surface_temp = min(SURFTEMP,na.rm=T), max_surface_temp = max(SURFTEMP,na.rm=T),
min_bottom_sal = min(BOTSALIN,na.rm=T), max_bottom_sal = max(BOTSALIN,na.rm=T),
Expand Down Expand Up @@ -50,5 +56,5 @@ summary_table_ATLANTIS_SPECIES$max_bottom_sal[(summary_table_ATLANTIS_SPECIES$ma
summary_table_ATLANTIS_SPECIES$min_surface_sal[(summary_table_ATLANTIS_SPECIES$min_surface_sal == 'Inf') | (summary_table_ATLANTIS_SPECIES$min_surface_sal == '-Inf')] <- 'NA'
summary_table_ATLANTIS_SPECIES$max_surface_sal[(summary_table_ATLANTIS_SPECIES$max_surface_sal == 'Inf') | (summary_table_ATLANTIS_SPECIES$max_surface_sal == '-Inf')] <- 'NA'

write.csv(summary_table_ATLANTIS_SEASON,here("thresholds","atlantis_seasonal_thresholds.csv"),row.names=FALSE)
write.csv(summary_table_ATLANTIS_SPECIES,here("thresholds","atlantis_group_thresholds.csv"),row.names=FALSE)
write.csv(summary_table_ATLANTIS_SEASON,here("thresholds","atlantis_seasonal_thresholds_survdat.csv"),row.names=FALSE)
write.csv(summary_table_ATLANTIS_SPECIES,here("thresholds","atlantis_group_thresholds_survdat.csv"),row.names=FALSE)
8 changes: 4 additions & 4 deletions get_thresholds_NRHA_Ecomon.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ convertCTDdate <- function(date) {
return(converted_date)
}

TEMPORAL_BOUND <- 14 # days
SPATIAL_BOUND <- 5 # miles
TEMPORAL_BOUND <- 7 # days
SPATIAL_BOUND <- 1 # miles
# Get output data
NRHA_dt <-read.csv(here("data","NRHA_data.csv"))
CTD_dt <-read.csv(here("data","CTD_data.csv"))
Expand Down Expand Up @@ -153,5 +153,5 @@ atlantis_NRHA_summary_table_SPECIES$min_surface_sal[(atlantis_NRHA_summary_table
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","seasonal_thresholds_NRHA_ecomon.csv"),row.names=FALSE)
write.csv(atlantis_NRHA_summary_table_SPECIES,here("thresholds","group_thresholds_NRHA_ecomon.csv"),row.names=FALSE)
write.csv(atlantis_NRHA_summary_table_SEASON,here("thresholds","seasonal_thresholds_NRHA_ecomon_t7_d1.csv"),row.names=FALSE)
write.csv(atlantis_NRHA_summary_table_SPECIES,here("thresholds","group_thresholds_NRHA_ecomon_t7_d1.csv"),row.names=FALSE)
34 changes: 34 additions & 0 deletions thresholds/group_thresholds_NRHA_ecomon_t7_d1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"Code","min_bottom_temp","max_bottom_temp","min_surface_temp","max_surface_temp","min_bottom_sal","max_bottom_sal","min_surface_sal","max_surface_sal"
"BLF",5.78,28.08,5.94,27.05,"-1e+10","36.447","-1e+10","36.389"
"BSB",3.15,28.8,3.25,27.53,"-1e+10","36.43","-1e+10","36.404"
"BUT",2.53,29.23,3.8,27.5,"-1e+10","36.578","-1e+10","36.509"
"COD",0.88,23.08,1.35,17.89,"-1e+10","34.085","-1e+10","35.5"
"DOG",1.21,27.66,2.09,22.91,"-1e+10","36.578","-1e+10","36.255"
"DRM",4.54,29.04,4.15,28.33,"-1e+10","36.578","-1e+10","36.455"
"FDE",0.88,25.9,1.27,26.6,"-1e+10","36.031","-1e+10","36.168"
"HAD",1.17,27.59,2.69,18.58,"-1e+10","36.089","-1e+10","35.646"
"HAL",1.17,16.27,2.55,13.61,"-1e+10","33.64","31.691","35.001"
"HER",0.88,25.16,1.23,20.8659,"-1e+10","35.393","-1e+10","35.645"
"LSK",0.88,28.36,0.32,23.45,"-1e+10","36.114","-1e+10","35.894"
"MAK",1.21,23.42,2.48,22.53,"-1e+10","36.031","-1e+10","35.838"
"OHK",3.87,29.21,4.63,15.59,"-1e+10","36.579","-1e+10","35.956"
"OPT",1.3,27.59,1.27,19.85,"-1e+10","35.321","-1e+10","35.688"
"PLA",1.21,22.04,1.35,16.19,"-1e+10","34.176","30.544","35.56"
"POL",1.21,22.84,2.18,17.14,"-1e+10","35.26","-1e+10","35.512"
"QHG",6.26,18.7199,3.77,13.05,"30.9983","33.751","32.046","34.185"
"RED",1.68,22.29,2.34,14.72,"-1e+10","34.783","31.43","35.58"
"RHK",1.21,27.59,1.71,22.0707,"-1e+10","36.466","-1e+10","36.312"
"SAL",Inf,-Inf,Inf,-Inf,"NA","NA","NA","NA"
"SCU",4.25,29.23,4.12,28.33,"-1e+10","36.478","-1e+10","36.5"
"SDF",6.05,22.92,5.33,14.08,"22.05","34.645","26.995","35.505"
"SHK",1.21,29.21,1.74,24.46,"-1e+10","36.578","-1e+10","36.2"
"SK",1.17,29.76,2.18,27.5,"-1e+10","36.579","-1e+10","36.5"
"SUF",1.55,29.4,1.74,28.22,"-1e+10","36.558","-1e+10","36.554"
"TAU",2.89,24.94985,2.84,23.03,"-1e+10","33.582","-1e+10","33.818"
"TYL",6.42,28.51,7.95,17.95,"-1e+10","36.407","33.118","36.359"
"WHK",1.64,26.68,2.92,18.01,"-1e+10","36.409","29.206","35.845"
"WIF",0.88,24.47,0.32,23.12,"-1e+10","35.209","-1e+10","35.187"
"WPF",0.88,28.58,0.32,26.7,"-1e+10","36.089","-1e+10","35.587"
"WSK",0.88,23.77,0.32,21.88,"-1e+10","36.089","-1e+10","35.764"
"WTF",1.55,27.17,2.09,18.33,"-1e+10","36.409","-1e+10","35.894"
"YTF",1.17,25.21,0.32,20.02,"-1e+10","35.772","-1e+10","35.645"
130 changes: 130 additions & 0 deletions thresholds/seasonal_thresholds_NRHA_ecomon_t7_d1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
"Code","SEASON","min_bottom_temp","max_bottom_temp","min_surface_temp","max_surface_temp","min_bottom_sal","max_bottom_sal","min_surface_sal","max_surface_sal"
"BLF","Fall",10.29,28.08,7.82,27.05,"-1e+10","36.338","-1e+10","36.385"
"BLF","Spring",5.78,19.68,5.94,20.31,"-1e+10","36.447","29.101","36.389"
"BLF","Summer",16.79,23.61,13.47,22.4753,"26.213","32.13","27.143","33.708"
"BLF","Winter",6.72,19.75,8.36,17.64,"-1e+10","36.362","32.803","36.312"
"BSB","Fall",9.68,28.8,7,27.53,"-1e+10","36.316","-1e+10","36.401"
"BSB","Spring",3.44,22.45,3.25,21,"-1e+10","36.43","26.2028","36.404"
"BSB","Summer",14.52,24.94985,7.16,22.12113,"26.213","32.13","27.4235","33.1385"
"BSB","Winter",3.15,19.75,4.31,18.26,"-1e+10","36.407","-1e+10","36.365"
"BUT","Fall",7.93,29.23,4.72,27.5,"-1e+10","36.359","-1e+10","36.509"
"BUT","Spring",2.53,24.12,3.8,21.12,"-1e+10","36.578","-1e+10","36.489"
"BUT","Summer",10.47,25.05,4.83,22.12113,"8.5465","32.267","21.6008","33.708"
"BUT","Winter",3.15,20.27,4.68,15.9,"-1e+10","36.466","-1e+10","36.043"
"COD","Fall",8.88,23.08,4.41,17.89,"-1e+10","33.685","-1e+10","35.286"
"COD","Spring",1.17,13.17,1.35,12.51,"-1e+10","34.085","29.6119","35.5"
"COD","Summer",5.85,20.97,3.35,11.952,"30.603","32.366","31.641","34.818"
"COD","Winter",0.88,9.12,1.44,12.56,"31.24","33.128","30.729","35.402"
"DOG","Fall",8.7,27.66,4.41,22.91,"-1e+10","35.819","-1e+10","35.82"
"DOG","Spring",1.21,22.01,2.39,17.34,"-1e+10","36.578","-1e+10","36.114"
"DOG","Summer",5.85,22.04,3.61,13.47,"30.545","32.367","31.119","34.818"
"DOG","Winter",2.292,19.47,2.09,16.62,"-1e+10","36.478","-1e+10","36.255"
"DRM","Fall",13.26,29.04,9.96,28.33,"-1e+10","36.338","-1e+10","36.455"
"DRM","Spring",4.54,23.69,4.64,19.47,"-1e+10","36.578","-1e+10","36.428"
"DRM","Summer",16.67,23.763,8.883,23.15,"8.5465","34.279","21.6008","34.678"
"DRM","Winter",4.63,12.15,4.15,15.9,"-1e+10","35.231","31.165","36.043"
"FDE","Fall",8.88,25.9,4.41,26.6,"-1e+10","35.806","27.4185","36.168"
"FDE","Spring",1.68,16.7,1.27,15.01,"-1e+10","36.031","-1e+10","35.7"
"FDE","Summer",5.85,24.94985,3.63,22.12113,"8.5465","32.367","21.6008","34.114"
"FDE","Winter",0.88,12.06,1.44,14.94,"-1e+10","35.072","30.18","35.771"
"HAD","Fall",8.88,27.59,4.64,18.58,"-1e+10","35.819","-1e+10","35.646"
"HAD","Spring",1.17,19.16,2.69,13.64,"-1e+10","36.089","-1e+10","35.568"
"HAD","Summer",10.47,19.74,4.22,9,"30.603","32.366","31.551","35.008"
"HAD","Winter",1.55,12.39,3.03,12.81,"-1e+10","35.169","32.046","35.402"
"HAL","Fall",9.43,16.27,5.65,13.61,"31.065","33.64","31.715","35.001"
"HAL","Spring",1.17,11.63,2.55,9.6,"-1e+10","33.298","31.691","34.556"
"HAL","Summer",Inf,-Inf,6.47,6.65,"NA","NA","32.352","32.403"
"HAL","Winter",5.98,5.98,5.57,7.91,"32.044","32.044","32.376","33.603"
"HER","Fall",8.7,25.16,4.41,19.9,"-1e+10","34.55","31.031","35.241"
"HER","Spring",1.66,13.17,1.23,14.36,"-1e+10","35.393","-1e+10","35.645"
"HER","Summer",5.85,20.97,3.35,20.8659,"30.176","32.367","30.497","34.818"
"HER","Winter",0.88,9.76,1.44,13.16,"-1e+10","34.199","-1e+10","35.128"
"LSK","Fall",9.46,28.36,4.72,23.45,"-1e+10","35.819","-1e+10","35.894"
"LSK","Spring",1.17,19.16,1.71,16.27,"-1e+10","36.114","-1e+10","35.73"
"LSK","Summer",11.33,25.05,4.6,21.75,"26.213","31.73","27.4235","33.708"
"LSK","Winter",0.88,14.92,0.32,15.72,"-1e+10","35.816","-1e+10","35.854"
"MAK","Fall",8.7,23.42,4.95,22.53,"-1e+10","34.678","30.359","35.728"
"MAK","Spring",1.21,17.02,2.48,14.66,"-1e+10","36.031","-1e+10","35.838"
"MAK","Summer",13.59,22.04,4.22,20.66,"29.22","31.805","28.898","33.354"
"MAK","Winter",3.06,11.4,3.76,14.19,"-1e+10","35.231","31.165","35.586"
"OHK","Fall",11.25,29.21,6.22,15.59,"31.342","35.833","32.384","35.956"
"OHK","Spring",3.87,22.7,4.63,15.22,"-1e+10","36.579","-1e+10","35.845"
"OHK","Summer",Inf,-Inf,Inf,-Inf,"NA","NA","NA","NA"
"OHK","Winter",4.56,18.84,6.34,14.79,"-1e+10","36.409","32.566","35.862"
"OPT","Fall",9.46,27.59,4.41,19.85,"27.587","35.017","31.187","35.688"
"OPT","Spring",1.66,12.74,1.27,13.64,"-1e+10","35.321","-1e+10","35.638"
"OPT","Summer",5.85,19.74,3.35,11.952,"30.57","32.366","31.551","34.741"
"OPT","Winter",1.3,10.1,1.44,14.01,"-1e+10","34.199","31.662","35.415"
"PLA","Fall",8.7,18.53,4.41,16.19,"-1e+10","34.176","31.208","35.56"
"PLA","Spring",1.21,12.74,1.35,10.84,"-1e+10","33.864","30.544","35.14"
"PLA","Summer",5.85,22.04,3.35,10.28,"30.545","32.366","31.119","34.741"
"PLA","Winter",2.476,9.76,3.32,11.57,"31.522","33.481","32.046","34.99"
"POL","Fall",9.12,22.84,4.77,17.14,"-1e+10","33.64","-1e+10","35.286"
"POL","Spring",1.21,12.25,2.18,11.23,"-1e+10","33.923","30.577","35.305"
"POL","Summer",5.85,20.97,3.35,8.883,"30.596","32.367","31.551","34.114"
"POL","Winter",2.552,10.96,2.78,12.14,"31.522","35.26","32.197","35.512"
"QHG","Fall",11.64,18.7199,7.48,13.05,"30.9983","32.321","32.453","33.277"
"QHG","Spring",6.26,9.75,3.77,8.36,"31.507","33.085","32.046","34.185"
"QHG","Summer",Inf,-Inf,7.1,7.1,"NA","NA","32.198","32.198"
"QHG","Winter",8.72,8.72,9.47,9.47,"33.751","33.751","34.1","34.1"
"RED","Fall",8.7,22.29,4.55,14.72,"-1e+10","34.783","31.759","35.58"
"RED","Spring",1.68,12.25,2.34,11.23,"-1e+10","33.923","31.43","35.286"
"RED","Summer",10.26,20.24,3.35,9.69,"30.57","32.367","31.943","35.008"
"RED","Winter",8.88,9.76,8.03,9.02,"32.361","33.332","32.197","34.161"
"RHK","Fall",8.7,27.59,4.41,22.0707,"-1e+10","35.819","-1e+10","35.956"
"RHK","Spring",1.64,20.12,1.71,16.55,"-1e+10","36.43","-1e+10","35.845"
"RHK","Summer",5.85,22.3124,3.35,21.75,"25.2718","32.367","27.3438","34.741"
"RHK","Winter",1.21,19.75,1.74,17.64,"-1e+10","36.466","-1e+10","36.312"
"SAL","Spring",Inf,-Inf,Inf,-Inf,"NA","NA","NA","NA"
"SAL","Winter",Inf,-Inf,Inf,-Inf,"NA","NA","NA","NA"
"SCU","Fall",9.49,29.23,7.75,28.33,"-1e+10","36.338","-1e+10","36.5"
"SCU","Spring",4.25,23.69,4.12,20.88,"-1e+10","36.448","26.2028","36.454"
"SCU","Summer",16.67,24.94985,8.883,22.4753,"8.5465","32.13","21.6008","33.708"
"SCU","Winter",4.63,20.27,4.15,18.26,"-1e+10","36.478","30.907","36.365"
"SDF","Fall",22.92,22.92,9.38,14.08,"34.645","34.645","35.175","35.505"
"SDF","Spring",6.05,8.83,5.33,10.76,"22.05","32.586","26.995","34.608"
"SDF","Summer",Inf,-Inf,Inf,-Inf,"NA","NA","NA","NA"
"SDF","Winter",6.24,8.22,5.92,12.79,"32.683","33.624","32.703","35.243"
"SHK","Fall",7.93,29.21,4.41,24.46,"-1e+10","36.061","-1e+10","35.956"
"SHK","Spring",1.21,22.01,1.8,16.42,"-1e+10","36.578","-1e+10","36.2"
"SHK","Summer",5.85,25.05,3.35,16.2028,"25.2718","32.367","27.3438","35.008"
"SHK","Winter",1.3,19.02,1.74,15.9,"-1e+10","36.362","-1e+10","36.043"
"SK","Fall",8.7,29.76,4.55,27.5,"-1e+10","36.359","-1e+10","36.5"
"SK","Spring",1.17,24.12,2.18,20.73,"-1e+10","36.579","-1e+10","36.464"
"SK","Summer",10.26,25.05,3.35,21.75,"28.68","32.367","27.143","34.818"
"SK","Winter",2.292,20.27,3.32,18.26,"-1e+10","36.478","30.907","36.365"
"SUF","Fall",10.52,29.4,7.59,28.22,"-1e+10","36.34","-1e+10","36.426"
"SUF","Spring",2.83,23.69,1.8,20.73,"-1e+10","36.558","-1e+10","36.554"
"SUF","Summer",16.67,24.94985,8.883,22.12113,"26.68","32.13","27.143","33.1385"
"SUF","Winter",1.55,19.47,1.74,18.26,"-1e+10","36.478","-1e+10","36.365"
"TAU","Fall",11.19,23.81,10.51,23.03,"-1e+10","32.293","-1e+10","32.896"
"TAU","Spring",2.89,12.646,2.84,11.3311,"-1e+10","32.417","26.2028","33.353"
"TAU","Summer",20.8718,24.94985,16.0121,22.4753,"27.0051","30.57576","27.2897","31.25076"
"TAU","Winter",3.42,7.96,3.24,8.91,"31.986","33.582","31.911","33.818"
"TYL","Fall",23.18,28.51,7.95,17.95,"30.846","33.737","33.118","36.359"
"TYL","Spring",6.42,12.84,8.91,13.83,"32.903","35.773","33.941","35.719"
"TYL","Winter",17.35,18.62,12.07,15.16,"-1e+10","36.407","35.5","35.965"
"WHK","Fall",8.7,26.68,4.41,18.01,"-1e+10","35.819","31.264","35.646"
"WHK","Spring",1.64,16.97,2.92,15.22,"-1e+10","35.83","29.206","35.845"
"WHK","Summer",5.85,22.1631,3.35,13.956,"16.9258","32.367","30.7359","34.741"
"WHK","Winter",3.15,18.84,4.32,13.82,"-1e+10","36.409","32.34","35.59"
"WIF","Fall",8.88,24.47,4.95,23.12,"-1e+10","35.209","-1e+10","35.024"
"WIF","Spring",1.64,13.17,1.23,11.3311,"-1e+10","33.923","-1e+10","35.187"
"WIF","Summer",5.85,23.61,4.58,22.4753,"16.9258","32.267","27.2897","33.708"
"WIF","Winter",0.88,9.24,0.32,9.23,"-1e+10","33.962","30.18","34.302"
"WPF","Fall",9.18,28.58,6.1,26.7,"-1e+10","35.772","-1e+10","35.331"
"WPF","Spring",1.41,19.16,1.71,16.679,"-1e+10","36.089","-1e+10","35.587"
"WPF","Summer",13.59,23.61,5.93,21.75,"25.2718","32.13","27.143","33.708"
"WPF","Winter",0.88,10.36,0.32,10.95,"-1e+10","35.281","-1e+10","35.182"
"WSK","Fall",8.7,23.77,5.15,21.88,"-1e+10","35.819","-1e+10","35.764"
"WSK","Spring",1.17,19.16,1.27,14.85,"-1e+10","36.089","-1e+10","35.73"
"WSK","Summer",13.28,19.74,6.13,13.47,"30.695","30.988","31.501","33.708"
"WSK","Winter",0.88,12.39,0.32,13.43,"-1e+10","35.169","30.18","35.452"
"WTF","Fall",8.7,27.17,4.41,18.33,"-1e+10","35.627","31.536","35.894"
"WTF","Spring",2.02,19.16,2.34,13.77,"-1e+10","36.406","-1e+10","35.73"
"WTF","Summer",5.85,20.24,3.35,10.17,"30.57","32.367","31.91","34.741"
"WTF","Winter",1.55,18.84,2.09,14.46,"-1e+10","36.409","31.61","35.854"
"YTF","Fall",9.06,25.21,4.72,20.02,"20.615","35.772","31.045","35.464"
"YTF","Spring",1.17,13.17,1.98,14.15,"-1e+10","35.328","-1e+10","35.645"
"YTF","Summer",10.47,22.04,4.58,11.952,"30.545","32.366","31.551","32.896"
"YTF","Winter",1.21,9.24,0.32,11.57,"-1e+10","34.067","-1e+10","34.99"

0 comments on commit 5855566

Please sign in to comment.