diff --git a/R/trans_dates.R b/R/trans_dates.R index 296aed5..141072c 100644 --- a/R/trans_dates.R +++ b/R/trans_dates.R @@ -52,11 +52,19 @@ fall_trans <- daily_sst %>% dplyr::group_by(Location,Y) %>% dplyr::summarise(falltrans = min(Date)) +#max date = +max_date <- daily_sst %>% + dplyr::group_by(Location,Y) %>% + dplyr::filter(roll_mean_sst == max(roll_mean_sst)) %>% + dplyr::select(Location, Y, Date) + #merge #calculate summer length = fall transition - spring transition trans_dates <- dplyr::left_join(spr_trans,fall_trans,by=c("Location","Y")) %>% - dplyr::mutate(sumlen = falltrans-sprtrans) %>% - dplyr::rename(EPU = Location, Year = Y) + dplyr::mutate(sumlen = falltrans-sprtrans) + +trans_dates <- dplyr::left_join(trans_dates,max_date,by=c("Location","Y")) %>% + dplyr::rename(EPU = Location, Year = Y, maxday = Date) #write output file write.csv(x = trans_dates, file = here::here("data/trans_dates.csv"), row.names = FALSE) diff --git a/data/trans_dates.csv b/data/trans_dates.csv index 7744f08..1407e60 100644 --- a/data/trans_dates.csv +++ b/data/trans_dates.csv @@ -1,130 +1,130 @@ -"EPU","Year","sprtrans","falltrans","sumlen" -"GBK",1982,156,345,189 -"GBK",1983,155,329,174 -"GBK",1984,159,328,169 -"GBK",1985,154,337,183 -"GBK",1986,156,326,170 -"GBK",1987,159,318,159 -"GBK",1988,164,324,160 -"GBK",1989,153,330,177 -"GBK",1990,162,315,153 -"GBK",1991,147,319,172 -"GBK",1992,161,318,157 -"GBK",1993,162,331,169 -"GBK",1994,155,329,174 -"GBK",1995,172,332,160 -"GBK",1996,162,309,147 -"GBK",1997,166,324,158 -"GBK",1998,163,311,148 -"GBK",1999,151,345,194 -"GBK",2000,154,328,174 -"GBK",2001,156,349,193 -"GBK",2002,150,333,183 -"GBK",2003,163,333,170 -"GBK",2004,166,318,152 -"GBK",2005,156,327,171 -"GBK",2006,149,342,193 -"GBK",2007,172,316,144 -"GBK",2008,160,329,169 -"GBK",2009,160,351,191 -"GBK",2010,151,332,181 -"GBK",2011,148,346,198 -"GBK",2012,139,342,203 -"GBK",2013,142,332,190 -"GBK",2014,155,341,186 -"GBK",2015,148,342,194 -"GBK",2016,148,340,192 -"GBK",2017,163,347,184 -"GBK",2018,150,332,182 -"GBK",2019,158,336,178 -"GBK",2020,159,346,187 -"GBK",2021,148,341,193 -"GBK",2022,135,356,221 -"GBK",2023,150,330,180 -"GBK",2024,150,NA,NA -"GOM",1982,143,328,185 -"GOM",1983,155,327,172 -"GOM",1984,159,337,178 -"GOM",1985,154,328,174 -"GOM",1986,159,311,152 -"GOM",1987,150,310,160 -"GOM",1988,151,307,156 -"GOM",1989,144,321,177 -"GOM",1990,160,312,152 -"GOM",1991,143,310,167 -"GOM",1992,159,302,143 -"GOM",1993,163,308,145 -"GOM",1994,157,320,163 -"GOM",1995,157,322,165 -"GOM",1996,153,310,157 -"GOM",1997,161,316,155 -"GOM",1998,146,305,159 -"GOM",1999,147,319,172 -"GOM",2000,151,326,175 -"GOM",2001,156,316,160 -"GOM",2002,153,330,177 -"GOM",2003,160,317,157 -"GOM",2004,162,310,148 -"GOM",2005,157,321,164 -"GOM",2006,148,308,160 -"GOM",2007,149,312,163 -"GOM",2008,154,326,172 -"GOM",2009,151,337,186 -"GOM",2010,142,323,181 -"GOM",2011,148,342,194 -"GOM",2012,137,344,207 -"GOM",2013,137,326,189 -"GOM",2014,141,332,191 -"GOM",2015,146,336,190 -"GOM",2016,144,343,199 -"GOM",2017,153,333,180 -"GOM",2018,140,325,185 -"GOM",2019,152,332,180 -"GOM",2020,148,340,192 -"GOM",2021,135,348,213 -"GOM",2022,143,346,203 -"GOM",2023,145,329,184 -"GOM",2024,141,NA,NA -"MAB",1982,144,319,175 -"MAB",1983,150,319,169 -"MAB",1984,147,325,178 -"MAB",1985,142,334,192 -"MAB",1986,141,322,181 -"MAB",1987,148,310,162 -"MAB",1988,143,305,162 -"MAB",1989,144,323,179 -"MAB",1990,151,316,165 -"MAB",1991,135,309,174 -"MAB",1992,157,312,155 -"MAB",1993,149,308,159 -"MAB",1994,150,323,173 -"MAB",1995,146,324,178 -"MAB",1996,152,307,155 -"MAB",1997,161,314,153 -"MAB",1998,148,307,159 -"MAB",1999,147,334,187 -"MAB",2000,137,311,174 -"MAB",2001,148,322,174 -"MAB",2002,146,323,177 -"MAB",2003,158,318,160 -"MAB",2004,136,315,179 -"MAB",2005,155,322,167 -"MAB",2006,145,327,182 -"MAB",2007,147,313,166 -"MAB",2008,155,316,161 -"MAB",2009,143,327,184 -"MAB",2010,143,314,171 -"MAB",2011,138,320,182 -"MAB",2012,132,324,192 -"MAB",2013,141,320,179 -"MAB",2014,137,323,186 -"MAB",2015,130,336,206 -"MAB",2016,147,327,180 -"MAB",2017,149,330,181 -"MAB",2018,142,320,178 -"MAB",2019,141,326,185 -"MAB",2020,151,339,188 -"MAB",2021,137,328,191 -"MAB",2022,148,331,183 -"MAB",2023,135,317,182 -"MAB",2024,147,NA,NA +"EPU","Year","sprtrans","falltrans","sumlen","maxday" +"GBK",1982,156,345,189,NA +"GBK",1983,155,329,174,248 +"GBK",1984,159,328,169,227 +"GBK",1985,154,337,183,227 +"GBK",1986,156,326,170,219 +"GBK",1987,159,318,159,231 +"GBK",1988,164,324,160,215 +"GBK",1989,153,330,177,229 +"GBK",1990,162,315,153,244 +"GBK",1991,147,319,172,209 +"GBK",1992,161,318,157,240 +"GBK",1993,162,331,169,246 +"GBK",1994,155,329,174,213 +"GBK",1995,172,332,160,229 +"GBK",1996,162,309,147,238 +"GBK",1997,166,324,158,229 +"GBK",1998,163,311,148,222 +"GBK",1999,151,345,194,252 +"GBK",2000,154,328,174,246 +"GBK",2001,156,349,193,232 +"GBK",2002,150,333,183,232 +"GBK",2003,163,333,170,224 +"GBK",2004,166,318,152,215 +"GBK",2005,156,327,171,223 +"GBK",2006,149,342,193,221 +"GBK",2007,172,316,144,214 +"GBK",2008,160,329,169,214 +"GBK",2009,160,351,191,233 +"GBK",2010,151,332,181,244 +"GBK",2011,148,346,198,272 +"GBK",2012,139,342,203,238 +"GBK",2013,142,332,190,204 +"GBK",2014,155,341,186,217 +"GBK",2015,148,342,194,233 +"GBK",2016,148,340,192,253 +"GBK",2017,163,347,184,216 +"GBK",2018,150,332,182,228 +"GBK",2019,158,336,178,233 +"GBK",2020,159,346,187,227 +"GBK",2021,148,341,193,234 +"GBK",2022,135,356,221,219 +"GBK",2023,150,330,180,208 +"GBK",2024,150,NA,NA,NA +"GOM",1982,143,328,185,NA +"GOM",1983,155,327,172,220 +"GOM",1984,159,337,178,229 +"GOM",1985,154,328,174,228 +"GOM",1986,159,311,152,228 +"GOM",1987,150,310,160,231 +"GOM",1988,151,307,156,226 +"GOM",1989,144,321,177,227 +"GOM",1990,160,312,152,227 +"GOM",1991,143,310,167,207 +"GOM",1992,159,302,143,239 +"GOM",1993,163,308,145,241 +"GOM",1994,157,320,163,214 +"GOM",1995,157,322,165,227 +"GOM",1996,153,310,157,237 +"GOM",1997,161,316,155,228 +"GOM",1998,146,305,159,219 +"GOM",1999,147,319,172,211 +"GOM",2000,151,326,175,242 +"GOM",2001,156,316,160,223 +"GOM",2002,153,330,177,227 +"GOM",2003,160,317,157,227 +"GOM",2004,162,310,148,243 +"GOM",2005,157,321,164,224 +"GOM",2006,148,308,160,220 +"GOM",2007,149,312,163,213 +"GOM",2008,154,326,172,214 +"GOM",2009,151,337,186,231 +"GOM",2010,142,323,181,244 +"GOM",2011,148,342,194,214 +"GOM",2012,137,344,207,238 +"GOM",2013,137,326,189,199 +"GOM",2014,141,332,191,222 +"GOM",2015,146,336,190,241 +"GOM",2016,144,343,199,228 +"GOM",2017,153,333,180,202 +"GOM",2018,140,325,185,221 +"GOM",2019,152,332,180,233 +"GOM",2020,148,340,192,227 +"GOM",2021,135,348,213,226 +"GOM",2022,143,346,203,219 +"GOM",2023,145,329,184,208 +"GOM",2024,141,NA,NA,NA +"MAB",1982,144,319,175,NA +"MAB",1983,150,319,169,221 +"MAB",1984,147,325,178,230 +"MAB",1985,142,334,192,228 +"MAB",1986,141,322,181,219 +"MAB",1987,148,310,162,232 +"MAB",1988,143,305,162,218 +"MAB",1989,144,323,179,229 +"MAB",1990,151,316,165,230 +"MAB",1991,135,309,174,204 +"MAB",1992,157,312,155,226 +"MAB",1993,149,308,159,242 +"MAB",1994,150,323,173,200 +"MAB",1995,146,324,178,210 +"MAB",1996,152,307,155,238 +"MAB",1997,161,314,153,229 +"MAB",1998,148,307,159,203 +"MAB",1999,147,334,187,211 +"MAB",2000,137,311,174,223 +"MAB",2001,148,322,174,234 +"MAB",2002,146,323,177,231 +"MAB",2003,158,318,160,229 +"MAB",2004,136,315,179,215 +"MAB",2005,155,322,167,225 +"MAB",2006,145,327,182,217 +"MAB",2007,147,313,166,215 +"MAB",2008,155,316,161,215 +"MAB",2009,143,327,184,236 +"MAB",2010,143,314,171,222 +"MAB",2011,138,320,182,213 +"MAB",2012,132,324,192,220 +"MAB",2013,141,320,179,200 +"MAB",2014,137,323,186,248 +"MAB",2015,130,336,206,232 +"MAB",2016,147,327,180,228 +"MAB",2017,149,330,181,202 +"MAB",2018,142,320,178,222 +"MAB",2019,141,326,185,232 +"MAB",2020,151,339,188,211 +"MAB",2021,137,328,191,240 +"MAB",2022,148,331,183,242 +"MAB",2023,135,317,182,207 +"MAB",2024,147,NA,NA,NA