Skip to content

Fix2448 #2485

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fix2448 #2485

wants to merge 3 commits into from

Conversation

OmarBahamida
Copy link

  • Add detailed definitions for solar angles with range constraints
  • Clarify pvlib's east-of-north convention for azimuth angles
  • Add cross-references between related terms using :term: directive
  • Add coordinate system conventions for latitude/longitude
  • Enhance existing angle definitions with usage notes and examples

This commit addresses issue #2448 by migrating angle definitions and conventions from parameter descriptions to the nomenclature page

- Add detailed definitions for solar angles with range constraints
- Clarify pvlib's east-of-north convention for azimuth angles
- Add cross-references between related terms using :term: directive
- Add coordinate system conventions for latitude/longitude
- Enhance existing angle definitions with usage notes and examples

This commit addresses issue pvlib#2448 by migrating angle definitions and
conventions from parameter descriptions to the nomenclature page.

(cherry picked from commit 16435c7)
- Created test_solar_angles.py to verify solar angle calculations
- Tests zenith, azimuth, and elevation angles for different times of day
- Uses New York City as example location on spring equinox
- Verifies angles are within expected ranges and follow correct patterns

(cherry picked from commit f202c5d)
…s/test_solarposition.py

- Deleted the standalone test_solar_angles.py file.
- Added a new test function, test_solar_angles_spring_equinox, to tests/test_solarposition.py.
- The new test verifies solar angles for New York City on the spring equinox, ensuring angles are within expected ranges and follow correct patterns.

(cherry picked from commit 9963629)
@@ -22,16 +22,23 @@ There is a convention on consistent variable names throughout the library:

aoi
Angle of incidence. Angle between the surface normal vector and the
vector pointing towards the sun’s center
vector pointing towards the sun's center. Must be >=0 and <=180 degrees.
Copy link
Member

Choose a reason for hiding this comment

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

Must be >=0 and <=180 degrees.

I'm mildly opposed to including this range description. I don't think that pvlib functions require that constraint. It is certainly not checked for the user. And I don't think that pvlib promises useful results if aoi falls in that range.

Is the intent here to inform a user of the usual range for this quantity? If so, and we agree to add a statement about "typical" ranges, then I don't think we should use the verb "must".

@pvlib/pvlib-maintainer please weigh in.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Cliff. I don’t think this constraint is necessary. A scan of the irradiance.py module yields the following functions with aoi as an argument:

  • poa_components has a note that says if AOI is negative or >90° then components would be zero…

Negative beam irradiation due to aoi :math:`> 90^{\circ}` or AOI

… but this is incorrect according to the code. It will only be zero if < -90° or >90°

poa_direct = np.maximum(dni * np.cos(np.radians(aoi)), 0)

  • gti_dirint has two subfunctions that depend on whether AOI is greater than or less than 90° which I think is a bug 🐞 and probable should read if abs(AOI) < 90

aoi_lt_90 = aoi < 90

If not a bug 🐞 then it seems to me that AOI is assumed to be in the range of [0, 180] but then it’s still a a bug 🐞 because AFAICT this is never enforced

  • iam.py also uses AOI for example in ASHRAE, it clearly limits abs(AOI) < 90

np.greater_equal(np.abs(aoi), 90, where=~np.isnan(aoi), out=aoi_gte_90)

Anyway, I suggest continue searching through the code, and find out what it actually says because it seems to me like there may be different assumptions

Copy link
Member

Choose a reason for hiding this comment

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

@OmarBahamida to let this PR move ahead without getting really involved, let's leave out any statements about a range of values.

Azimuth angle of the surface
Azimuth angle of the surface in degrees East of North. Must be >=0 and <=360.
The convention is defined as degrees east (clockwise) of north. This is pvlib's
convention; other tools may use different conventions. For example, North = 0°,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest moving the sentence, "For example, North...", before the sentence, "This is pvlib's convention...".

As it is, I interpret the example as an example of some other tool's convention, not as an example of pvlib's convention.

@echedey-ls
Copy link
Contributor

One quick note @OmarBahamida , that also relates to your other open PR #2486; when you opened the pull request, a template with a checklist must have been already there. Please add it again to the top of your pull request message body and mark items as required (not all may apply).

Pull request template

<!-- Thank you for your contribution! The following items must be addressed before the code can be merged. Please don't hesitate to ask for help if you're unsure of how to accomplish any of the items. Feel free to remove checklist items that are not relevant to your change. -->

 - [ ] Closes #xxxx
 - [ ] I am familiar with the [contributing guidelines](https://pvlib-python.readthedocs.io/en/latest/contributing/index.html)
 - [ ] Tests added
 - [ ] Updates entries in [`docs/sphinx/source/reference`](https://github.com/pvlib/pvlib-python/blob/main/docs/sphinx/source/reference) for API changes.
 - [ ] Adds description and name entries in the appropriate "what's new" file in [`docs/sphinx/source/whatsnew`](https://github.com/pvlib/pvlib-python/tree/main/docs/sphinx/source/whatsnew) for all changes. Includes link to the GitHub Issue with `` :issue:`num` `` or this Pull Request with `` :pull:`num` ``. Includes contributor name and/or GitHub username (link with `` :ghuser:`user` ``).
 - [ ] New code is fully documented. Includes [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) compliant docstrings, examples, and comments where necessary.
 - [ ] Pull request is nearly complete and ready for detailed review.
 - [ ] Maintainer: Appropriate GitHub Labels (including `remote-data`) and Milestone are assigned to the Pull Request and linked Issue.

<!-- Brief description of the problem and proposed solution (if not already fully described in the issue linked to above): -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants