NGEET / fates

repository for the Functionally Assembled Terrestrial Ecosystem Simulator (FATES)
Other
105 stars 92 forks source link

Number of canopy layers might not go to zero when no cohorts exist #1202

Open rgknox opened 6 months ago

rgknox commented 6 months ago

See here where we calculate the number of canopy layers:

https://github.com/NGEET/fates/blob/main/biogeochem/EDCanopyStructureMod.F90#L2285

The value defaults to 1 if there are no cohorts. I don't have any reason to believe this is affecting results. But I do see this as a code vulnerability. Obviously there are no canopy layers if there are no cohorts, and this would potentially affect logic and looping erroneously in various parts of the code.