Skip to content

Commit

Permalink
Write talk for national EAFMWG webinar, adding new slides (zooplankto…
Browse files Browse the repository at this point in the history
…n!) plus another option for ignoring some.
  • Loading branch information
andrew-edwards committed May 4, 2024
1 parent 91bd791 commit 2e36bda
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 46 deletions.
6 changes: 5 additions & 1 deletion data-raw/depth/depth.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ a <- H5Fopen("S102_S111sample/S102/102CA0024600N07100W.h5")
# https://www.charts.gc.ca/data-gestion/index-eng.html
# in the Bathymetry tab. OpenData link looks best.

# Kelsey going to help me.
# Kelsey going to help me. Cole made suggestions, added to Issue #48.

# From:
# https://open.canada.ca/data/en/dataset/e6e11b99-f0cc-44f7-f5eb-3b995fb1637e/resource/34d89346-527b-4723-9140-f4782cc384fb
# canada_west_coast_DEM_original.gdb. zip - 7 Gb file, taking an hour to download.
39 changes: 17 additions & 22 deletions talks/bccm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,30 @@ bccm_data
```

## Downloading data locally
The data are saved as a `sf` (simple feature) in a separate GitHub repository `pacea-data` (https://github.com/pbs-assess/pacea-data).
The data are saved as `sf` (simple feature) objects in a separate GitHub repository `pacea-data` (https://github.com/pbs-assess/pacea-data).

\
There are built in functions to download specific variables:
```{r bccmdataDLprompt, eval=FALSE}
bccm_avg100mtoBot_ph()

pacea would like to download and store these data in the directory:
One-time download to local machine (will take several minutes):
```{r bccm_all, eval=FALSE}
bccm_all_variables()
Downloading all BCCM data may take many minutes. Files will be downloaded to pacea_cache directory:
C:\Users\TAIT\AppData\Local/pacea/Cache
Is that okay?
Would you like to continue?
1: Yes
2: No
Selection:
```

## Example information

Average of pH from 100 m to sea bottom:

```{r bccm data head, eval=FALSE}
> bccm_avg100mtoBot_ph()
Simple feature collection with 33642 features and 324 fields
Geometry type: POLYGON
Dimension: XY
Expand All @@ -98,29 +105,17 @@ Projected CRS: NAD83 / BC Albers
# i 320 more variables: ...
```

## Downloading data locally
\
Or all variables (will take several minutes):
```{r bccm_all, eval=FALSE}
bccm_all_variables()

Downloading all BCCM data may take many minutes. Files will be downloaded to pacea_cache directory:
C:\Users\TAIT\AppData\Local/pacea/Cache
Would you like to continue?
1: Yes
2: No

Selection:
```

```{asis, echo = long_talk}
```{asis, echo = more_details}
## Help file
```
```{r bccmhelp, eval = FALSE, echo = long_talk}
```{r bccmhelp, eval = FALSE, echo = more_details}
?bccm_surface_oxygen
```

```{r bccmhelp2, eval = FALSE, echo = long_talk}
```{r bccmhelp2, eval = FALSE, echo = more_details}
BCCM environmental variable data
Description
Expand Down Expand Up @@ -151,7 +146,7 @@ Format
## Built in plotting

```{r bccmplot}
plot(bccm_surface_temperature(), months.plot = c("April", "july"), years.plot = c(2013, 2016, 2019))
plot(bccm_surface_temperature(), months.plot = c("april", "july"), years.plot = c(2013, 2016, 2019))
```

## Built in plotting
Expand Down
4 changes: 3 additions & 1 deletion talks/buoys.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ knitr::include_graphics(paste0(here::here(),
"/man/figures/buoys_map.png"))
```

```{asis, echo = long_talk}
```{asis}
## Sea surface temperature data from buoys
Extensive data processing to calculate daily mean SST:
Expand All @@ -42,6 +42,8 @@ Extensive data processing to calculate daily mean SST:
- Switch from DFO data stream to ECCC data stream when appropriate
- Time zones and daylight savings time
- Still working on fixing a few outliers in the high-resolution data (hard to automate)
```

