Skip to content

[FIX] Jabowa: align self.grow to per-step convention#404

Merged
Lgz-tud merged 2 commits into
masterfrom
fix/jabowa-grow-per-step
Jun 6, 2026
Merged

[FIX] Jabowa: align self.grow to per-step convention#404
Lgz-tud merged 2 commits into
masterfrom
fix/jabowa-grow-per-step

Conversation

@Lgz-tud

@Lgz-tud Lgz-tud commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Mortality/Memory assumes that plant_module.grow stores a per-step growth increment (consistent with Bettina's m³/step). Jabowa instead stored an annualised rate (cm/yr), so the formula

if relative_grow * steps_per_year < threshold:
    plant.die()

inflated the LHS by steps_per_year-fold for Jabowa, making the mortality threshold effectively more lenient at sub-yearly time steps (e.g. 12× too lenient at monthly dt).

This PR fixes the unit mismatch at its source: Jabowa.self.grow is now stored as cm/step, matching Bettina's per-step convention. The Mortality/Memory formula is unchanged (it was correct for Bettina all along; the contract is now documented explicitly in Memory.md).

Diagnosis

Time step Old behaviour Fixed behaviour
Yearly (dt = 1 yr) relative_grow × 1 < threshold ✓ correct unchanged ✓
Monthly (dt = 1/12 yr) relative_grow × 12 < threshold — threshold effectively 0.5%/12 ≈ 0.04%/yr relative_grow × 1 < threshold

Bettina was unaffected because every Bettina intermediate (maint, ag/bg resources) explicitly multiplies by self.time, so its self.grow is already per-step.

Changes

Code

  • PlantModelLib/Jabowa/Jabowa.py — convert annualised rate to per-step inside progressPlant. self.grow now stores cm/step; dbh += self.grow directly (no time rescaling).
  • PlantModelLib/Mortality/Memory/Memory.py — comment generalised (was Bettina-only "m³ per time step").

Documentation

  • PlantModelLib/Jabowa/Jabowa.md — Process overview reflects per-step semantics.
  • PlantModelLib/Mortality/Memory/Memory.md — explicit per-step contract for plant modules; removed Bettina-specific "m³/m³" / "biovolume" wording.

Reference CSVs (regenerated)

12 Jabowa benchmarks: Default, Aboveground/AsymmetricZOI, Belowground/{FON, FON_MultiSpecies, FixedSalinity, SymmetricZOI, Merge_FixedSalinity_FON, Merge_FixedSalinity_sZOI}, Mortality/{Memory, NoGrowth, Random, RandomGrowth}. Bettina references untouched.

This unifies the output convention across plant modules.

Memory mortality assumes plant_module.grow stores a per-step increment
(consistent with Bettina's m^3/step). Jabowa stored an annualised rate
(cm/yr), causing relative_grow * steps_per_year to be inflated by
steps_per_year-fold at sub-yearly time steps - Memory's threshold
became effectively N times more lenient (e.g. 12x at monthly dt).

Convert annualised rate to per-step in-place inside progressPlant.
self.grow now stores cm/step, dbh += self.grow directly. CSV output
column 'growth' also switches to cm/step for consistency across plant
models (Bettina already outputs m^3/step).

Documents the per-step contract explicitly in Memory.md so future
plant modules cannot regress.

BREAKING CHANGE: Jabowa CSV output column 'growth' semantics changes
from cm/yr to cm/step. Downstream analyses that assumed cm/yr must
multiply by dt_yr = time / (3600*24*365.25) to recover the old value.

Reference CSVs regenerated for 12 Jabowa benchmarks. Bettina
benchmarks unaffected.
@Lgz-tud Lgz-tud requested a review from mcwimm May 7, 2026 19:20

@mcwimm mcwimm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm glad you found this bug!
Could you also please upload the non-CI reference files? Once you have done so, this PR will be ready to be merged.

Comment thread PlantModelLib/Mortality/Memory/Memory.md Outdated
- Apply suggestion in Memory.md: '**Contract for plant modules**' -> '**Note**'
- Regenerate non-CI reference CSVs for 11 Jabowa benchmarks (Default,
  Aboveground/AsymmetricZOI, Belowground/{FixedSalinity, FON, SymmetricZOI,
  Merge_FixedSalinity_FON, Merge_FixedSalinity_sZOI},
  Mortality/{Memory, NoGrowth, Random, RandomGrowth}).

@mcwimm mcwimm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@Lgz-tud Lgz-tud merged commit af3aa5b into master Jun 6, 2026
1 check passed
@Lgz-tud Lgz-tud deleted the fix/jabowa-grow-per-step branch June 6, 2026 19:39
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.

2 participants