-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Issue #2245 Infinite sheds beam fraction on ground zenith guardrail syntax bug #2359
Conversation
Infinite sheds beam fraction on ground zenith guardrail syntax bug Set unshaded ground fraction to zero for solar_zenith> max_zenith
My guess is that the test failure is because I'm not sure how to fix this yet. |
Thanks @jason-rpkt for the PR!! @cwhanse is right in his reasoning. I don't think we need to guarantee returning Also, please add the bugfix and list yourself in TIA!! |
+1, thanks @echedey-ls |
Thank you both! Sorry, I'm a little confused by this part: Do you mean change Would changing line 375 from |
Yes.
No. pvlib tries to respect the type of inputs and return the same types. If input to a function is pd.Series, that means returning either pd.Series or (in this case) pd.DataFrame. Conversely, the function should return np.ndarray if the inputs are of that type. Changing as you propose would return pd.DataFrame when the |
This reverts commit 8b67a41.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great, but I think I should have proposed using ghi
instead of solar_zenith
in the isinstance
function. It was previously that in the documentation.
To continue, you have to update the branch from main, so the documentation can be built without problems and we can check how it renders.
Finally, add an entry to docs\sphinx\source\whatsnew\v0.11.3.rst
and credit yourself in the Contributors
section!
@@ -260,7 +260,10 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith, | |||
Returns | |||
------- | |||
output : dict or DataFrame | |||
Output is a DataFrame when input ghi is a Series. See Notes for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I read this, I think I should have suggested following the type of ghi
instead of solar_zenith
. Sorry for the confusion @jason-rpkt .
pvlib/bifacial/infinite_sheds.py
Outdated
Output is a DataFrame when solar_zenith is a Series. | ||
solar_zenith is the one that sets the output type. | ||
See Issue #2245 | ||
See Notes for | ||
descriptions of content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output is a DataFrame when solar_zenith is a Series. | |
solar_zenith is the one that sets the output type. | |
See Issue #2245 | |
See Notes for | |
descriptions of content. | |
Output is a ``pandas.DataFrame`` when ``ghi`` is a Series, | |
otherwise it is a dict of ``numpy.ndarray``. | |
See Notes for descriptions of content. |
Update docs\sphinx\source\whatsnew\v0.11.3.rst
I have updated the fork from main, changed from |
Tests fail because Please add this line in the group right after line 132
|
pvlib/bifacial/infinite_sheds.py
Outdated
Output is a "pandas.DataFrame" when "ghi" is a Series. | ||
Otherwise it is a dict of "numpy.ndarray" | ||
See Issue #2245 | ||
See Notes for descriptions of content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output is a "pandas.DataFrame" when "ghi" is a Series. | |
Otherwise it is a dict of "numpy.ndarray" | |
See Issue #2245 | |
See Notes for descriptions of content. | |
Output is a ``pandas.DataFrame`` when ``ghi`` is a Series. | |
Otherwise it is a dict of ``numpy.ndarray``. | |
See Notes for descriptions of content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that double recommendation, it's my company firewall getting in the way of following links.
|
@cwhanse was referring to file |
@@ -10,7 +10,7 @@ Deprecations | |||
|
|||
Enhancements | |||
~~~~~~~~~~~~ | |||
|
|||
Fix syntax for unshaded ground fraction (:issue:`2245`, :pull:`2359`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix syntax for unshaded ground fraction (:issue:`2245`, :pull:`2359`) | |
Fix bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may had yielded non-zero ground irradiance with sun below horizon (:issue:`2245`, :pull:`2359`) | |
pvlib/bifacial/infinite_sheds.py
Outdated
descriptions of content. | ||
Output is a "pandas.DataFrame" when "ghi" is a Series. | ||
Otherwise it is a dict of "numpy.ndarray" | ||
See Issue #2245 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Issue #2245 |
pvlib/bifacial/utils.py
Outdated
f_gnd_beam = np.where(solar_zenith > max_zenith, 0., f_gnd_beam) | ||
# [1], Eq. 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f_gnd_beam = np.where(solar_zenith > max_zenith, 0., f_gnd_beam) | |
# [1], Eq. 4 | |
# [1], Eq. 4 | |
f_gnd_beam = np.where(solar_zenith > max_zenith, 0., f_gnd_beam) |
@jason-rpkt I had to fix the merge conflict in whatsnew to start the CI jobs. You will need to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…ail syntax bug (pvlib#2359) * Issue pvlib#2245 Infinite sheds beam fraction on ground zenith guardrail syntax bug Set unshaded ground fraction to zero for solar_zenith> max_zenith * Issue pvlib#2245 - Linting/ PEP8 * Revert "Issue pvlib#2245 utils.py" This reverts commit 8b67a41. * Update from solar_zenith to ghi Update docs\sphinx\source\whatsnew\v0.11.3.rst * series input for ghi in test_infinite_sheds.py * Update docs/sphinx/source/whatsnew/v0.11.3.rst --------- Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Updates entries indocs/sphinx/source/reference
for API changes.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`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.