Skip to content

Fix analytical solar azimuth at northward solar noon - #2907

Open
vera-rubin wants to merge 1 commit into
pvlib:mainfrom
vera-rubin:fix/northward-solar-noon
Open

vera-rubin wants to merge 1 commit into
pvlib:mainfrom
vera-rubin:fix/northward-solar-noon

Conversation

@vera-rubin

Copy link
Copy Markdown

solar_azimuth_analytical in pvlib 0.16.2.dev10+g49530b4dc returns 180° for latitude -35°, hour angle 0°, declination 0°, and zenith 35°; spherical geometry gives 0° (due north).

import numpy as np
from pvlib.solarposition import solar_azimuth_analytical
np.degrees(solar_azimuth_analytical(*np.radians([-35, 0, 0, 35])))
# Before: 180.0, expected: 0.0

We use the morning branch at zero hour angle to preserve the northward direction. We verified the regression fails before the fix and passes afterward, ran the solar-position test module, and checked independent spherical projections.

  • 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
  • Tests added
  • Adds description and name entries in the appropriate "what's new" file.
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.

— ChipLab

Use the morning branch for zero hour angle so northward noon returns zero radians. Add regression coverage for signed zero, scalar and array inputs, pandas Series, and a southward-noon control.
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