-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
632 lines (489 loc) · 26 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
---
output: github_document
---
<!--
README.md is generated from README.Rmd. Please edit that file. Build with
-->
```{r, include = FALSE, eval = FALSE}
load_all()
rmarkdown::render("README.Rmd")
```
<!--
which builds the .html that can be viewed locally (but isn't pushed to GitHub;
GitHub uses README.md to make the page you see on GitHub).
Figures - to update a figure, manually run the piece of code that makes
the .png file. See notes below (and Issue #44). Make the png resolutions the same in
each direction, at least for multi-panel plots, as seemed a bit blurry when I
hadn't (primary production and hotssea at least).
-->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "60%"
)
library(tibble)
```
# pacea <img src="man/figures/logo.png" align="right" height="138" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/pbs-assess/pacea/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pbs-assess/pacea/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/pbs-assess/pacea/graph/badge.svg?token=93afkFJUVL)](https://codecov.io/gh/pbs-assess/pacea)
[![DOI](https://zenodo.org/badge/417554147.svg)](https://zenodo.org/doi/10.5281/zenodo.13840804)
![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fpbs-assess%2Fpacea&label=VISITORS&countColor=%23263759&style=flat&labelStyle=lower)
<!-- badges: end -->
An R package of Pacific ecosystem information to help facilitate an ecosystem
approach to fisheries management.
*We wrangle the data so you don't have to*
pacea stands for PACific Ecosystem Approach, and is pronounced 'pac-ee-a', with pac as in Pacific.
pacea is a R package containing a variety of data
sets and model output. We wrangle the data sets behind the scenes to get them into usable formats
in R, and provide helpful plotting functions. All data sets include
documentation regarding the original sources and authors, who should be cited
and consulted as appropriate.
Please continue reading through this README file, and especially see the vignettes
section get started.
## What is in pacea?
Currently, pacea contains:
- `r format(nrow(buoy_sst), big.mark = ",")` calculations of daily sea surface
temperature based on data from `r nrow(buoy_metadata)` buoys. **Updated monthly.**
- outputs from the spatial British Columbia continental margin (BCCM) model, the coupled
physical-biogeochemical model by Peña et al. (2019). Variables are available
for (a) 40,580 spatial cells across Canada's Pacific
Exclusive Economic Zone, and **NEW** (b) 161,025 spatial cells across a larger
domain, extending into US waters. Variables are given as 27 years of monthly means (from
1993 to 2019). The variables are:
- dissolved oxygen concentration
- pH
- salinity
- temperature
- depth-integrated phytoplankton
- depth-integrated primary production.
For applicable variables these are given for
- sea surface
- 0-40 m integration
- 40-100 m integration
- 100 m to the sea bottom
- sea bottom.
- NOAA's spatial Optimum Interpolation Sea Surface Temperature (OISST) record, that incorporates observations from different platforms (satellites,
ships, buoys, and Argo floats):
- provided as weekly and monthly means from `r paste(lubridate::month(min(oisst_month$start_date), label = TRUE),
lubridate::year(min(oisst_month$start_date)))` to `r paste(lubridate::month(max(oisst_month$start_date), label = TRUE),
lubridate::year(max(oisst_month$start_date)))`. **Updated monthly.**
- outputs from the Hindcast of the Salish Sea (HOTSSea) physical oceanography model that
recreates conditions throughout the Salish Sea from 1980 to 2018 [(Oldford et
al., in review)](https://doi.org/10.5194/gmd-2024-58). Statistics regarding
temperature and salinity are available at the same 2 km x 2 km spatial
resolution as the full BCCM results. Specifically, values of minimum, mean, maximum, and
standard deviation (over each month) are available for:
- sea surface
- 0-30 m integration
- 30-150 m integration
- 150 m to the sea bottom
- sea bottom.
- 10 climatic and oceanographic indices, such as the Pacific Decadal Oscillation
and those related to El Niño. **Updated monthly, new one added.**
- estimates of abundances for Harbour Seals.
- estimates of biomass and annual recruitments for Pacific Hake
and Pacific Herring. **Updated annually.**
- zooplankton biomass anomalies in the Strait of Georgia, for 25
species groups, from 1996 onwards. **Updated annually.**
Plotting and helper functions are provided, and demonstrated in the detailed vignettes. All
data and model outputs are fully documented and referenced.
## What's new (since the original release)?
The values highlighed above with **Updated monthly** have been updated each
month since the release of pacea, as documented in the [NEWS](NEWS.md), which it
is advisable to check when you update your pacea installation (see below). Since the initial release we have
also added the following in response to user requests (some are documented in
the Issues) with latest first:
- for Pacific Hake, added estimates of total biomass of age-1 fish and
recruitment deviations (required updating some plotting and tickmark functions
which should all
still be back compatible); see the
[populations.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/populations.html)
vignette.
- added Mike Malick's oceanographic index: `bi`, the North Pacific Current
Bifurcation Index; see the [indices
vignette](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/indices.html)
and `?bi`.
- added results from the Hindcast of the Salish Sea (HOTSSea) physical oceanography model that
recreates conditions throughout the Salish Sea from 1980 to 2018. See the new [hotssea vignette](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/hotssea.html).
- added results from the BCCM model over its full original domain (rather than
just restricted to Canada's Exclusive Economic Zone), see the new [bccm_full vignette](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/bccm_full.html).
- added depths for the `grid26` model domain, see `?grid26_depth`.
- updated citation information (incremented the year, added a DOI through Zenodo, and added two new co-authors:
Kelsey Flynn and Greig Oldford), see `citation("pacea") or scroll down below.
- added Pacific Herring stock assessment results, for spawning stock biomass and
age-2 recruitment for each of the five major stock assessment regions; see the
[populations.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/populations.html)
vignette.
- added helper function `a()`, shorthand for `as.data.frame()`, see examples in
`?a`.
- extended calculations of the Aleutian Low Pressure Index (ALPI) up to 2022;
they were originally only available to 2015. The Aleutian Low was mentioned in
several talks at the 2024 State of the Pacific Ocean meeting, motivating us to
update the values here.
- added zooplankton biomass anomalies for the Strait of Georgia, with a new
vignette: [zooplankton.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/zooplankton.html).
- updated the estimates of Pacific Hake abundance and recruitment with values
from the 2024 assessment (retaining the original estimates from the 2023
assessments for reproducibility); see the
[populations.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/populations.html)
vignette.
## Brief examples of some questions that can be quickly visualised (see vignettes for full details)
**How does this year's sea surface temperature (red curve) in West Dixon Entrance compare to previous
years, based on the buoy there?**
<!-- Run this png code manually (as not evaluated here) to update the figure -->
```{r northhecatetempmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-north-hecate-temp.png"), # keeping
# filename even though have changed buoy
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(buoy_sst) # stn_id = "C46183")
dev.off()
```
```{r northhecatetemp, eval = FALSE}
plot(buoy_sst) # Buoy C46205 is plotted by default
```
![](man/figures/README-north-hecate-temp.png){width=80%}
**Are we experiencing a phase of El Niño, based on the Oceanic Niño Index? (If the
last bars are red and above 0.5, then 'yes')**
```{r onimakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-oni.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(oni)
dev.off()
```
```{r oni, eval = FALSE}
plot(oni)
```
![](man/figures/README-oni.png){width=80%}
**How has the status of the Pacific Decadal Oscillation changed over time?**
```{r pdomakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-pdo.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(pdo)
dev.off()
```
```{r pdo, eval = FALSE}
plot(pdo)
```
![](man/figures/README-pdo.png){width=80%}
**What were the differences in spatial pattern of sea surface temperature between June 2022 and 2023 (using OISST data)?**
```{r oisstmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-oisst.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(oisst_month,
months.plot = "June",
years.plot = c(2022, 2023))
dev.off()
```
```{r oisst, eval = FALSE}
plot(oisst_month,
months.plot = "June",
years.plot = c(2022, 2023))
```
![](man/figures/README-oisst.png){width=80%}
**How did the upper 40m of dissolved oxygen differ between January and June, in 2015 (using BCCM results restricted to Canada's Exclusive Economic Zone)?**
```{r bccmmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-bccm.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(bccm_avg0to40m_oxygen(force = TRUE),
months.plot = c(1, 6),
years.plot = 2015)
dev.off()
```
```{r bccm, eval = FALSE}
plot(bccm_avg0to40m_oxygen(force = TRUE),
months.plot = c(1, 6),
years.plot = 2015)
```
![](man/figures/README-bccm.png){width=80%}
**How did depth-integrated primary production vary spatially and with each month throughout 2018, using the BCCM results for its full spatial domain?**
```{r bccmfullmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-bccm_full.png"),
width = 960, # 670 matches size from running from a chunk
height = 960)
plot(bccm_primaryproduction_full(),
months = 1:12)
dev.off()
```
```{r bccmfull, eval = FALSE}
plot(bccm_primaryproduction_full(),
months = 1:12)
```
![](man/figures/README-bccm_full.png){width=100%}
**How did estimated maximum (over each month) depth-integrated temperature over the top 30 m change in the Salish Sea for January and September in three different years?**
```{r hotsseamakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-hotssea.png"),
width = 960, # 670 matches size from running from a chunk
height = 960)
plot(hotssea_avg0to30m_temperature_max(),
months = c("January", "September"),
years = c(1995, 2010, 2018),
eez = FALSE)
dev.off()
```
```{r hotssea, eval = FALSE}
plot(hotssea_avg0to30m_temperature_max(),
months = c("January", "September"),
years = c(1995, 2010, 2018),
eez = FALSE)
```
![](man/figures/README-hotssea.png){width=100%}
**How has estimated Pacific Herring recruitment changed over time in each of the five major assessment regions?**
```{r herringmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-herring.png"),
width = 670, # 670 matches size from running from a chunk
height = 960)
plot(herring_recruitment)
dev.off()
```
```{r herringplot, eval = FALSE}
plot(herring_recruitment)
```
![](man/figures/README-herring.png){width=80%}
**How has estimated Pacific Hake spawning biomass (from California to BC) changed through time?**
```{r hakemakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-hake.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(hake_biomass)
dev.off()
```
```{r hakeplot, eval = FALSE}
plot(hake_biomass)
```
![](man/figures/README-hake.png){width=80%}
**What is the estimated abundance of Pacific Harbour Seals for each of seven regions?**
```{r harboursealsmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-harbour-seals.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(harbour_seals)
dev.off()
```
```{r sealplot, eval = FALSE}
plot(harbour_seals)
```
![](man/figures/README-harbour-seals.png){width=80%}
**How has zooplankton biomass in the Strait of Georgia changed since 1996?**
```{r zooplanktonmakefig, eval = FALSE, echo = FALSE}
png(paste0(here::here(), "/man/figures/README-zooplankton.png"),
width = 670, # 670 matches size from running from a chunk
height = 480)
plot(zooplankton_sog)
dev.off()
```
```{r zooplanktonplot, eval = FALSE}
plot(zooplankton_sog)
```
![](man/figures/README-zooplankton.png){width=80%}
You can view and analyse all these data sets in the usual way in R. For example:
```{r onivalues}
oni
```
**What climatic and oceanographic indices are currently available, and over what
years?**
```{r indicestable}
knitr::kable(pacea_indices)
```
## Vignettes
For more detailed explanations of the data sets and functionality see the
vignettes, which are already rendered here (note that we do not automatically
update them when the data in pacea are updated, so if you run them locally you
may get more up-to-date values):
* [indices.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/indices.html)
Climatic and oceanographic indices and associated plotting functions.
* [buoys.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/buoys.html)
Calculated daily mean sea surface temperatures and associated plotting functions.
* [populations.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/populations.html)
Estimates of animal populations and associated plotting functions.
* [oisst.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/oisst.html)
OISST data and calculations and associated plotting functions.
* [bccm.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/bccm.html)
BCCM model results restricted to Canada's Exclusive Economic Zone, calculations, and associated plotting functions.
* [bccm_full.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/bccm_full.html)
BCCM model results over the full model domain, calculations, and associated plotting functions.
* [hotssea.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/hotssea.html)
HOTSSea model results and associated plotting functions.
* [zooplankton.html](http://htmlpreview.github.io/?https://github.com/pbs-assess/pacea/blob/main/vignettes/zooplankton.html)
Zooplankton anomalies for the Strait of Georgia, calculations, and associated plotting functions.
The presentations where we introduced `pacea` are available as .pdf. [Here is the DFO
version (10th November 2023)](talks/pacea-release-talk-dfo.pdf) and
[here is the UVic Ecostats version (21st November
2023)](talks/pacea-release-talk-uvic.pdf). The code to build them is [here as
.Rmd](talks/pacea-release-talk.Rmd).
## Installation
Okay, if you're convinced this package might be useful for you, then to install
the latest version just:
```
install.packages("remotes") # If you do not already have the "remotes" package
remotes::install_github("pbs-assess/pacea")
```
If you get an error like
```
Error in utils::download.file(....)
```
then the connection may be timing out (happens to us on the DFO network). Try
```
options(timeout = 1200)
```
and then try and install again. If you get a different error then post an Issue
or contact <a href="mailto:[email protected]">Andy</a> or <a href="mailto:[email protected]">Travis</a> for help.
## Updates
We plan to continually enhance `pacea` by updating current data sets and adding
new ones, as well as adding functionality. To explain these, we will document them
by date in the [NEWS](NEWS.md).
We plan to update the indices, buoy temperatures, and OISST values on the 20th of every month (or soon
after), which should capture updates to those data.
To check what date you installed `pacea` locally
on your machine, we have the helper command:
```{r installed, eval=FALSE}
pacea_installed()
You last locally installed pacea on 2023-11-01 which is 8 days ago.
Compare that with the updates in the NEWS file (and you can also check dates of the latest commits at
https://github.com/pbs-assess/pacea/commits/main)
```
The commits tell you when we last changed something, while the [NEWS](NEWS.md)
will give a more concise summary of changes by date. Then you may wish to update
`pacea` by running `remotes::install_github("pbs-assess/pacea")` again.
## Audience and motivation
The primary audience is stock assessment scientists who want to analyse
environmental variables in the context of their stock assessment (but we
anticipate other interested users). The Fisheries Act requires management of fisheries to take into account "[the biology of the fish and the environmental conditions affecting the stock](https://laws-lois.justice.gc.ca/eng/acts/f-14/page-3.html#h-1175547)". Such an Ecosystem Approach to Fisheries Management requires data.
A comprehensive [2022 analysis of Canadian stock assessments](https://publications.gc.ca/collections/collection_2022/mpo-dfo/Fs97-6-3473-eng.pdf) found that availability of data on environmental variables was the leading cause of not integrating such information into assessments. pacea aims to help make data availability more streamlined, and avoid each individual assessment scientist having to figure out themselves where to get appropriate data.
This work is strongly motivated by, and based on, the [GSLea](https://github.com/duplisea/gslea) R package by Dan Duplisea and colleagues for the Gulf of St Lawrence.
## Citation
If you use `pacea` in your work then please cite it as (NOTE this has been
updated since the original release):
Edwards A.M., Tai T.C., Watson J., Peña M.A., Hilborn A., Hannah C.G., Rooper
C.N., Flynn K.L., and Oldford, G.L. (2024). pacea: An R package of Pacific ecosystem information to
help facilitate an ecosystem approach to fisheries management.
<https://github.com/pbs-assess/pacea>, <https://zenodo.org/doi/10.5281/zenodo.13840804>
You may wish to add the date you installed it (using `pacea_installed()`). Use
`citation("pacea")` to get a version for LaTeX and R Markdown
bibliographies. Although the DOI badge at the top of this page ends in ...805,
the ...804 DOI is preferable because that will not change with any future
updates to the GitHub tag. So ...804 seems simpler and more consistent to use (thanks!).
Also let us know of any applications. This will help us devote effort into
maintaining `pacea`.
## Acknowledgments
This work is funded by a Competitive Science Research Fund grant from Fisheries
and Oceans Canada (project 21-FS-03-13).
We thank the following for contributing ideas, example code for ROMS output, model output,
and/or helping with ideas and coding issues:
- Jessica Nephin, Lindsay Davidson, Strahan Tucker,
Brianna Wright, Patrick Thompson, Matt Grinnell, Sean Anderson, Philina
English, Chris Grandin, Jennifer Boldt, Kelly Young, and others.
And a big thanks to Carley Colclough for expertly designing the pacea logo.
## Notes for developers
1. Please work on your own development branch to ensure that the main branch is
never broken (so users can always download the package). See below for details
on branching.
1. Edit and render the README.Rmd file, not the README.Md file. If you add any new
figures then commit and push them (they will be in
man/figures/README-<chunk-name>) so they show up on the GitHub README. Always
render the .Rmd so that it and the rendered .Md stay in sync (see
https://github.com/pbs-assess/pacea/issues/44#issuecomment-1793235838 for how to
have Git check that README.Md is newer than README.Rmd).
1. Every data set is built using code in the `raw-data/` directory, with
documentation in `R/data.R`. Document everything!
1. If you add new functions please add tests as well so we retain good code
coverage (as indicated in the badge at the top of the README on GitHub).
1. Use the standard `lower_case_and_underscores` for naming
variables and functions.
1. Citation information is in inst/CITATION, so if you update DESCRIPTION file
(e.g. add an author) then update that also and update the citation info above.
1. Logo included by running `use_logo("inst/pacea-logo-from-carley.png")`. The .png was
expertly designed by Carley Colclough. There is also `inst/pacea-logo-for-printing.jpg`
for printing purposes.
### Branching in Git
To ensure the main branch is never broken (and so users can always download the
package), when editing package code please work on your own branch and then
merge it in. If just updating the README then we can stick with the main branch
(because messing something up should not void the package being installable).
Your own branch should be called `dev-yourname`, e.g. `dev-andy` and
`dev-travis`. If you don't yet have a branch you need to:
- create it locally (and 'check it out', i.e. move into it): `git checkout -b dev-yourname`
- tell Git where to push to: `git push --set-upstream origin dev-yourname`
(Git will tell you this command if you do a `git push` without having run it)
- update GitHub Actions so that pushes of your branch get properly tested on
GitHub. Just add your branch to **both** lists of branches at the top of:
- `.github/workflows/R-CMD-check.yaml`
- `.github/workflows/test-coverage.yaml`
- Do that as your first commit and push to check everything's working.
Once you have your branch set up then the workflow is:
1. Make sure you are all caught up on the main branch:
- `git checkout main`
- `git fetch`
- `git rebase`
2. Switch to your development branch and merge the main branch into it
- `git checkout dev-yourname`
- `git merge main`
- for magit users (probably just Andy), this is just `b b` and `m m` (it
recommends arguments)
3. Do some new commits in your branch and push them in the usual way.
GitHub Actions will work on your branch.
So from a quick test, the `R-CMD-check`
badge only refers to the main branch, which is great as it should never show as
failing because we should only be breaking
things on own branch. Always having the green passing badge should inspire
consumer confidence. On
GitHub you can select your branch and see the tickmark, which will tell you if
the build has failed (or if your changes have caused the code coverage to
decline), and you'll probably get an automatic email also, just to drive home
the message. So the badges on the README on your branch still relate to the
main branch.
You can click on the codecov badge on GitHub, and then on the codecov page you
can select your branch. There are ways to check code coverage locally, but Andy
found these all take a long time (and it's easier to push and let GitHub check
the coverage). See commit 6c872da for the commands Andy tried (now deleting to
keep this README file cleaner).
4. When you are happy with your changes and ready to merge them into the main
branch, you need to
- add any changes that users should be aware of to the [NEWS](NEWS.Md) file.
No need to mention things that are only of interest to
developers (like the commiting of these instructions). We want the NEWS to be
succinct and quickly readable so that people look at it.
Then you need to double check that the main branch is up-to-date with the
version on GitHub (someone may have pushed some changes since you last fetched),
then merge any changes back into your branch. You could just check on GitHub (if
you're the last person to have pushed to main then you are probably fine), or do
these:
- `git checkout main`
- `git fetch`
- `git rebase`
- `git checkout dev-yourname`
- `git merge main`
If that does merge in some new commits then you should
- `git push`
to run the GitHub Actions checks again on GitHub. If the merge says something
like you are all caught up, no merging is needed (i.e. no-one committed anything to
the main branch recenetly), then no need for the `git push`, since this entire
step will not have added any new code.
5. Now you are ready to merge your changes into the main branch, so that people
will get them when they install/update `pacea`:
- `git checkout main`
- `git merge dev-yourname`
- `git push`
And you are done!
If you want, we have some aliases (such as `git co` for `git checkout` and
`git p` for `git push` listed in this example .gitconfig file:
https://raw.githubusercontent.com/quantitative-biology/module-1-git/main/misc/.gitconfig
from our e-book
https://www.quantitative-biology.ca/git-and-github.html#save-our-template-.gitconfig-file
You can put those into your `.gitconfig` file if you like.
This can help understanding on branches: https://www.atlassian.com/git/tutorials/using-branches/git-merge
Oldford, G.L., Jarníková, T., Christensen, V., and Dunphy, M. (in review).
HOTSSea v1: a NEMO-based physical Hindcast of the Salish Sea (1980–2018)
supporting ecosystem model
development. Preprint. https://doi.org/10.5194/gmd-2024-58 .
Peña, M.A., Fine, I. and Callendar, W. (2019). Interannual variability in
primary production and shelf-offshore transport of nutrients along the northeast
Pacific Ocean margin. Deep-Sea Research II, doi:10.1016/j.dsr2.2019.104637.
https://www.sciencedirect.com/science/article/pii/S0967064519300220