forked from Urban-Meteorology-Reading/SUEWS
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Nested orthogonal dimensions for netradiationmethod (GH#972) #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sunt05
wants to merge
11
commits into
master
Choose a base branch
from
sunt05/gh972-investigation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
a7ac57f to
ae4e82f
Compare
Preview Deployed
Note This preview is ephemeral. It will be lost when:
To restore, push any commit to this PR. |
…GH#972) Decompose netradiationmethod into orthogonal dimensions (physics + longwave) instead of exposing numeric codes directly. This provides a cleaner, more intuitive YAML configuration format whilst maintaining full backward compatibility. - Add physics_options.py with RadiationPhysics, LongwaveSource enums and NetRadiationMethodConfig container - Update ModelPhysics to use NetRadiationMethodConfig for netradiationmethod - Add @field_validator for legacy form coercion - Update DataFrame conversion methods for Fortran interface - Add physics and longwave properties to NetRadiationMethod enum - Update test assertions to use .int_value property 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The new physics_options module was missing from meson.build, causing ModuleNotFoundError in CI builds and wheel tests.
…acy formats (GH#972) - Add extensible tabbed documentation for dimensional config fields - Display recommended nested format (physics/longwave dimensions) and deprecated legacy numeric codes side by side - Fix GrassProperties title conflict causing RST heading ambiguity - Extract enum options from docstrings for cleaner documentation - Exclude inline nested models from separate file generation The tabbed interface provides cleaner UX with formal deprecation warning for legacy codes while showcasing the new orthogonal dimension structure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…#972) - Add PhysicsOptionConfig ABC with shared `ref`, `__int__`, interface - Add CodeMapper for bidirectional dimension-to-code mapping - Rename netradiationmethod field `model` → `scheme` for clarity - Reorder emissionsmethod fields: `heat` first, `co2` second - Update docs: "Legacy (Deprecated)" → "Legacy" with softer wording - Remove unnecessary wrapper functions (use mappers directly) - Consolidate tests into test_data_model.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…H#972)
- Add _coerce_enum_value() helper for case-insensitive enum lookup
- Add field validators for all single-dimensional physics options:
storageheatmethod, ohmincqf, roughlenmommethod, roughlenheatmethod,
stabilitymethod, smdmethod, waterusemethod, rslmethod, faimethod,
rsllevel, gsmodel, snowuse, stebbsmethod, rcmethod
- Support formats: integer, string (any case), dict with value key
- Example: storageheatmethod: 5 | EHC | ehc | {value: "ehc"}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…H#972)
- Use nested format for multi-dimensional options:
- netradiationmethod: {scheme: narp, ldown: air}
- emissionsmethod: {heat: J11, co2: none}
- Use string names for single-dimensional options:
- storageheatmethod: ohm_without_qf (was value: 1)
- stabilitymethod: campbell_norman (was value: 3)
- etc.
- Add inline comments explaining the two conventions
- More readable and self-documenting for users
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add user-friendly short aliases following conventions: - Xyy format: author initial + two-digit year (e.g., K09, CN98, W16) - yes/no for binary options (ohmincqf, snowuse) - Simple keywords for others (ohm, model, auto, off) Short aliases added for all single-dimensional physics options: - storageheatmethod: obs, ohm, S17, O05, ehc, L25, stebbs - ohmincqf: no, yes - roughlenheatmethod: B82, K09, VG00, K07, auto - stabilitymethod: H88, CN98, BH71 - gsmodel: J11, W16 - And more... Update sample_config.yml to demonstrate short aliases. Both full names and short aliases remain valid input. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change aliases to use recognisable model/method names where they exist: - storageheatmethod: anohm, estm, ehc, dyohm (not S17, O05, L25) - roughlenheatmethod: kawai, kanda, brutsaert (not K09, K07, B82) - stabilitymethod: campbell, hoegstrom, businger (not CN98, H88, BH71) - gsmodel: jarvi, ward (not J11, W16) - roughlenmommethod: macdonald, lambdap (not M98, GO99) Model names are more intuitive and recognisable to users than author-year codes. Xyy format should only be used when no model name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…dels (GH#972) Alias convention: - Explicit model names: ohm, anohm, estm, ehc, dyohm, stebbs, narp, most, rst - Author methods (Xyy): K09, CN98, W16, J11, B82, K07, H88, B71, M98, GO99 - Generic terms: fixed, variable, auto, model, obs, yes, no, off Examples: - roughlenheatmethod: K09 (Kawai 2009) - stabilitymethod: CN98 (Campbell & Norman 1998) - gsmodel: W16 (Ward 2016) - storageheatmethod: ohm (explicit model name) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…H#972) The `X | None` union syntax (PEP 604) requires Python 3.10+. Changed to Optional[X] for Python 3.9 support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive documentation for the physics option alias system: In model.py: - Detailed comment block explaining the 5 input format types - Examples for each format type - Note on case-insensitivity In sample_config.yml: - Header explaining the naming convention - Inline comments showing valid values for each option - Clear separation between multi-dimensional and single-dimensional options Format types documented: 1. Numeric codes (legacy): storageheatmethod: 1 2. Model names: ohm, anohm, estm, ehc, narp, most, rst 3. Author-year (Xyy): K09, CN98, W16, J11 4. Descriptive: fixed, variable, auto, model, obs 5. Binary: yes/no 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
57bb161 to
a0b8140
Compare
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
Decompose physics options (starting with
netradiationmethod) into orthogonal dimensions with human-readable names, replacing opaque numeric codes. This provides a cleaner, more intuitive YAML configuration format whilst maintaining full backward compatibility.Key Features
1. Nested Orthogonal Dimensions
2. Human-Readable Option Names
All physics options now accept intuitive string names (case-insensitive):
ohm,anohm,estm,ehc,narp,spartacusK09(Kawai 2009),CN98(Campbell & Norman 1998)fixed,variable,auto,model,obsyes,no3. Full Backward Compatibility
Legacy formats remain fully supported:
Changes
Core Implementation
physics_options.py: Base classPhysicsOptionConfigwithCodeMapperfor bidirectional code↔name mappingNetRadiationMethodConfig,EmissionsMethodConfig: Multi-dimensional configs with orthogonal enumsCode Quality
X | None→Optional[X]for runtime compatibility.claude/rules/python/conventions.mdDocumentation
sample_config.ymlwith inline comments showing valid optionsTest Results
All smoke tests passing on Python 3.9-3.14 across Linux, macOS, and Windows.
Related