Skip to content

[339] Rename plantWoodCStorageDelta to plantWoodCAccountingDelta#344

Open
ANAMASGARD wants to merge 2 commits into
PecanProject:masterfrom
ANAMASGARD:rename/plantWoodCAccountingDelta-closes-339
Open

[339] Rename plantWoodCStorageDelta to plantWoodCAccountingDelta#344
ANAMASGARD wants to merge 2 commits into
PecanProject:masterfrom
ANAMASGARD:rename/plantWoodCAccountingDelta-closes-339

Conversation

@ANAMASGARD
Copy link
Copy Markdown
Contributor

@ANAMASGARD ANAMASGARD commented May 27, 2026

Summary

FIXES #339.

Issue #339 refers to plantWoodStorageC; the actual SIPNET identifier was plantWoodCStorageDelta (output column: nppStorage). This PR renames it to plantWoodCAccountingDelta to reflect that it tracks carbon changes with no associated nitrogen (NPP averaging lag / bookkeeping), not a storage pool.

  • No change to model equations or numeric results — rename and output formatting only.
  • sipnet.out: column nppStorageplantWoodCAccountingDelta (wider field width for header alignment).
  • Restart: checkpoints write envi.plantWoodCAccountingDelta; existing checkpoints using envi.plantWoodCStorageDelta still load.
  • Docs: updated terminology in model structure, parameters, outputs, and CHANGELOG.

Test plan

  • make testbuild
  • make unit (all 21 tests pass, including testOutputHeader and restart suite)
  • make smoke (5/5 sipnet; smoke baselines updated for last-column padding)

The wood N-lag term is an accounting delta for carbon not coupled to
nitrogen, not a storage pool. Renames the Envi field, sipnet.out column
(was nppStorage), restart key, and docs; legacy restart keys remain readable.
Copilot AI review requested due to automatic review settings May 27, 2026 14:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR renames SIPNET’s internal “wood storage delta” field to clarify that it is an accounting term (carbon not coupled to nitrogen), and propagates the rename through outputs, restart serialization, tests, and docs.

Changes:

  • Renamed plantWoodCStorageDeltaplantWoodCAccountingDelta across model code and tests.
  • Renamed the sipnet.out column nppStorageplantWoodCAccountingDelta and updated smoke-check tooling and golden outputs.
  • Added backward-compatible restart reading for legacy checkpoints using envi.plantWoodCStorageDelta.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/smoke_check.py Updates expected output column list to match the renamed output field.
tests/smoke/russell_4/sipnet.out Updates smoke-test golden output header for the renamed column.
tests/sipnet/test_restart_infrastructure/mock_state.c Updates restart infra test scaffolding for the renamed environment field.
tests/sipnet/test_events_types/testEventHarvest.c Updates event test initialization to the renamed environment field.
src/sipnet/state.h Renames the environment struct field and clarifies its meaning in comments.
src/sipnet/sipnet.c Renames output column header and replaces all uses of the old field name.
src/sipnet/restart.c Writes restart checkpoints with the new key and reads legacy checkpoints with the old key.
src/sipnet/events.c Updates harvest event calculations to use the renamed field.
src/sipnet/balance.c Updates mass-balance totals and clarifies nitrogen accounting comment.
docs/user-guide/model-outputs.md Documents the new output column name and the prior name.
docs/parameters.md Updates parameter documentation to the new accounting-delta terminology.
docs/model-structure.md Updates model-structure narrative/equations to reflect accounting delta terminology.
docs/developer-guide/restart-checkpoint.md Documents backward-compatible restart key handling post-rename.
docs/CHANGELOG.md Adds changelog entry describing the rename and restart compatibility behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/restart.c Outdated
#define RESTART_SCHEMA_VERSION "1.0"
#define RESTART_FLOAT_EPSILON 1e-8
#define LEGACY_ENVI_PLANT_WOOD_C_STORAGE_DELTA "envi.plantWoodCStorageDelta"
#define ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX 12
Comment thread src/sipnet/restart.c
state->enviPF[10] = (StateField){"envi.litterN", FT_DOUBLE, &envi.litterN, 0};
state->enviPF[11] = (StateField){"envi.plantStorageN", FT_DOUBLE, &envi.plantStorageN, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCStorageDelta", FT_DOUBLE, &envi.plantWoodCStorageDelta, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCAccountingDelta", FT_DOUBLE, &envi.plantWoodCAccountingDelta, 0};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread src/sipnet/restart.c Outdated
Comment on lines +629 to +631
if (setLegacyPlantWoodCAccountingDelta(
restartIn, key, value,
&state->enviPF[ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX])) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/sipnet.c

fprintf(out, "%4d %3d %5.2f %10.2f %10.2f %12.2f ", year, day, time,
(envi.plantWoodC + envi.plantWoodCStorageDelta), envi.plantLeafC,
(envi.plantWoodC + envi.plantWoodCAccountingDelta), envi.plantLeafC,
Copy link
Copy Markdown
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ANAMASGARD - thank you for your contribution!

I made a few comments, but will defer to @Alomir to determine what, if anything, should be changed before merging.

Comment thread docs/developer-guide/restart-checkpoint.md Outdated
Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/restart.c
state->enviPF[10] = (StateField){"envi.litterN", FT_DOUBLE, &envi.litterN, 0};
state->enviPF[11] = (StateField){"envi.plantStorageN", FT_DOUBLE, &envi.plantStorageN, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCStorageDelta", FT_DOUBLE, &envi.plantWoodCStorageDelta, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCAccountingDelta", FT_DOUBLE, &envi.plantWoodCAccountingDelta, 0};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/restart.c Outdated
Comment on lines +629 to +631
if (setLegacyPlantWoodCAccountingDelta(
restartIn, key, value,
&state->enviPF[ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX])) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread docs/CHANGELOG.md Outdated
Per review on PecanProject#344: do not read envi.plantWoodCStorageDelta from checkpoints.
Update docs and add test that the obsolete key is rejected.
@ANAMASGARD
Copy link
Copy Markdown
Contributor Author

ANAMASGARD commented May 30, 2026

Thanks @dlebauer for the review — addressed in this new commit

  • Removed legacy envi.plantWoodCStorageDelta restart handling; checkpoints must use envi.plantWoodCAccountingDelta. The old key now fails with unknown key.
  • Updated CHANGELOG and restart docs per your suggested wording.
  • Added testObsoletePlantWoodCStorageDeltaKeyFails in the restart suite to lock in that behavior.

Left the plantWoodC output column naming as-is (it still reports total wood C = structural + accounting delta). Happy to follow up with a plantWoodCTotal rename if you prefer that in a separate PR.

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.

Rename plantWoodStorageC

3 participants