Skip to contents

Estimates spatial Catch Per Unit Effort (CPUE) by combining:

  • Matched trips (trips-matched parquet, from merge_survey_trips()): validated catch records already linked to PDS trip IDs (all countries).

  • Predicted track files (from predict_pds_tracks()): downloaded only for matched trips, to build the per-trip H3 effort matrix for the CPUE model.

Usage

model_cpue(
  h3_res = 9L,
  top_n = 5L,
  min_trips = 3L,
  method = c("weighted", "nnls"),
  max_gap_hours = 0.25,
  gap_policy = c("cap", "drop"),
  log_threshold = logger::DEBUG,
  package = "coasts"
)

Arguments

h3_res

Integer (0-15). H3 resolution for spatial aggregation. Default is 9L (~174 m edge). Use 5-6 for very sparse data.

top_n

Integer. Number of top species (by total catch) to model. Default is 5L.

min_trips

Integer. Minimum unique trips per H3 cell x country required to retain a cell in the CPUE output. Default is 3L.

method

Character. CPUE estimation method: "weighted" (default) or "nnls". See Details.

max_gap_hours, gap_policy

How silent stretches of a track are counted when building the effort denominator, passed to prepare_tracks_for_effort(). Pass the same values used for aggregate_pds_effort(): CPUE is catch per hour of effort, so measuring hours differently from the H3 grid would publish two incompatible views of the same fishing.

log_threshold

The logging threshold to use. Default is logger::DEBUG.

package

Name of the package whose inst/conf.yml to read. Defaults to "coasts".

Value

Invisibly returns a named list:

effort_matched

Per-trip H3 effort for matched trips.

cpue

CPUE table (tibble with h3_index, country, cpue, species, n_trips, lon, lat).

trips

Combined effort + catch matrix.

Details

Two CPUE estimation methods are available:

  • "weighted" (default, recommended for sparse data): direct catch-to-effort ratio per H3 cell and country. Robust when trips are few. CPUE_h = sum(catch_kg) / sum(fishing_hours) across all trips visiting cell h within each country.

  • "nnls" (for denser data, >= ~200 trips): solves min ||Xq - y||^2 s.t. q >= 0 across all cells simultaneously. More statistically rigorous but requires an overdetermined system (rule of thumb: trips >> H3 cells).

The CPUE result table includes a country column so users can filter by country downstream. It is uploaded as a versioned Parquet file to the cloud bucket under the pds_cpue file prefix.