class: center, middle, inverse, title-slide # Open source water quality reporting tools for the PEP Monitoring Collaborative ###
Dr. Marcus Beck
•
@fawda123
•
#TampaBayOpensci
### Tampa Bay Estuary Program ### 10/19/2020 --- class: left, top .center[ ## AGENDA FOR TODAY ] 1. Overview of open science philosophy 1. Application to TBEP and partner reporting products 1. Tech transfer to other NEPs 1. PEP reporting tools: `peptools` R package 1. Discussion, next steps --- class: left, top .center[ ## GOALS FOR TODAY ] 1. Vibe check: do we like these approaches? 1. Are there additional tools to add? 1. How could the Monitoring Collaborative use these tools? -- <h3 style="text-align: center;"> We are not revisiting past decisions, but understanding how the tools use these decisions and could be used to answer future questions! </h3> --- class: middle, center # Open Science: why, what, and how --- class: middle, center ## The research-management divide <img src="figure/divide2.png" width="100%" style="display: block; margin: auto;" /> --- class: middle, center <img src="figure/michener.png" width="90%" style="display: block; margin: auto;" /> .footnote[[Michener et al. 1997 Ecol. App. 7(1):330-342.](https://www.researchgate.net/publication/246959596_Nongeospatial_Metadata_for_the_Ecological_Sciences)] --- class: middle, center ## Open science can bridge this divide <img src="figure/bridge.png" width="100%" style="display: block; margin: auto;" /> --- class: middle, center <img src="figure/fiveschools.PNG" width="85%" style="display: block; margin: auto;" /> .footnote[[Fecher and Friesike 2014. Opening Science, Springer.](https://doi.org/10.1007/978-3-319-00026-8_2)] --- class: middle, center ### The practice of science in such a way that others can **collaborate** and **contribute**, where research data, lab notes and other research processes are **freely available**, under terms that enable **reuse**, **redistribution** and **reproduction** of the research and its underlying data and methods .footnote[Open Knowledge International, [http://opendefinition.org/](http://opendefinition.org/), [https://creativecommons.org/](https://creativecommons.org/about/program-areas/open-science/)] -- ### Data are __F__indable, __A__ccessible, __I__nteroperable, and __R__esuable .footnote[[Wilkinson et al. 2016 Nature 3:160018](https://doi.org/10.1038/sdata.2016.18)] --- class: top, center ## OPEN SCIENCE AT TBEP .pull-left[ <img src="figure/wqstatic1.PNG" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="figure/wqstatic2.PNG" width="100%" style="display: block; margin: auto;" /> ] --- class: top, center ## THE OLD WAY <img src="figure/badflow2.png" width="100%" style="display: block; margin: auto;" /> --- class: top, center ## THE NEW WAY <img src="figure/flow3.png" width="100%" style="display: block; margin: auto;" /> --- class: left, top .center[ ## `TBEPTOOLS` R PACKAGE ] * Import raw data, estimate indicators, and report outcomes * Foundational methods for indicator reporting * Freely available on GitHub for anyone to view source code, download for use, and make requests for additions <img src="figure/tbeptoolshex.png" width="20%" style="display: block; margin: auto;" /> --- class: top, center ## WEBSITE <img src="figure/tbeptools.PNG" width="100%" style="display: block; margin: auto;" /> [https://tbep-tech.github.io/tbeptools/](https://tbep-tech.github.io/tbeptools) --- class: top, center ## FUNCTION REFERENCES <img src="figure/tbeptoolsref.PNG" width="100%" style="display: block; margin: auto;" /> --- class: top, center ## DOCUMENTATION <img src="figure/tbeptoolsdoc.PNG" width="100%" style="display: block; margin: auto;" /> --- class: top, center ## VIGNETTES <img src="figure/tbeptoolsvig.PNG" width="100%" style="display: block; margin: auto;" /> --- class: top, center ## SOURCE CODE <img src="figure/tbeptoolssrc.PNG" width="100%" style="display: block; margin: auto;" /> --- class: middle, left .center[ ## IT'S SUPER SIMPLE... ] ```r library(tbeptools) xlsx <- 'data/2019_Results_updated.xls' ecpdata <- read_importwq(xlsx) show_thrplot(epcdata, bay_segment = "OTB", thr = "chla") ``` <img src="peptools_files/figure-html/unnamed-chunk-16-1.png" width="100%" style="display: block; margin: auto;" /> --- class: left, top .center[ ## TECH TRANSFER ] <img src="figure/repetitive.png" width="90%" style="display: block; margin: auto;" /> --- class: left, top .center[ ## TECH TRANSFER ] * No need to reinvent the wheel! -- * Leverage other methods (technical foundation) AND tools (analysis workflows) using FAIR principles -- * Increase collaboration among NEPs, we are a community that should be open and learn from each other --- class: center, top ## `peptools` R PACKAGE <img src="figure/pepintro.PNG" width="100%" style="display: block; margin: auto;" /> .footenote[[https://tbep-tech.github.io/peptools/](https://tbep-tech.github.io/peptools/)] --- class: center, top ## `peptools` R PACKAGE <img src="figure/pepfuncs.PNG" width="90%" style="display: block; margin: auto;" /> --- class: left, top .center[ ## PAST DECISIONS ] * Consider existing LTM datasets that can be used to assess progress in attaining CCMP goals (*Goal: Clean Waters*) -- * Spatial divisions of Peconic Estuary for applying numeric thresholds -- * Relevant thresholds and how to quantify (median vs. mean) -- * Stoplight graphic for public-facing documents, update annually --- class: left, top .center[ ## IT'S SUPER SIMPLE... ] ```r library(peptools) dat <- read_pepwq('data/currentdata.xlsx') show_thrpep(dat, bay_segment = "Western", param = "chla") ``` <img src="peptools_files/figure-html/unnamed-chunk-20-1.png" width="100%" style="display: block; margin: auto;" /> --- class: left, top .center[ ## EXISTING DATA ] ```r locs <- st_as_sf(pepstations, coords = c('Longitude', 'Latitude'), crs = 4326) mapview(locs, zcol = 'bay_segment', layer.name = 'Bay segment') ```
--- class: left, top .center[ ## EXISTING DATA ] ```r show_sitemappep(dat, yrsel = 2019, param = 'sd') ```
--- class: left, top .center[ ## ESTIMATE SEGMENT MEDIANS ] * All segment annual values based on medians, account for censored data (secchi on bottom) ```r medpep <- anlz_medpep(dat) medpep$ann ``` ``` ## # A tibble: 792 x 5 ## bay_segment yr val est var ## <fct> <dbl> <dbl> <chr> <chr> ## 1 Western 2019 3.03 lwr.ci chla ## 2 Western 2019 4.22 medv chla ## 3 Western 2019 6.26 upr.ci chla ## 4 Western 2018 3.89 lwr.ci chla ## 5 Western 2018 4.82 medv chla ## 6 Western 2018 6 upr.ci chla ## 7 Western 2017 3.58 lwr.ci chla ## 8 Western 2017 5.29 medv chla ## 9 Western 2017 7.04 upr.ci chla ## 10 Western 2016 3.14 lwr.ci chla ## # ... with 782 more rows ``` --- .center[ ## REPORTING ] * Provisional targets ([Suffolk Co 2019 SWP](https://suffolkcountyny.gov/Departments/Health-Services/Environmental-Quality#SubWWPlan)) for water clarity and secchi depth ```r peptargets ``` ``` ## # A tibble: 3 x 4 ## bay_segment name sd_thresh chla_thresh ## <fct> <chr> <dbl> <dbl> ## 1 Western Western 6.5 5.5 ## 2 Central Central 6.5 5.5 ## 3 Eastern Eastern 6.5 5.5 ``` --- .center[ ## REPORTING ] * Apply targets to annual medians ```r anlz_attainpep(medpep) ``` ``` ## # A tibble: 132 x 4 ## bay_segment yr chla_sd outcome ## <fct> <dbl> <chr> <chr> ## 1 Western 2019 2_3 red ## 2 Western 2018 2_3 red ## 3 Western 2017 2_3 red ## 4 Western 2016 0_3 yellow ## 5 Western 2015 0_2 yellow ## 6 Western 2014 0_0 green ## 7 Western 2013 1_1 yellow ## 8 Western 2012 1_2 yellow ## 9 Western 2011 1_2 yellow ## 10 Western 2010 3_3 red ## # ... with 122 more rows ``` --- class: left, top .center[ ## REPORTING ] * Jointly considers chlorophyll and water clarity endpoints * Annual categories depend on both a __duration__ and __magnitude__ of exceedance -- <img src="figure/outints.png" width="90%" style="display: block; margin: auto;" /> .center[ .footnote[[TBEP tech report #04-00](https://drive.google.com/file/d/1juhfptqA4R-Bq_XfW6nOhqFxJSorGkfq/view?usp=drivesdk)] ] --- class: left, top .center[ ## REPORTING ] * Jointly considers chlorophyll and water clarity endpoints * Annual categories depend on both a __duration__ and __magnitude__ of exceedance <img src="figure/matrixcats.png" width="80%" style="display: block; margin: auto;" /> .center[ .footnote[[TBEP tech report #04-00](https://drive.google.com/file/d/1juhfptqA4R-Bq_XfW6nOhqFxJSorGkfq/view?usp=drivesdk)] ] --- class: left, top .center[ ## REPORTING ] * Translate segment water quality conditions into annual reporting categories to inform/prioritize management actions towards CCMP goals -- * In Tampa... <span style="color:#33FF3B; text-shadow: 0 0 3px #333;">__Stay the Course__</span>: Continue planned projects. Report data via annual progress reports and Baywide Environmental Monitoring Report. <span style="color:#F9FF33; text-shadow: 0 0 3px #333;">__Caution__</span>: Review monitoring data and nitrogen loading estimates. Begin/continue TAC and Management Board development of specific management recommendations. <span style="color:#FF3333; text-shadow: 0 0 3px #333;">__On Alert__</span>: Finalize development and implement appropriate management actions to get back on track. --- class: left, top .center[ ## REPORTING ] ```r show_matrixpep(dat, asreact = TRUE, nrows = 8) ```
--- class: left, top .center[ ## REPORTING ] ```r show_plotlypep(rawdat, bay_segment = 'Western') ```
--- class: left, top .center[ ## EXPLORING ALTERNATIVES ] * Future discussions may involve additional decisions on appropriate targets * AND if the targets vary by estuary segments, e.g., by salinity gradients -- * The `peptools` package was built with this in mind... ```r segs <- c('Western', 'Central', 'Eastern') newtrgs <- tibble( bay_segment = factor(segs, levels = segs), name = factor(segs, levels = segs), sd_thresh = c(5.5, 6.5, 7.5), chla_thresh = c(6, 5.5, 5) ) ``` --- class: left, top .center[ ## EXPLORING ALTERNATIVES ] ```r show_matrixpep(dat, trgs = newtrgs, asreact = T, nrow = 8) ```
--- class: left, top .center[ ## RESOURCES ] * `peptools` package website: [link](https://tbep-tech.github.io/peptools/) * `peptools` GitHub source: [link](https://github.com/tbep-tech/peptools) * Alternative thresholds example: [link](https://tbep-tech.github.io/peptools/articles/Introduction.html#testing-different-thresholds) * `tbeptools` package website: [link](https://tbep-tech.github.io/tbeptools/) * TBEP open science subcommittee: [link](https://tbep.org/our-work/boards-committees/technical-advisory-committee/) --- class: left, top .center[ ## GOALS FOR TODAY ] 1. Vibe check: do we like these approaches? 1. Are there additional tools to add? 1. How could the Monitoring Collaborative use these tools?