Skip to content

grinnellm/SpawnIndex

Repository files navigation

SpawnIndex

Calculating the spawn index for Pacific Herring (Clupea pallasii) in British Columbia, Canada.

R-CMD-check Codecov lint Lifecycle Version CRAN

Note that R-CMD-check succeeds on my Windows machine but fails on GitHub Actions (see issue #30).

Description

The SpawnIndex package provides data, parameters, and methods to calculate the spawn index for Pacific Herring (Clupea pallasii) in British Columbia, Canada. Spawn index calculations convert spawn survey observations (e.g., spatial extent, number of egg layers, substrate type) to the Pacific Herring spawn index, a relative index of spawning biomass. There are three types of spawn survey observations: surface observations, Macrocystis observations, and understory observations. In addition, the package includes methods to convert eggs to biomass and estimate spawning biomass in spawn-on-kelp operations.

Installation

Install the SpawnIndex package from GitHub with:

# install.packages("remotes")
remotes::install_github(repo = "grinnellm/SpawnIndex")

Examples

We show two example calculations: surface spawn index, and spawn-on-kelp biomass.

Surface spawn index

This example shows how to calculate the spawn index for a surface spawn survey. First, load the SpawnIndex package in the usual way.

library(SpawnIndex)
## This is SpawnIndex version 0.4.0.

Next, load the default parameter values for spawn index calculations, and calculate the conversion factor for the number of Pacific Herring eggs to the spawn index (i.e., biomass in tonnes, t). Call the function with the default parameters.

data(pars)
theta <- eggs_to_sb()
theta
## [1] 1e+08

Thus, convert eggs to the spawn index in tonnes by dividing the number of eggs by theta, where theta is in units of 108 ⋅ eggs ⋅ t−1. Then, calculate egg density for a given number of egg layers.

layers <- 4
egg_density <- dens_surf(egg_layers = layers)
egg_density
## [1] 863.57

In this example, spawn surveyors observed 4 layers of Pacific Herring eggs, which has an estimated egg density of 863.57, where egg density is in units of 103 ⋅ eggs ⋅ m−2. Next, determine the total number of eggs in a given area.

length <- 100
width <- 10
eggs <- egg_density * length * width
eggs
## [1] 863570

An area measuring 100 m in length and 10 m in width, covered with 4 layers of eggs, has an estimated 863,570 103 eggs. Like egg density above, number of eggs is in 103 eggs. Finally, calculate the spawn index for the spawn.

index <- eggs * 1000 / theta
index
## [1] 8.6357

The estimated spawn index for this surface spawn survey is 8.64 t.

Spawn-on-kelp biomass

This example shows how to calculate the biomass of Pacific Herring that spawned and produced eggs which were removed from the population by a spawn-on-kelp (SOK) fishery. Use theta from above to estimate the biomass of Pacific Herring that produced a given amount of SOK product in kilograms, kg.

sok <- 100
biomass <- calc_sok_index(sok = sok, theta = theta)
biomass
## [1] 0.3266324

In this example, 100 kg of SOK was produced by 0.327 t of spawning Pacific Herring.

Additional information

The technical report has background information on the spawn index and calculations. Build the manual

devtools::build_manual(pkg = ".", path = here("doc"))

and open the file ./doc/SpawnIndex_0.4.0.pdf. In addition, there is a vignette with an example workflow; build the vignette

devtools::build_vignettes(pkg = ".")

and open the file ./doc/Introduction.html.

Contributing

If you would like to contribute to this project, please start by reading the guide to contributing. This applies to bug reports, documentation, feature requests, mistakes, and other issues. Note that this project is released with a contributor code of conduct. By participating in this project you agree to abide by its terms.

About

🐟 🥚 Calculate the Pacific Herring spawn index

Resources

License

Stars

Watchers

Forks

Languages