SIP350 Update carbon accounting + plant mortality - #359
Open
Alomir wants to merge 16 commits into
Open
Conversation
Collaborator
Author
|
@copilot please open a PR to update the unit tests in tests/sipnet to cover these changes. Create new similar tests if needed. |
Contributor
1 task
* Initial plan * Add unit tests for carbon accounting and plant mortality changes * Update for clang-format * Update context handling --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Mike Longfritz <Mike.Longfritz@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR revamps SIPNET’s carbon “accounting/buffer” handling (renaming plantWoodCStorageDelta → plantCAccountingDelta), adds a plant mortality/reemergence tracker with event output, updates restart/debug-log serialization to include the new tracker and event fields, and refreshes the Python viewer tools plus unit/smoke coverage accordingly.
Changes:
- Rework biomass C flux calculations to account for negative mean NPP and to use the carbon accounting delta consistently; add plant mortality detection and
plantdeathevent output. - Extend restart/debug logging schemas (survival tracker + expanded event trackers) and update unit tests/new modeling tests.
- Refactor
sipnet-view/sipnet-debug-viewtooling (shared arg parser, plot controls, toolbar hover display), plus smoke harness updates (optional debug-log runs).
Reviewed changes
Copilot reviewed 30 out of 34 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/sipnet_view.py | Adds configurable viewer window title; switches to shared default CLI parser. |
| tools/sipnet_view_common.py | Adds shared CLI parser helper, plot display controls, and custom toolbar hover reporting. |
| tools/sipnet_debug_view.py | Adds configurable window title; uses shared default CLI parser; minor perf copy before sorting/merging. |
| tests/smoke/russell_3/events.out | Updates expected computed event outputs after new accounting/mortality behavior. |
| tests/smoke/russell_2/events.out | Updates expected computed event outputs after new accounting/mortality behavior. |
| tests/smoke/russell_1/sipnet.config | Updates recorded “Final config” timestamp from smoke run. |
| tests/smoke/russell_1/events.out | Updates expected computed event outputs after new accounting/mortality behavior. |
| tests/smoke/run_smoke.sh | Adds optional debug-log generation mode for smoke runs. |
| tests/sipnet/test_sipnet_infrastructure/testDebugLogFiles.c | Updates debug-log header expectations; adds init/cleanup to avoid leaving modified files behind. |
| tests/sipnet/test_restart_infrastructure/mock_state.c | Updates restart schema drift mocking to use renamed accounting field. |
| tests/sipnet/test_modeling/testPlantMortality.c | New unit test suite for mortality + pool transfers (with/without litter and nitrogen). |
| tests/sipnet/test_modeling/testNitrogenCycle.c | Adds focused unit test for the new incremental N resorption flux helper. |
| tests/sipnet/test_modeling/testFluxCalculations.c | New unit tests for wood/leaf/root flux calculation behavior under positive/negative NPP. |
| tests/sipnet/test_modeling/Makefile | Adds new modeling test files to the test build. |
| tests/sipnet/test_events_types/testEventHarvest.c | Updates event test setup to use renamed carbon accounting delta field. |
| src/sipnet/state.h | Renames carbon accounting pool; introduces PlantSurvivalTracker; expands EventTrackers. |
| src/sipnet/state.c | Adds global plantSurvivalTracker and reorders globals. |
| src/sipnet/sipnet.c | Refactors flux calculations; adds plant survival init + mortality checks; updates trackers behavior. |
| src/sipnet/restart.c | Updates restart schema layout + read/write logic to include survival tracker + expanded event trackers. |
| src/sipnet/nitrogen.h | Renames N demand function; adds N resorption helper API; clarifies docs. |
| src/sipnet/nitrogen.c | Implements renamed demand function and new updateNResorptionFlux() helper. |
| src/sipnet/limitations.c | Updates nitrogen limitation logic to use renamed demand function. |
| src/sipnet/events.h | Adds PLANTDEATH event type; expands EventTrackers; fixes typo in comment. |
| src/sipnet/events.c | Adds plantdeath type-string support; tracks harvest fractions; extends event printing. |
| src/sipnet/depeffects.c | Adds missing include needed after header reshuffle. |
| src/sipnet/debug_log.c | Updates debug field lists and outputs to include survival tracker state. |
| src/sipnet/balance.c | Updates carbon accounting pool name and improves warning numeric formatting. |
| Makefile | Adds smokedebug target and debug-log cleanup in cleanall. |
| docs/CHANGELOG.md | Documents new debug viewer, plant mortality event output, and carbon accounting changes. |
| .github/copilot_instructions.md | Adds changelog formatting guidelines for Copilot-generated text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NOTE: THIS REPLACES #353
How was this change tested?
smoke_check.txt
Related issues
Checklist
docs/CHANGELOG.mdupdated with noteworthy changesclang-format(rungit clang-formatif needed)Note: See CONTRIBUTING.md for additional guidance. This repository uses automated formatting checks; if the pre-commit hook blocks your commit, run
git clang-formatto format staged changes.