Skip to content
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

Code and example for classifying snow effects #209

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

Conversation

cwhanse
Copy link
Member

@cwhanse cwhanse commented Apr 8, 2024

  • Closes Quantify power losses due to snow cover #200
  • Added tests to cover all new or modified code.
  • Clearly documented all new API functions with PEP257 and numpydoc compliant docstrings.
  • Added new API functions to docs/api.rst.
  • Non-API functions clearly documented with docstrings or comments as necessary.
  • Adds description and name entries in the appropriate "what's new" file
    in docs/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`).
  • 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.

Copy link
Member

@kandersolar kandersolar left a comment

Choose a reason for hiding this comment

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

Here's a review of the new functions. FYI I anticipate at least one more round of review after this one is done.

docs/api.rst Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Outdated Show resolved Hide resolved
pvanalytics/features/snow.py Show resolved Hide resolved
pvanalytics/features/snow.py Show resolved Hide resolved
Copy link
Member

@kandersolar kandersolar left a comment

Choose a reason for hiding this comment

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

Another partial review. High-level thoughts:

  • The gallery example does too much. Simpler would be better. I think reducing it to a single inverter, or even a single combiner box, would be an improvement. I also think getting rid of unnecessary steps (e.g. horizon, SDM) would help.
  • I am a little uncomfortable with the functions being only loosely tied to the reference (at least by pvlib-python standards). The code both extends the reference (e.g. adding a new mode) and fills in many gaps where the reference doesn't give specifics. It seems that these changes are necessary, so maybe all we can do is document the differences.

docs/whatsnew/0.2.1.rst Outdated Show resolved Hide resolved
docs/whatsnew/0.2.1.rst Show resolved Hide resolved
docs/examples/snow-detection/snow-mode.py Outdated Show resolved Hide resolved
Comment on lines 217 to 218
data['Horizon Mask'] = snow._get_horizon_mask(horizon, data['azimuth'],
data['elevation'])
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this function should live in pvanalytics.snow, and I'm not sure it needs to be in pvanalytics at all. If the horizon filter is retained, should this function be converted to a helper function here in the script?

Comment on lines +98 to +101
.. [1] C. F. Abe, J. B. Dias, G. Notton, G. A. Faggianelli, G. Pigelet, and
D. Ouvrard, David, "Estimation of the effective irradiance and bifacial
gain for PV arrays using the maximum power current", IEEE Journal of
Photovoltaics, 2022, pp. 432-441. :doi:`10.1109/JPHOTOV.2023.3242117`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. [1] C. F. Abe, J. B. Dias, G. Notton, G. A. Faggianelli, G. Pigelet, and
D. Ouvrard, David, "Estimation of the effective irradiance and bifacial
gain for PV arrays using the maximum power current", IEEE Journal of
Photovoltaics, 2022, pp. 432-441. :doi:`10.1109/JPHOTOV.2023.3242117`
.. [1] C. F. Abe, J. B. Dias, G. Notton, G. A. Faggianelli, G. Pigelet,
and D. Ouvrard, "Estimation of the effective irradiance and bifacial
gain for PV arrays using the maximum power current", IEEE Journal of
Photovoltaics, 2022, pp. 432-441. :doi:`10.1109/JPHOTOV.2023.3242117`

Something weird is happening with the rendering here. I am guessing sphinx is interpreting the leading C. and D. as indicating an enumerated list. I'm not sure, but I think this tweak (not having D. at the start of the second line) might get sphinx to render it as intended.

data['Module Temp [C]'], data['POA [W/m²]'], 3)

# %%
# Plot cell temperature
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this plot adds much. I would remove it, again to simplify things.

Comment on lines 331 to 332
# Approach 2 %TODO not sure we need this
# Code borrowed from pvlib-python/docs/examples/iv-modeling/plot_singlediode.py
Copy link
Member

Choose a reason for hiding this comment

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

Again for simplification, I suggest calculating voltage only one way. The other way could be briefly mentioned as an alternative.

# %%
# Function to do analysis so we can loop over combiner boxes

def wrapper(voltage, current, temp_cell, effective_irradiance,
Copy link
Member

Choose a reason for hiding this comment

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

wrapper is not a very informative name. get_snow_mode, perhaps?

Comment on lines +427 to +428
Keys are ``'transmission'``, ``'modeled_vmp'``, ``'vmp_ratio'``,
and ``'mode'``
Copy link
Member

Choose a reason for hiding this comment

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

These keys need to be updated according to what the function actually returns

Copy link
Member

Choose a reason for hiding this comment

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

Also, maybe return a dataframe instead of a dict?


# %%
# Demonstrate transmission, modeled voltage calculation and mode categorization
# on voltage, current pair
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this cell is necessary; it's just a copy of the body of the for loop in the next cell.

cwhanse and others added 3 commits September 27, 2024 12:16
@cwhanse
Copy link
Member Author

cwhanse commented Sep 27, 2024

Another partial review. High-level thoughts:

  • The gallery example does too much. Simpler would be better.

Thanks for this. I needed an outside perspective, and I will overhaul the example to handle data from a single combiner.

  • I am a little uncomfortable with the functions being only loosely tied to the reference (at least by pvlib-python standards). The code both extends the reference (e.g. adding a new mode) and fills in many gaps where the reference doesn't give specifics. It seems that these changes are necessary, so maybe all we can do is document the differences.

Agreed, but I'm not sure there's an option besides document here, or abandon the PR. A revised reference paper is very unlikely.

@kandersolar
Copy link
Member

Test failure is in test_daytime.py; not caused by this PR. See pvlib/pvlib-python#2238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quantify power losses due to snow cover
3 participants