Skip to content

Fix: add forcing height allowed ranges according to buildings plan area fraction#1287

Merged
sunt05 merged 9 commits intomasterfrom
dayantur/fix/validator/forcing-height-ranges
Apr 11, 2026
Merged

Fix: add forcing height allowed ranges according to buildings plan area fraction#1287
sunt05 merged 9 commits intomasterfrom
dayantur/fix/validator/forcing-height-ranges

Conversation

@dayantur
Copy link
Copy Markdown

@dayantur dayantur commented Apr 9, 2026

This PR improves validate_forcing_height_vs_buildings by providing ranges for forcing height based on buildings plan area fraction (bldgs.sfr).

 - If bldgs.sfr >= 0.35:
      - z must be between 1.5* and 5* building mean height
  - If bldgs.sfr < 0.35:
      - z must be between 2* and 5* building mean height

As before, two reference heights are used (this logic remains the same as before):

  • Mean building height (land_cover.bldgs.bldgh) - ERROR if violated
  • Maximum building height (calculated between bldgh, stebbs height and SPARTACUS height) - WARNING if violated

Main changes

  • Add ranges as described above in validate_forcing_height_vs_buildings (physics_rules.py)
  • Change tests in test_validation.py to align with the new logic
  • Add 3 more tests to cover the new logic scenarios
  • Add CHANGELOG.md entry

References

For forcing height ranges reference, see Grimmond, C. S. B., and T. R. Oke, 1999: Aerodynamic
Properties of Urban Areas Derived from Analysis of Surface Form. J. Appl. Meteor.
Climatol., 38, 1262–1292, Fig. 1.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

CI Build Plan

Changed Files

Python source (1 file)

  • src/supy/data_model/validation/pipeline/phase_b_rules/physics_rules.py

Tests (1 file)

  • test/data_model/test_validation.py

Documentation (2 files)

  • CHANGELOG.md
  • src/supy/data_model/validation/pipeline/phase_b_rules/physics_rules.py

Build Configuration

Configuration
Platforms Linux x86_64
Python 3.9, 3.14
Test tier standard (all except slow)
QGIS3 UMEP build Skipped (no ABI changes)
PR status Ready (standard matrix)

Rationale

  • Python source changed -> single-platform build
  • Test files changed -> validation build
  • No compiled extension changes -> QGIS3 UMEP build skipped (nightly provides coverage)

Updated by CI on each push. See path-filters.yml for category definitions.

@dayantur dayantur self-assigned this Apr 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Preview Deployed

Content Preview URL
Site https://suews.io/preview/pr-1287/
Docs https://suews.io/preview/pr-1287/docs/

Note

This preview is ephemeral. It will be lost when:

  • Another PR with site/ or docs/ changes is pushed
  • Changes are merged to master
  • A manual workflow dispatch runs

To restore, push any commit to this PR.

@dayantur dayantur marked this pull request as ready for review April 9, 2026 13:59
@dayantur
Copy link
Copy Markdown
Author

dayantur commented Apr 9, 2026

Hi @sunt05 - it would be great if you could have a look at this improvement and give your feedback/review :) many thanks!

@dayantur dayantur requested a review from sunt05 April 9, 2026 14:00
- CHANGELOG: [feat] -> [feature] per project conventions
- Docstring: replace en-dash with ASCII hyphen in citation
- Test docstring: fix reference typo (Apoud -> Grimmond & Oke)
- Test: add missing sfr to stebbs_height test data
- Remove unreachable dead code block (bldgh guaranteed non-None)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@sunt05 sunt05 left a comment

Choose a reason for hiding this comment

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

Thanks for this, @dayantur — nice work grounding the forcing height validation in the Grimmond & Oke (1999) plan area fraction regimes. The sfr-dependent thresholds and the new upper bound check are a solid improvement.

I've pushed a small follow-up commit (d7d7f4b) fixing a few minor items:

  • CHANGELOG tag [feat][feature]
  • ASCII hyphen in the citation (en-dash → -)
  • Reference typo in test docstring ("Apoud" → "Grimmond & Oke")
  • Added missing sfr to the stebbs_height test so it actually exercises that code path
  • Removed an unreachable dead code block (if not candidates: after bldgh is guaranteed non-None)

All 7 forcing height tests pass.

@sunt05 sunt05 enabled auto-merge April 11, 2026 02:49
@sunt05 sunt05 added this pull request to the merge queue Apr 11, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 11, 2026
@sunt05 sunt05 added this pull request to the merge queue Apr 11, 2026
Merged via the queue into master with commit eee5519 Apr 11, 2026
14 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.

2 participants