Skip to content
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

The counts of cohorts given by AgeDistribution seem incorrect #14

Open
Klemet opened this issue Oct 11, 2024 · 0 comments
Open

The counts of cohorts given by AgeDistribution seem incorrect #14

Klemet opened this issue Oct 11, 2024 · 0 comments

Comments

@Klemet
Copy link
Collaborator

Klemet commented Oct 11, 2024

Sorry, I'm coming with another potential issue 🙏 !

Still based on the results of this test scenario.

The AgeDistribution parameter of Output-Biomass-PnET creates a .csv showing a histogram of the distribution of the age cohorts for each species; and a raster file giving the number of age cohorts in each cells.

The problem

However, the cohort counts in both the .csv and the raster seem incorrect in two different ways :

  1. The total cohorts count of the raster and the one of the csv file don't match.

The difference, depending of the time step, can reach around a factor of 2 (but not precisely 2).

For example : Here are the contents of ageDistrib-0Histogram.csv as produced by the test scenario linked above.

NrOfCohortsAtAge [10_43] [43_76] [76_109] [109_142] [142_175] [175_208] [208_241] [241_274] [274_307] [307_340]
abiebals 2582 1119 0 0 0 0 0 0 0 0
acerrubr 4017 0 0 0 0 0 0 0 0 0
acersacc 2582 0 0 0 0 0 0 0 0 0
betualle 4227 1463 0 0 0 0 0 0 0 0
betupapy 0 0 1645 0 0 0 0 0 0 0
fraxamer 2582 3108 1119 0 0 0 0 0 0 0
piceglau 0 0 0 0 0 1422 0 0 0 0
pinubank 0 0 0 0 0 0 0 0 0 0
pinuresi 0 0 0 909 0 0 0 0 0 0
pinustro 0 0 0 0 0 0 1645 0 1422 0
poputrem 1686 0 0 0 0 0 0 0 0 0
querelli 1557 1557 0 0 0 0 909 0 0 0
querrubr 1645 0 2582 0 0 0 0 0 0 0
thujocci 0 1645 0 0 0 0 0 0 0 0
tiliamer 4227 1463 1119 0 0 0 0 0 0 0
tsugcana 3701 1119 1119 1119 1119 1119 2238 1119 1119 1119
Total 28806 11474 7584 2028 1119 2541 4792 1119 2541 1119

The total of all cohorts (sum of the "Total" line) reaches 63123.

In comparison, here are the pixel count frequencies of the raster ageDistrib-0.img (same time step) :

Pixel value Pixel count Number of cohorts (product)
1 1686 1686
2 2979 5958
3 909 2727
8 1645 13160
11 1463 16093
12 1119 13428

Which gives a total of 53052 cohorts.

  1. The number of cohorts in both the raster and the .csv file do not match the number of cohorts that should be present in the landscape at t 0.

Using the files initial-communities.txt and initial-communities.gis from the test scenario linked at the top, one can normally predict how many cohorts of each species will be present in the landscape at t0 (by multiplying the number of cohorts expected for each mapcode for the species by the number of times the mapcode is found). One can even check if the age distribution in the .csv histogram is correct.

But again, the numbers don't match on my side.

For example : here is the prediction of the number of initial cohorts in the landscape for tsugcana based on the initial community files :

  • 1463 cohorts of 10 years
  • 1119 cohorts of 30 years
  • 1119 cohorts of 120 years
  • 1119 cohorts of 220 years
  • 1119 cohorts of 340 years

And here is the distribution that we can see inageDistrib-0Histogram.csv (as pasted from above) :

NrOfCohortsAtAge [10_43] [43_76] [76_109] [109_142] [142_175] [175_208] [208_241] [241_274] [274_307] [307_340]
tsugcana 3701 1119 1119 1119 1119 1119 2238 1119 1119 1119

The bins are very strangely filled compared to what should be. Most of them have way too many cohorts. For other species, cohorts are downright missing (for example, acerrub should have 1119 cohorts of 120 years, but they absent from the table).

I also made a map of predicted cohort numbers (simply switching the map codes of initial-communities.gis with the total number of cohorts predicted for each map code), and compared it to ageDistrib-0.img. They again don't match, with ageDistrib-0.img having way less cohorts than what is predicted (almost a division by two overall). But it's not a simple division; and the patterns of distribution of maximum and minimum values do not match too.

image

image

The cause ?

I've tried to identify where the problem come from.

For problem 1. (mismatch between .csv and raster), it's possible that it's because the .csv is made by using the values coming from CohortAge (which gives lists of <ushort> corresponding to the cohorts of a species in a site, like [10, 30, 40]); while the raster is based on CohortCount (which returns an already-done sum of cohorts, all species combined, for a site).

But for problem 2., things gets messier. I haven't identified any obvious error in OutputHistogramCohort.cs that makes the .csv, nor in OutputMapSiteVar.cs that makes the raster. As such, it's possible that the problem lies deeper in how CohortAge and CohortCount are computed, or in how cohorts are managed.

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

No branches or pull requests

1 participant