July 7, 2023
This is a draft example of how we might centralize the population indicator compilation across regions. Steph initiated this as a trial for discussion among the population group (Eric, Bruno, Steph). The idea would be to mirror the headings in the tech-report.
Working directory setup:
Many of the files used as input are saved in the PSF Dropbox. In order to set up the working directories properly, each use must:
-
Create a text file named
wd_X_Drive1_PROJECTS.txtin your localpopulation-indicatorgithub folder (along with the R project file). -
Paste in the file the your personal path from the C drive to the PSF dropbox
1_PROJECTSfolder on dropbox (e.g. C:/Users/YOUR OWN PATH/X Drive/1_PROJECTS). For Microsoft Windows OS, replace the\by/. Do not forget to processReturnat the end of the line.
Contains (or will contain...) code to
- fit HBM spawner-recruit model
- estimate spawner-recruit benchmarks
- estimate percentile benchmarks
- spit out datasets 101 and 102 (biological status outcomes)
Contains code to compile dataset 1-part2 (spawner surveys) including
- importing most recent NuSEDS data from Open Data Canada
- applying 'hard-coded' fixes where we know there are errors
- making changes to reflect additional knowledge where available (e.g., removing low-quality stream, unreliable data as recommended for SBC Chinook)
Update QA/QC code runs the following checks:
- Looks in
-status/Outputfolder for dataset1_part2 files and extracts date (SP: Think of updating this to be thespawner-surveys/outputfolder?) - Sources most recent data (
newData) and next-most-recent data (oldData) - Checks that headers are the same between the datasets
- Checks if the same stream names are represented in both datasets and flags either missing or added streams
- Checks if the same
streamids are represented in both datasets and flags either missing or addedstreamids - Performs a full join of new and old data and then flags any
streamids that have multiple rows for a single year. This would occur if any of the fields for a givenstreamiddidn't match:NuSEDS.counts.by.streamfor a givenyear(could be due to a correction in NuSEDS or some other error in how data are assigned tostreamid),CUID(can happen if a stream is re-assigned to a new CU), orstreamname. This could also occur if there were multiple methods in a year in which case this is not an error, per se.
Note: You will get the error no lines available in input if Dropbox hasn't synced the data files. Suggest choosing "Make available offline" for the xxx-status folders to avoid this.
Compiles CU-level spawner abundance reconstructions, and/or runs those reconstructions using spawner surveys and expansion factors (would like to do this ourselves eventually?).
Also contains update-QAQC.R code that runs equivalent checks to those for the spawner surveys.
Could include the run timing data but also spawn timing analysis of NuSEDS data or other timing data analysis?
Calculates CU-level data quality scores based on data quality of spawner surveys and other datasets within each CU.
Calculates the CU-level spawner abundance anomalies shown in the regional Overviews pages.
Calculates short-term (three generation) and long-term (all years) linear trends in log spawner abundance that are shown in the trends indicator.
spawner-abundance (dataset 1) --> trends (datasets 102, 102 and 391) --> overviews (dataset 558)
Something acknowledging data contributors, PSAC, regional TWGs that contributed to methods and data...
See the tech-report that documents the methods to compile indicators that are shown here. Stephanie Peacock speacock@psf.ca