Skip to content

feature(#30): Add detailed catch output per species per box per fishery#32

Open
jacobkasper wants to merge 2 commits into
devfrom
add-detailed-catch
Open

feature(#30): Add detailed catch output per species per box per fishery#32
jacobkasper wants to merge 2 commits into
devfrom
add-detailed-catch

Conversation

@jacobkasper
Copy link
Copy Markdown
Collaborator

@jacobkasper jacobkasper commented Apr 10, 2026

closes #30

Summary

Adds a new optional output file OutDetailedCatch.txt that reports annual catch by species, box, and fishery. This fills a gap in the existing outputs — OutCatch.txt reports total catch per species (no fishery or box dimensions), OutCatchPerFishery.txt reports catch per fishery per species (no box dimension), and the Out.nc file contains no catch variables. The new file provides the full species × box × fishery breakdown needed for spatial fisheries analysis such as MPA impact evaluation.

New parameter

flagdetailedcatch — added to Run.prm (read via XML pipeline)

  • 0 = off (default), no file created
  • 1 = on, OutDetailedCatch.txt is written annually

Output file format

Time Box Fishery FCD FHA FSA FRF FGH ...
3.650000e+02 0 long 0.000000e+00 0.000000e+00 ...
3.650000e+02 1 long 0.000000e+00 0.000000e+00 ...
  • One row per box per fishery per year
  • Columns are fished species only (isFished == TRUE)
  • Catch values in tonnes (converted from mg N using X_CN * mg_2_tonne)
  • Written annually, before CumCatch is reset
  • Catch is summed over water column layers per box

Files changed

File Changes
atlantisboxmodel.h Added int flagdetailedcatch field
atparamIO.c Read flagdetailedcatch from XML config
atRunXML.c Create XML node with default value 0
atHarvestIO.c Added initDetailedCatchFile(), writeDetailedCatch(), file pointer, forward declarations; added calls in Open_Harvest_Output_Files, Close_Harvest_Output_Files, Harvest_Report_Annual_Stats

Usage

Add to Run.prm:

flagdetailedcatch    1    0=off, 1=detailed catch per species per box per fishery

Validation

Compared OutDetailedCatch.txt (summed across all boxes and fisheries) against OutCatch.txt for FCD. The ratio is consistently ~0.9985 across all years. The small ~0.15% discrepancy is due to OutCatch.txt using a separately accumulated TotCumCatch variable while OutDetailedCatch.txt sums CumCatch[sp][nf][box][layer] directly. Minor floating-point accumulation differences across thousands of timesteps account for the gap.


Notes

  • File can be large: (number of boxes × number of fisheries × number of years) rows
  • Only species with isFished = 1 in the groups CSV are included
  • The file is written at the same time as other annual harvest outputs, just before CumCatch is reset

@jacobkasper jacobkasper changed the base branch from main to dev April 14, 2026 14:36
@jacobkasper jacobkasper requested a review from eafulton April 14, 2026 14:38
@jacobkasper jacobkasper marked this pull request as draft April 14, 2026 14:40
@andybeet andybeet changed the title Add detailed catch output per species per box per fishery feature(#30): Add detailed catch output per species per box per fishery Apr 16, 2026
@jacobkasper jacobkasper marked this pull request as ready for review April 27, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no detailed catch output

1 participant