LANDIS-II-Foundation / Extension-Biomass-Succession

Biomass-based succession extension for LANDIS-II
https://sites.google.com/site/landismodel/extensions/biomass-succession
Apache License 2.0
4 stars 9 forks source link

"Object reference not set to an instance of an object" when adding a new cohort #38

Closed Klemet closed 2 years ago

Klemet commented 2 years ago

Hello everybody !

I've encountered this issue recently, when using Biomass Succession 5.3 :

LANDIS_Error

Digging into the code, it seems that this happened when this function (CohortBiomass.InitialBiomass) is called, calling an enumerator that should be situated around here in the Biomass Cohorts library.

I imagine that the error comes from the fact that the enumerator is empty in some way; or that it hasn't been initialized properly. My simulation has prescriptions that can completely remove all cohorts from a cell; could it be that the enumerator then returns empty, because not cohort exists in the cell ?

I'd be very grateful if this problem could be solved quickly; I'm running a bit late because of such technical problems. If I can help in any way, please tell me !

rmscheller commented 2 years ago

Clement, I'm sympathetic but I'm not sure how quickly I can solve it. Do you have this inputs available on GitHub?

Klemet commented 2 years ago

Thank you very much for the consideration, Mr. Scheller. I apologize for the speedy demand.

The inputs are not available on GitHub; and since I'm using my own Magic Harvest extension with a custom Python Script, I'm afraid that giving you everything you need for the simulation to run could be long (installing Python packages, etc.). I hoped that the error or its cause might have been known in another way.

I'm going to make another test to see if I get the error again, and I'll try to prepare a bundle with a smaller scenario that triggers the error if it comes again. Thank you again !

Klemet commented 2 years ago

Well, I find myself completly unable to reproduce the error.

I didn't change anything, and re-ran the same scenarios; but the error didn't come. I'm a bit dumbfounded !

My deepest apologies for asking for a quick resolution of the issue when it might have been something random.

rmscheller commented 2 years ago

Clement,

If I had a dollar for every time this happened to me, I'd be a rich man! There's no accounting for the deep uncertainty embedded within code, compilers, and CPUs. Sometimes errors just happen - no harm, no foul.