Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion atlantis/ConvertAtlantis/atRunXML.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void Convert_Run_To_XML(MSEBoxModel *bm, char *fileName, char *outputFileName) {
Util_XML_Create_Lookup_Value_Node(lookupNode, "24", "Debug Mortality Scalar Code");

Util_XML_Parse_Create_Node(fp, fileName, groupingNode, "debug_it", "", "", XML_TYPE_BOOLEAN,"0");

Util_XML_Parse_Create_Node(fp, fileName, groupingNode, "flagdetailedcatch", "", "", XML_TYPE_BOOLEAN, "0");

groupingNode = Util_XML_Create_Node(ATLANTIS_ATTRIBUTE_SUB_GROUP, rootnode, "GroupOptions", "Parameters defining the numbers of certain types of groups.", "", "");
Util_XML_Parse_Create_Node(fp, fileName, groupingNode, "K_num_tot_sp", "Total number of groups in the model", "", XML_TYPE_INTEGER, "0");
Expand Down
80 changes: 78 additions & 2 deletions atlantis/atharvest/atHarvestIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ FILE *anndpffp;
FILE *anndiscardfp;
FILE *anneffortfp;
FILE *displaceEffortfp;
FILE *detailedCatchfp;

static void writeAnnCatch(FILE *fid, FILE *fid2, FILE *fid3, MSEBoxModel *bm, FILE *llogfp);
static void writeAnnCatchPerFishery(FILE *fid, MSEBoxModel *bm, FILE *llogfp);
static void writeAnnDiscardPerFishery(FILE *fid, MSEBoxModel *bm, FILE *llogfp);
static void writeAnnEffort(FILE *fid, MSEBoxModel *bm, FILE *llogfp);
static void writeDisplaceEffort(FILE *fid, MSEBoxModel *bm, FILE *llogfp);
static void writeDetailedCatch(FILE *fid, MSEBoxModel *bm, FILE *llogfp);

static FILE * initAnnCatchFile(MSEBoxModel *bm);
static FILE * initAnnCatchPerFisheryFile(MSEBoxModel *bm);
Expand All @@ -58,6 +60,7 @@ static FILE * initAnnDiscardFile(MSEBoxModel *bm);
static FILE * initAnnEffortFile(MSEBoxModel *bm);
static FILE * initAnnRecCatchFile(MSEBoxModel *bm);
static FILE * initDisplacedEffortFile(MSEBoxModel *bm);
static FILE * initDetailedCatchFile(MSEBoxModel *bm);

/*******************************************************************************************
Routines to report the aggregate fisheries statistics to date - done on an annual basis,
Expand Down Expand Up @@ -89,6 +92,14 @@ void Harvest_Report_Annual_Stats(MSEBoxModel *bm, FILE *llogfp) {
writeAnnCatchPerFishery(anncpffp, bm, llogfp);
writeAnnDiscardPerFishery(anndpffp, bm, llogfp);
writeAnnEffort(anneffortfp, bm, llogfp);
if (!detailedCatchfp)
detailedCatchfp = initDetailedCatchFile(bm);
if (bm->flagdetailedcatch) {
if (!detailedCatchfp)
detailedCatchfp = initDetailedCatchFile(bm);
if(bm->thisyear)
writeDetailedCatch(detailedCatchfp, bm, llogfp);
}

return;
}
Expand Down Expand Up @@ -116,7 +127,9 @@ void Open_Harvest_Output_Files(MSEBoxModel *bm) {
anncpffp = initAnnCatchPerFisheryFile(bm);
anndpffp = initAnnDiscardPerFisheryFile(bm);
anneffortfp = initAnnEffortFile(bm);

if (bm->flagdetailedcatch) {
detailedCatchfp = initDetailedCatchFile(bm);
}
if (bm->flagdisplace) {
displaceEffortfp = initDisplacedEffortFile(bm);
}
Expand All @@ -130,7 +143,10 @@ void Close_Harvest_Output_Files(MSEBoxModel *bm) {
Util_Close_Output_File(anndpffp);
Util_Close_Output_File(anndiscardfp);
Util_Close_Output_File(anneffortfp);

if (bm->flagdetailedcatch) {
Util_Close_Output_File(detailedCatchfp);
}

if (bm->flagdisplace) {
Util_Close_Output_File(displaceEffortfp);
}
Expand Down Expand Up @@ -283,6 +299,30 @@ FILE * initAnnCatchPerFisheryFile(MSEBoxModel *bm) {
return (fid);
}


FILE * initDetailedCatchFile(MSEBoxModel *bm) {
FILE *fid;
char fname[STRLEN];
int sp, flag_sp;

sprintf(fname, "%sDetailedCatch.txt", bm->startfname);
printf("Creating %s\n", fname);

if ((fid = Util_fopen(bm, fname, "w")) == NULL)
quit("initDetailedCatchFile: Can't open %s\n", fname);

fprintf(fid, "Time Box Fishery");
for (sp = 0; sp < bm->K_num_tot_sp; sp++) {
if (FunctGroupArray[sp].isFished == TRUE) {
flag_sp = (int)(FunctGroupArray[sp].speciesParams[flag_id]);
if (flag_sp)
fprintf(fid, " %s", FunctGroupArray[sp].groupCode);
}
}
fprintf(fid, "\n");
return (fid);
}

FILE * initAnnDiscardPerFisheryFile(MSEBoxModel *bm)
/* Routine to initialise discard information file */
{
Expand Down Expand Up @@ -507,6 +547,42 @@ void writeAnnCatchPerFishery(FILE *fid, MSEBoxModel *bm, FILE *llogfp) {
return;
}



void writeDetailedCatch(FILE *fid, MSEBoxModel *bm, FILE *llogfp) {
int sp, flag_sp, fishery_id, b, k;
double catch_2_print, box_catch;

fprintf(llogfp, "DEBUG: Entering writeDetailedCatch, nbox=%d nfisheries=%d nsp=%d wcnz=%d\n",
bm->nbox, bm->K_num_fisheries, bm->K_num_tot_sp, bm->wcnz);
fflush(llogfp);

if (verbose > 1)
printf("Write detailed catch information\n");

for (fishery_id = 0; fishery_id < bm->K_num_fisheries; fishery_id++) {
for (b = 0; b < bm->nbox; b++) {
fprintf(fid, "%e %d %s", bm->dayt, b, FisheryArray[fishery_id].fisheryCode);
for (sp = 0; sp < bm->K_num_tot_sp; sp++) {
if (FunctGroupArray[sp].isFished == TRUE) {
flag_sp = (int)(FunctGroupArray[sp].speciesParams[flag_id]);
if (flag_sp) {
box_catch = 0.0;
for (k = 0; k < bm->boxes[b].nz; k++) {
box_catch += bm->CumCatch[sp][fishery_id][b][k];
}
catch_2_print = box_catch * bm->X_CN * mg_2_tonne;
fprintf(fid, " %e", catch_2_print);
}
}
}
fprintf(fid, "\n");
}
}
return;
}


void writeAnnDiscardPerFishery(FILE *fid, MSEBoxModel *bm, FILE *llogfp) {
int sp, flag_sp, fishery_id;
double discard_2_print = 0;
Expand Down
1 change: 1 addition & 0 deletions atlantis/atlantismain/include/atlantisboxmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4320,6 +4320,7 @@ typedef struct {
int debug; /**< Flag enabling lots of debugging output code
- different values of this flag indicate different debuging options.*/
int debug_it; /**< Flag checking for adaptive timestep bottlenecks */
int flagdetailedcatch; /**< Flag enabling detailed catch output */
int flagannual_Mest; /**< Flag checking whether mortality per predator outputs only annually
- its useful to do it less than annually if calibrating */
int fishmove; /**< Flag turning fish movement on/off */
Expand Down
1 change: 1 addition & 0 deletions atlantis/atphysics/atparamIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ static int Read_Run_Parameters(MSEBoxModel *bm, char *fileName) {
bm->move_check = (int) Util_XML_Read_Value(fileName, ATLANTIS_ATTRIBUTE, bm->ecotest, 1, groupingNode, integer_check, "move_check");
bm->debug = (int) Util_XML_Read_Value(fileName, ATLANTIS_ATTRIBUTE, bm->ecotest, 1, groupingNode, integer_check, "debug");
bm->debug_it = (int) Util_XML_Read_Value(fileName, ATLANTIS_ATTRIBUTE, bm->ecotest, 1, groupingNode, binary_check, "debug_it");
bm->flagdetailedcatch = (int) Util_XML_Read_Value(fileName, ATLANTIS_ATTRIBUTE, bm->ecotest, 1, groupingNode, binary_check, "flagdetailedcatch");

if (bm->debug) {
warn("Debugging code - Activated\n");
Expand Down
1 change: 1 addition & 0 deletions example/VMPA_setas_run_fishing_F_Trunk.prm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ flagpassivetracer 0 # Flag indicating whether passive tracers of advection ne
external_populations 0 # FLag indicating whether you want a full population model run for when groups are outside the model domain - 0 = no, 1 = yes
flag_multiyr_migs 0 # Flag indicating whether multi-year (> 1 yr long) migrations need to be included
flag_migration_on 1 # Flag indicating whether any migrations active
flagdetailedcatch 1 0=off, 1=detailed catch per species per box per fishery

flagenviro_warn 0 # Flag indicating whether warning messages about spawn and movement being environmentally constrained are activated
trackWind 0
Expand Down
Loading