Fill year-season-fishery slices in an age-frequency array when positive catch exists but the sliced age-frequency vector is empty. Replacement age frequencies are weighted averages of nearby non-empty donor years from the same season and fishery, normalised to sum to one.
Usage
repair_af_slices_weighted(
catch_ysf,
af_ysfa,
N = 3L,
p = 1L,
eps = 1e-12,
expand_if_empty = TRUE,
verbose = TRUE
)Arguments
- catch_ysf
A 3D numeric array of observed catch by year, season, and fishery. Dimension order can differ if dimnames identify
Year,Season, andFishery; otherwise the function infers dimensions from their sizes.- af_ysfa
A 4D numeric array of sliced age frequencies by year, season, fishery, and age.
- N
Integer search window, in years on either side of the empty slice, used to find donor years.
- p
Numeric distance exponent for inverse-distance donor weighting.
p = 1gives weights proportional to1 / distance.- eps
Numeric tolerance below which a catch or age-frequency sum is treated as zero.
- expand_if_empty
Logical; if no donors are found inside the
Nyear window, search all non-empty years from the same season and fishery.- verbose
Logical; print a message with the number of repaired slices.
