Skip to content

Add BMI (Basic Model Interface) integration#168

Merged
taddyb merged 4 commits intoDeepGroundwater:masterfrom
taddyb:bmi
Mar 18, 2026
Merged

Add BMI (Basic Model Interface) integration#168
taddyb merged 4 commits intoDeepGroundwater:masterfrom
taddyb:bmi

Conversation

@taddyb
Copy link
Collaborator

@taddyb taddyb commented Mar 18, 2026

Summary

  • Implements a Basic Model Interface (BMI) wrapper (src/ddr/bmi/ddr_bmi.py) for the DDR differentiable routing model, enabling interoperability with CSDMS and other earth-system modeling frameworks
  • Adds BMI config model (src/ddr/bmi/config.py) and exposes the interface via the public API (src/ddr/__init__.py)
  • Adds comprehensive BMI test suite (tests/bmi/test_ddr_bmi.py, 833 lines) covering initialization, variable getters/setters, time stepping, and grid methods

Test plan

  • uv run pytest tests/bmi/ — all unit tests pass
  • uv run pytest — full test suite remains green
  • Verify BMI lifecycle: initialize → update → finalize with a sample config

🤖 Generated with Claude Code

taddyb and others added 4 commits March 14, 2026 16:54
The TestColdStart tests use a MagicMock mapper, which caused
compute_hotstart_discharge to pass a mock crow_indices to
triangular_sparse_solve. len(MagicMock()) - 1 == -1, producing
a negative scipy sparse matrix shape. Patch the hotstart function
in the two cold-start tests since they only verify the _cold_started
flag, not the hotstart computation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@taddyb taddyb merged commit aaf35c6 into DeepGroundwater:master Mar 18, 2026
4 checks passed
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.

1 participant