ImperialCollegeLondon / ImperialCollegeLondon/virtual_ecosystem

PlantsModel - moving to clear cohort / cell calculations

Open
#1,744 1 comment 0 reactions 1 assignee View on GitHub

@davidorme is already working on this.

Since Jul 27, 2026.

Dominant language
Python
Stars
20
Forks
5
Avg merge
2d 1h
Merged PRs (30d)
34

Description

The current implementation nests cohort data within communities, but actually most calculations can be done in parallel across all cohorts, with cell_id recorded in self.cohorts. This should give clearer and faster code by restricting the amount of time spent in cell_id loops.

  • The communities attribute disappears.
  • The following attributes go from dict[int, XYZ] to just XYZ
    • self.biomasses (This change probably has the most engineering and, since we want to rework the internals of Biomasses anyay, probably best done as a separate issue, although the temporary glue holding the join together would be finicky)
    • self.stem_allocations
    • self.growth_increments
    • self.per_stem_gpp (probably becomes a field in self.cohorts)
    • self.per_stem_transpiration (also probably becomes a field in self.cohorts)
  • The self.canopies attribute stays as dict[cell_id, Canopy]

The update flow would be:

  1. Mortality - applied across all cohorts (drop current cell_id loop)
  2. Recruitment - applied across all cohorts (drop current cell_id loop)
  3. Update allometry - a single StemAllometry object across cohorts. (drop current cell_id loop updating community objects).
  4. Herbivory - applied across all cohorts
  5. Calculate canopies - CELL level calculations (store cohort indices on canopy object).
  6. Update canopy layers - CELL level calculations.
  7. Subcanopy light capture - already in parallel across cells
  8. Calculate light use efficiency (already at cell by layer level).
  9. Estimate GPP - CELL level calculations, extract cohorts in each cell,
  10. Calculate nutrients - applied across all cohorts
  11. Allocate GPP - applied across all cohorts
  12. Subcanopy dynamics - already in parallel

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.