Skip to content

Conversation

@sunt05
Copy link

@sunt05 sunt05 commented Dec 18, 2025

Summary

Replaces step-function coefficient selection in OHM with smooth linear blending to eliminate numerical divergence at threshold boundaries.

  • Adds temperature transition zone (±2°C around threshold)
  • Adds moisture transition zones for surface wetness and soil moisture
  • Blends coefficients from all four conditions (summer/winter × wet/dry)
  • Adds division-by-zero guard for SoilStoreCap

Context

This addresses the root cause of #473 by eliminating the step function entirely. When there's no discontinuity, floating-point precision differences cannot cause different coefficient regimes to be selected.

Before (step function)

T >= 10°C → summer coefficients
T < 10°C  → winter coefficients

After (smooth blend)

T >= 12°C     → 100% summer coefficients
8°C < T < 12°C → linear blend
T <= 8°C      → 100% winter coefficients

Breaking Change

⚠️ This is a physics change that produces intentionally different results in transition zones (~8-12°C for temperature). This is expected and arguably more physically realistic.

TODO

  • Regenerate reference data (sample_output.csv.gz)
  • Full test suite validation
  • Documentation updates (CHANGELOG, user docs)

Test plan

  • Smoke tests pass after reference data regeneration
  • Full test suite passes
  • Verify cross-platform consistency (macOS/Linux/Windows)

Resolves #473

🤖 Generated with Claude Code

Replace step-function coefficient selection with smooth linear blending
to eliminate numerical divergence at threshold boundaries.

Changes to OHM_coef_cal subroutine:
- Add temperature transition zone (±2°C around threshold)
- Add moisture transition zones for surface wetness and soil moisture
- Blend coefficients from all four conditions (summer/winter × wet/dry)
- Add division-by-zero guard for SoilStoreCap

This is a physics change that produces more physically realistic results
in transition zones. Reference data will need regeneration.

Resolves: #473

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sunt05 sunt05 force-pushed the fix/gh-473-ohm-smooth-transition branch from b0349c9 to ff84a9f Compare December 18, 2025 20: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.

Numerical divergence in OHM calculations with specific Python/NumPy versions

2 participants