DrylandEcology / STEPWAT2

folder
4 stars 5 forks source link

Have Indiv Bmass Flag Output Even If SppBmass Flag Is Off #551

Closed alexisBelt closed 12 months ago

alexisBelt commented 1 year ago

In the bmassflags.in file, Indiv output is dependent on if the SppBmass flag is turned on or off. Even if Indiv is turned on, it won't output its associated columns if SppBmass is turned off. We need to make it to where Indiv will output if turned on, even if SppBmass is turned off.

alexisBelt commented 1 year ago

It seems like the problem is that all of the if statements to output Indv stats are nested in the SppBmass if statements. The solution for this is to go through stats and un-nest all of the Indv if statements.

Example: if (BmassFlags.sppb) { ForEachSpecies(sp) { bmass = (double) Species_GetBiomass(sp); if ( LT(bmass, 0.0) ) { LogError(logfp, LOGWARN, "Spp %s biomass(%.4f) < 0 in stat_Collect()", Species[sp]->name, bmass); bmass = 0.0; } _collect_add( &_Spp[sp].s[year], bmass); if (BmassFlags.indv) { _collect_add(&_Indv[sp].s[year], (double)Species[sp]->est_count); } } }

to

if(BmassFlags.sppbmass) {...} if (BmassFlags.indv) ForEachSpecies(sp) { _collect_add(&_Indv[sp].s[year], (double)Species[sp]->est_count); }

alexisBelt commented 1 year ago

committed 4cfb5bfc29709b1e66d9189e17226c4df9e9ac47 to bugfix_indiv_bmass_output

alexisBelt commented 1 year ago

committed 1283442 to bugfix_indiv_bmass_output