Skip to content

Fix transposed Hellmann exponent table in windspeed_powerlaw docstring - #2853

Open
dylanpulver wants to merge 2 commits into
pvlib:mainfrom
dylanpulver:fix-hellmann-exponent-table
Open

Fix transposed Hellmann exponent table in windspeed_powerlaw docstring#2853
dylanpulver wants to merge 2 commits into
pvlib:mainfrom
dylanpulver:fix-hellmann-exponent-table

Conversation

@dylanpulver

@dylanpulver dylanpulver commented Sep 2, 2026

Copy link
Copy Markdown
  • I am familiar with the contributing guidelines
  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • Adds description and name entries in the appropriate "what's new" file
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels and Milestone are assigned to the Pull Request and linked Issue.

The Hellmann exponent table in the windspeed_powerlaw docstring is the transpose of HELLMANN_SURFACE_EXPONENTS, the dict the function actually uses. The nine values were written out in dict order, which groups by surface type, while the table's rows are stability - so the five cells on the diagonal agree and the four off-diagonal ones are swapped in pairs: 0.10 and 0.11 between open water and coast, 0.34 and 0.40 between coast and cities.

The dict is the right one. Kaltschmitt, Streicher and Wiese (reference [1] in this docstring, p. 55) give unstable/neutral/stable = 0.06/0.10/0.27 over open water, 0.11/0.16/0.40 over flat open coast, 0.27/0.34/0.60 over inhabited areas - exactly the dict, whose key names are that source's row labels. Docstring only, no behaviour change.

Nothing exercised the disagreement: neither windspeed_powerlaw nor the dict has a caller inside pvlib/, and both tests pass unstable_air_above_open_water_surface (0.06), one of the cells a transposition leaves alone. Table and dict were added in the same commit, #2124.

Verified by parsing the dict and the RST table back out of atmosphere.py and comparing all nine cells: 4 mismatches before, 0 after.

Whatsnew entry goes in v0.16.0 - happy to move it to v0.15.3 if this should ship in the patch release.

AI disclosure: drafted with Claude Opus 5 (claude-opus-5); the values were checked against the cited reference.

The docstring table lists stability down the rows and surface type across
the columns, but the nine values were laid out in the order they appear in
HELLMANN_SURFACE_EXPONENTS, which groups by surface type. Four of the nine
cells therefore disagree with the dict the function actually uses. The
corrected table is the transpose of the printed one, which is why the five
cells on the diagonal already agreed.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Hey @dylanpulver! 🎉

Thanks for opening your first pull request! We appreciate your
contribution. Please ensure you have reviewed and understood the
contributing guidelines.

If AI is used for any portion of this PR, you must vet the content
for technical accuracy.

@echedey-ls

Copy link
Copy Markdown
Member

There's no freaking way you've opened 107 PRs in September by 2nd Sept. Closing as AI slop solution, I doubt you really checked the source papers and the suggested changes.

The underlying issue is real thou, a mismatch between the table coeffs and the dict coeffs. @IoannisSifnaios can you have a look at it? I may open an issue later.

@echedey-ls echedey-ls closed this Sep 2, 2026
@cwhanse cwhanse reopened this Sep 2, 2026
@cwhanse

cwhanse commented Sep 2, 2026

Copy link
Copy Markdown
Member

I'm going to re-open this one. Its the kind of error that AI excels at catching. I've checked the reference, the PR is correct.

AI is like gravity, we can fight it, or let it work for us.

@cwhanse

cwhanse commented Sep 2, 2026

Copy link
Copy Markdown
Member

We'll see if @dylanpulver agents address the editorial suggestion I made.

@adi-IL adi-IL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked against HELLMANN_SURFACE_EXPONENTS in pvlib/atmosphere.py and Kaltschmitt et al. (p. 55).

The table rows are stability states (unstable, neutral, stable) while the columns are roughness categories (open water, coast, inhabited). The four off-diagonal cells previously inverted the surface and stability axes:

  • Unstable over coast: 0.11 (was 0.10)
  • Neutral over open water: 0.10 (was 0.11)
  • Neutral over inhabited: 0.34 (was 0.40)
  • Stable over coast: 0.40 (was 0.34)

The corrected matrix reconciles the docstring table with HELLMANN_SURFACE_EXPONENTS across all nine entries.

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.

4 participants