Skip to content

Zero plane displacement clamp in BMI#55

Merged
aaraney merged 2 commits intoNOAA-OWP:masterfrom
hellkite500:zero-plane-clamp
Feb 20, 2026
Merged

Zero plane displacement clamp in BMI#55
aaraney merged 2 commits intoNOAA-OWP:masterfrom
hellkite500:zero-plane-clamp

Conversation

@hellkite500
Copy link
Copy Markdown
Contributor

Related to #52 and #54 , when running the BMI model, we can try to prevent divide by zero conditions by clamping the zero plane displacement height.

Additions

  • Validate that measurement height is >= zero plane displacement height in user provided config
  • Ensure that zero plane displacement is > 0 by setting it to 0.01 (1 mm) if it is 0 or less
  • Ensure that zero plane displacement is < measurement height by setting it to measurement height - 0.01 when they are equal. This ensure valid computations of the profile at nearly the measurement height.

Changes

  • Config returns BMI_FAILURE and prints an error when measurement_height < displacement height

  • PR has an informative and human-readable title

  • Changes are limited to a single goal (no scope creep)

  • Code can be automatically merged (no conflicts)

  • Code follows project standards (link if applicable)

  • Passes all existing automated tests

  • Any change in functionality is tested

  • New functions are documented (with a description, list of inputs, and expected output)

  • Placeholder code is flagged / future todos are captured in comments

  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)

  • Reviewers requested with the Reviewers tool ➡️

Copy link
Copy Markdown
Member

@aaraney aaraney left a comment

Choose a reason for hiding this comment

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

Logic looks solid, just a minor unit issue!

@hellkite500
Copy link
Copy Markdown
Contributor Author

hellkite500 commented Feb 20, 2026

After a separate but related discussion with @ajkhattak I'm going to relax the validation/error conditions on wind speed displacement height < measurement height. There are some deeper assumptions in the pet code that handle this in non-obvious ways, but allow this condition to be "valid" still I think.

@hellkite500
Copy link
Copy Markdown
Contributor Author

Changes to #54 ensure that the pet module can gracefully handle displacement and measurement height relationships in a meaningful way, so we don't need to handle that in BMI config parsing, but the displacement <= 0 is still reasonable to adjust here, I think.

@aaraney aaraney merged commit 9069ee1 into NOAA-OWP:master Feb 20, 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.

2 participants