-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group-level and species-level biomass and number of individuals don't add up #126
Comments
Yes, this is related to #111, but perhaps was not described well there. |
Note also, this problem seems to disappear when _extra_growth is off. At least the discrepancy with relsizes. |
|
@kpalmqui: This discrepancy arises because the function The output function
Now, the macro |
The question now is why does thge function |
The call to
|
Nice find. I suppose I should have reviewed the mortality code more carefuly, given I thought the issue was related to improper killing. Thank you! I will look more carefully this morning, but my perspective is that why mort_Main does not set relsize to 0 is an oversight that has been missed in the code so far. |
The species
So far so good, but the problem is that upon returning to
|
It seems |
Oh, no. I may be incorrect in my interpretation in #126 (comment) Maybe the |
The
|
Sum of individual relsizes diverges for
At the end of year 100, some species/groups are in sync, others are off; and relsize of groups doesn't get set to 0 if there are no individuals of species of that group:
|
In regard to the relsize of individuals not adding up to species relsize - that could occur if extra_growth happens in the current year. This extra growth represents increase in biomass that will ultimately be killed at the end of the year. Since it is just killed off at the end of the year anyway, there is no need to update the ndv->relsizes. Instead, the species relsize and rgroup relsizes are updated. This might explain the discrepancy you are seeing (at least before _kill_extra_growth occurs). Thanks for all of this debugging. So problems so far that required fixing:
|
Hm, ok; I didn't know that about "extra resources". I don't believe that The relsizes are already off before entering
|
And if the reasoning about "extra resources" is correct, then this means that |
And even at the end of a year -- after "extra resources" are removed, there are discrepancies between species/group
|
I am not sure what you mean by they are off going into _no_resources. They look ok after rgroup_Grow in the above print statements...? You are right that there is a clearly a problem if ndv = 0.0, but RG or sp relsize > 0. |
I refer to that |
I think that is due to _extra_growth. |
How do you interpret that these relsizes are still off at the end of a year after extra growth has been removed? For instance,
|
In regards to: And if the reasoning about "extra resources" is correct, then this means that pssp has 4.49 units of extra resources while only 1.71 units of "normal" resources in year 93. Does this seem right? I have just made extra resources and _extra_growth functional again - it hadn't been functional ever when SOILWAT2 was running. I've been too busy trying to track down these bugs to think carefully about the magnitude of extra resources. 4.49 of extra resources does seem a bit high, but the weather data that is used here is for a wet site. Certainly deserves more thought and evaluation. |
In the above case - is there only 1 individual established for each functional group? If not, the species and rgroup relsize will not match the ndv->relsize. Ndv->relsize is 0 to 1, while species->relsize can be >1, as can rgroup->relsize. |
If there is only 1 individual, something is clearly wrong. |
the above output is from
The existing function |
what |
I see - well yes that doesn't make sense. |
- Function `check_sizes` was using the integer instead of floating-point version of `abs` - see issue #126
Can you push up the additional printf and check_sizes statements you have added to you local clone? Thanks! |
Sure, it's pretty verbose. Here they come |
- addressing #126 - revert commit (or comment printf's out) once issue is resolved - to recreate my output in the comments, run with `model.in`: # niter nyrs seed 1 100 3
thanks much - no need to me to waste time doing the same thing. |
eek getting a segfault with two latest commits |
I can just edit locally, not a biggie |
Do you get a segfault also with commit 6072ad6? |
No, 6072ad6 is fine. |
So it looks like something might be going wrong in rgroup_Establish for perennial species with individual and species relsizes that is then propagating throughout the year. ------------------------Repetition/year = 1 / 2 WARNING: 'main' after rgroup_Establish (1:2): RG "p.cool.grass" size error: RG=0.299066186, ndv=0.230499297 |
Nevermind, that error is occurring because something went wrong in the previous year and no establishment occurred for pssp in the current year |
I think I may have found the problem? g->res_extra entering _kill_extra_growth is always 0.0, despite it being non-zero in _res_part_extra. So the difference between the summed ndv->relsize and and species->relsize in the first year appears to be s->extragrowth |
Removing: At the beginning of _kill_extra_growth solves that problem. However, warnings are still getting thrown after kill_extra_growth: WARNING: 'main' after kill_extra_growth (1:2): RG "p.warm.grass" size error: RG=0.046365350, ndv=0.000000000 What looks like might be happening here is there are no individuals established anymore (presumably they were killed) and relsize is off because extra_growth is being added back to species-relsize here in the _kill_extra_growth function. s->extragrowth = 0.046365 |
These small values propagate across years. Because the _kill_extra_growth loop is set up as ForEachEstSpp(sp, rg, j) { }, when individuals of a species are no longer established, the extragrowth is not removed from the s->relsize because that individual has been killed. |
This check is not needed, plus for some reason g->res_extra is 0.0 here.
Changing this loop from ForEachEstSpp to ForEachGroupSpp (to loop through all species, skip those where extragrowth=0.0, and do the necessary removal) causes new warnings to the logfile and a logerror: rgroup_PartResources': Group = sagebrush(0) error with res (relsize = 0.010851, pr = 0.086675): So that does not seem to be the simple, easy solution to this problem. |
This issue has been partially addressed by commits: In most years, the species biomass and relsize matches the rgroup biomass relsize now. The exception is when individuals belonging to a species are killed, so species->est_count = 0, but species->relsize is not 0 at the end of the year because extra_growth occurred for the species before all the individuals were killed. This does not happen for the rgroup, because there is a check in RGroup_GetBiomass if (RGroup[rg]->est_count == 0) Potential solution is to add similiar logic to Species_GetBiomass. |
- added similiar logic to Species_GetBiomass, as what exists for RGroup_GetBiomass.
Resolved by above commit. |
In the bmassavg.csv output file, rgroup biomass (i.e. p.cool.grass) is not perfectly equal to pssp biomass (despite being the only p.cool.grass species on). The number of individuals that died according to their age is also not identical in a given year between the functional group and only species representing that functional group. This does not make sense.
The text was updated successfully, but these errors were encountered: