Skip to content

Reconfigure initial plant cohort data#1066

Merged
davidorme merged 9 commits intodevelopfrom
1041-move-initial-plant-cohort-data
Oct 6, 2025
Merged

Reconfigure initial plant cohort data#1066
davidorme merged 9 commits intodevelopfrom
1041-move-initial-plant-cohort-data

Conversation

@davidorme
Copy link
Copy Markdown
Collaborator

@davidorme davidorme commented Oct 1, 2025

Description

As noted in #1041, the current path for loading initial plant cohort data shoves it into the Data object, from where it is read once and never touched again. That also adds an arbitrary single use cohort_id axis into the Data object.

This PR swaps that data out into a separately configured CSV file of initial cohort data, which is both easier for users and avoids complicating the Data object structure.

  • Removes the plant_cohorts_pft, ..._dbh, ..._n, ..._cell_id variables from required __init__ vars in the Data object.
  • Instead, these data are provided via the new PlantsModel(..., cohort_data: pd.Dataframe) argument.
  • The model schema is updated to add the cohort_data_path config option and the PlantsModel.from_config() now loads that configured file and passes the resulting data frame in to PlantsModel.
  • The PlantCommunities.__init__ now takes that dataframe as an input rather than the Data object.
  • All tests are updated
  • The example_data directory is also updated to the new configuration.
  • Updates the example TOML file in docs/source/_static, which was last updated in the Stone Age.

Fixes #1041

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 59.45946% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.56%. Comparing base (10d4bc4) to head (537d263).

Files with missing lines Patch % Lines
virtual_ecosystem/models/plants/plants_model.py 50.00% 11 Missing ⚠️
...mple_data/generation_scripts/plant_example_data.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1066      +/-   ##
===========================================
- Coverage    94.67%   94.56%   -0.11%     
===========================================
  Files           79       79              
  Lines         6964     6973       +9     
===========================================
+ Hits          6593     6594       +1     
- Misses         371      379       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@davidorme davidorme merged commit 745f4b3 into develop Oct 6, 2025
23 of 24 checks passed
@davidorme davidorme deleted the 1041-move-initial-plant-cohort-data branch October 6, 2025 15:18
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

Successfully merging this pull request may close these issues.

Move initial plant cohort data out of Data and into the plant configuration.

3 participants