check_spawning_period: Check consistency of maturity stages with respect to the...

View source: R/check_spawning_period.r

check_spawning_periodR Documentation

Check consistency of maturity stages with respect to the spawning period

Description

This function checks whether maturity stages reported in TC (or TE) are consistent with the reproductive period of each species. It detects three situations:

  • Immature individuals caught during the spawning period but with lengths above the bibliographic threshold (maximum L50 plus 20%).

  • Mature individuals caught outside the spawning period.

  • Mature individuals caught outside the spawning period and with lengths smaller than the smallest mature individual reported in the literature.

The check uses bibliographic information from the Maturity_parameters table, including L50 values and spawning months.

Usage

check_spawning_period(ResultDataTA, ResultDataTC, year,
Maturity_parameters, DataTargetSpecies, wd, suffix)

Arguments

ResultDataTA

Haul data table (TA) according to MEDITS protocol.

ResultDataTC

Biological data table (TC) or alternatively the individual data table (TE), according to MEDITS protocol.

year

Reference year for the analysis.

Maturity_parameters

Table containing bibliographic information on L50, reproductive season, and smallest mature size for species and sexes.

DataTargetSpecies

Reference table for target species, including faunistic categories and other relevant data.

wd

Working directory selected by the user, where logfiles and CSV outputs will be saved.

suffix

Suffix string to append to output filenames, useful to distinguish between multiple runs.

Details

The function reads information from Maturity_parameters to identify the reproductive period (spawning season) of each species and sex. It then compares each record in TC or TE with these periods:

  • Immature individuals (maturity codes 0, 1, 2A) are flagged if they are captured during the spawning period and have lengths exceeding the bibliographic threshold (maximum L50 + 20%).

  • Mature individuals are checked to verify whether they were caught outside the defined spawning period.

  • Among mature individuals outside the spawning period, those with lengths smaller than the smallest mature specimen reported in literature are additionally flagged.

Warnings are written both to a .dat logfile and to a CSV file for easier downstream analysis. The CSV output includes details on GSA, year, haul number, species, sex, length class, spawning period months, month of capture, and type of warning.

Value

The function always returns TRUE, as it is designed to produce warnings rather than halt execution of further routines in the RoME package.

Author(s)

W. Zupa, I. Bitetto

References

Anonymous. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp. https://www.sibm.it/MEDITS%202011/principaledownload.htm

Examples

wd <- tempdir()
suffix <- "2020-03-05_time_h17m44s55"
year <- 2007
TA <- RoME::TA
TC <- RoME::TC
check_spawning_period(
  ResultDataTA = TA,
  ResultDataTC = TC,
  year = year,
  Maturity_parameters = RoME::Maturity_parameters,
  DataTargetSpecies = RoME::DataTargetSpecies,
  wd = wd,
  suffix = suffix
)

RoME documentation built on April 24, 2026, 1:07 a.m.