Expand Down
10 changes: 5 additions & 5 deletions talks/indices.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ Continuing the help...
should be considered an estimate.
```

```{asis, echo = long_talk}
```{asis, echo = more_details}
## Climatic and oceanographic indices
So for some analyses you may want to restrict values to a specified time period
(for which values should not change in future `pacea` updates), for example
\
```
```{r onilocal, eval = long_talk, echo = long_talk}
```{r onilocal, eval = long_talk, echo = more_details}
oni_fix <- dplyr::filter(oni,
year < 2023 | year == 2023 & month < 3)
tail(oni_fix) # Will always end with February 2023
Expand Down Expand Up @@ -143,17 +143,17 @@ plot(oni,
lwd = 2)
```

```{asis, echo = long_talk}
```{asis, echo = more_details}
## Technical aside regarding `plot()`
The object `oni` has the class `pacea_index`: \
```

```{asis, eval = long_talk, echo = long_talk}
```{asis, eval = long_talk, echo = more_details}
class(oni)
```

```{asis, echo = long_talk}
```{asis, echo = more_details}
\
which ensures that `plot(oni)`
automatically uses our specialised function `plot.pacea_index(oni)`, giving
Expand Down
24 changes: 19 additions & 5 deletions talks/introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

- DFO's Competitive Science Research Fund for funding (project 21-FS-03-13).

```{asis, echo = long_talk}
```{asis, echo = explain_assessment}
## What is a stock assessment?
- Collect data from surveys and commercial fisheries, including ages of fish
Expand All @@ -23,12 +23,12 @@
Pacific Hake assessment from 2023, estimate the historical population size:
```

```{r hakeintro, echo = FALSE, eval = long_talk}
```{r hakeintro, echo = FALSE, eval = explain_assessment}
plot(hake_biomass,
y_max = 3.5)
```

```{asis, echo=long_talk}
```{asis, echo = explain_assessment}
## What is a stock assessment?
Advice often in the form of 'decision tables' that indicate probabilities of future events given
Expand Down Expand Up @@ -114,7 +114,7 @@ approach data matrix R-package. R package version 0.1 https://github.com/duplise

## Why an R package?

- R is the programming language most widely used by stock assessment scientists.
- R is the computer programming language most widely used by stock assessment scientists.

- An R package is the standard way to share code (and data).

Expand All @@ -128,7 +128,7 @@ approach data matrix R-package. R package version 0.1 https://github.com/duplise
- Include vignettes that walk users through various features.

- All data (except one type) is saved within the package, no further downloading
required.
required, so not relying on external websites being functional.

## Why an R package on GitHub?

Expand All @@ -148,6 +148,18 @@ knitr::include_graphics(paste0(here::here(),
- 'codecov' is the amount of the code that is covered by unit tests, which help weed
out bugs.

## Spatial domain

Started thinking about ecosystem assessment regions like in gslea:

```{r gslea, echo=FALSE, out.width="50%"}
knitr::include_graphics(paste0(here::here(),
"/talks/talks-manual-figures/gslmap.plain-1.png"))
```

But it became non-trivial to decide on regions, and we decided to explicitly include
spatial data.

## `pacea` objects

Currently, pacea contains:
Expand All @@ -163,3 +175,5 @@ Currently, pacea contains:
and those related to El Niño

- estimates of abundances for Harbour Seals and Pacific Hake

- zooplankton biomass anomalies for the Strait of Georgia
6 changes: 3 additions & 3 deletions talks/oisst.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ Geodetic CRS: WGS 84
# i Use `print(n = ...)` to see more rows
```

```{asis, echo = long_talk}
```{asis, echo = more_details}
## Help file
```
```{r oissthelp, eval=FALSE, echo=long_talk}
```{r oissthelp, eval = FALSE, echo = more_details}
?oisst_month
```

```{r oissthelp2, eval=FALSE, echo=long_talk}
```{r oissthelp2, eval = FALSE, echo = more_details}
Description
Simple features objects of NOAAs Optimal Interpolation SST
Expand Down
12 changes: 9 additions & 3 deletions talks/pacea-talk.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ or click the knit button in RStudio
Note the first slide below creates the title slide (on page 2), from a
powerpoint slide saved as .png.
See the long_talk = FALSE and other options in first chunk.
When talk is finished save the .pdf with a new name
(e.g. pacea-release-talk-dfo.pdf, pacea-release-talk-uvic.pdf) and commit the
.pdf, so we can just keep the single set of .Rmd code. Also link the pdf talk
Expand Down Expand Up @@ -78,8 +80,12 @@ orchid
-->

```{r, setup, include = FALSE}
long_talk <- FALSE # if FALSE then chunks with eval=long_talk will not be
# evaluated, as we are writing a shorter version
long_talk <- TRUE # if FALSE then chunks with eval=long_talk will not be
# evaluated, as we are writing a shorter version
explain_assessment <- FALSE # set to TRUE for two slides explaining stock assessment
more_details <- FALSE # set to TRUE for some of the more detailed slides
# (setting FALSE for national EAFM talk)
knitr::opts_chunk$set(
collapse = TRUE,
Expand Down Expand Up @@ -116,7 +122,7 @@ colorize <- function(x, color){

```{r coverpage, echo=FALSE, out.width = "100%"}
knitr::include_graphics(paste0(here::here(),
"/talks/talks-manual-figures/pacea-title-slide-sidney.png"))
"/talks/talks-manual-figures/pacea-title-slide-eafmwg-national.png"))
```

```{r introduction, child = "introduction.Rmd"}
Expand Down
32 changes: 32 additions & 0 deletions talks/populations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Currently, we have estimates of:

- Pacific Herring (coming soon)

\

Also have zooplankton biomass anomalies for the Strait of Georgia.

## Hake biomass

The hake biomass time series is saved as a `tibble` object in `pacea`:
Expand Down Expand Up @@ -100,3 +104,31 @@ Or just plot estimates for a single region:
plot(harbour_seals,
region = "SOG")
```

## Zooplankton in the Strait of Georgia

Biomass anomalies of zooplankton biomass from 1996 onwards from

Perry et al. (2021), as extended by Kelly Young each year for DFO's

State of the Pacific Ocean Report.
```{r zooplankton}
zooplankton_sog
```

## Zooplankton in the Strait of Georgia

Default plot of anomalies of total biomass:
```{r zooplot}
plot(zooplankton_sog)
```

```{asis, echo = long_talk}
## Zooplankton in the Strait of Georgia
Or plot anomalies for a specific species group:
```
```{r zooplot2, echo = long_talk, eval = long_talk}
plot(zooplankton_sog,
species_group = "cladocera")
```
46 changes: 40 additions & 6 deletions talks/summary.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Please:

- understand the limitations of the data

```{asis, echo = long_talk}
- cite `pacea` and the original sources for any data you use

```{asis, echo = more_details}
## Recommended guidelines for users
To check when you last installed `pacea`
Expand All @@ -52,12 +54,12 @@ Compare that with the updates in the NEWS file (and you can also check dates of
https://github.com/pbs-assess/pacea/commits/main)
```

```{r installedscreenshot, echo=FALSE, out.width="30%", eval = long_talk}
```{r installedscreenshot, echo=FALSE, out.width="30%", eval = more_details}
knitr::include_graphics(paste0(here::here(),
"/talks/talks-manual-figures/github-commits.png"))
```

```{asis, echo = long_talk}
```{asis, echo = more_details}
## Recommended guidelines for users
- any problems, make a minimum working example (usually makes you figure it out yourself)
Expand All @@ -70,24 +72,56 @@ knitr::include_graphics(paste0(here::here(),
a new `Issue` (allows others to see, and maybe answer, your question)
```

## Recommended guidelines for users
## Current uses of pacea (that we know about)

- cite `pacea` and the original sources for any data you use
- Spiny Dogfish: understanding declines over the past 20 years

- shrimp: impact of including environmental variables on predicting distributions

- humpback whales and porpoises: environmental covariates in species distribution models

- Pacific Saury assessment: finding links between two basin-scale indices and process errors, directly supporting Canada's North Pacific Fisheries
Commission commitments

## Lessons learned (applicable to other regions)

- is possible to amaglamate different ecosystem information into one place

- let us know of any applications (so we understand the uptake and how much
- not an off-the-side-of-your-desk project

- is being used by DFO scientists (and others)

- infrastructure of the package could be utilised in other regions if
interested

(e.g. my monthly download of OISST data is for all Canadian waters, the data processing,
storing and plotting functions could be adopted)

## Summary

<!-- - let us know of any applications (so we understand the uptake and how much
effort to devote to maintaining it)
- you could be out on a survey and wondering how warm the water is
compared to previous years
- Chris Rooper: looking at Pacific Saury process errors from a stock assessment
using the indices (PDO etc.). ``It made my life easier today."
-->
- https://github.com/pbs-assess/pacea

- installation:
\textcolor{red}{\texttt{remotes::install\_github("pbs-assess/pacea")}}

\

\begin{center}
\includegraphics[width = 1cm]{"../man/figures/logo.png"}\\
\emph{We wrangle the data so you don't have to}
\end{center}

\

```{r citation, eval=FALSE}
citation("pacea")
Expand Down
Binary file added talks/talks-manual-figures/gslmap.plain-1.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.

0 comments on commit 2e36bda

Please sign in to comment.