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 53 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.

@cwhanse cwhanse added enhancement New feature or request feature labels Apr 18, 2024
@cwhanse cwhanse modified the milestones: v0.2.0, v0.2.1 Apr 18, 2024
docs/api.rst Show resolved Hide resolved
@cwhanse cwhanse changed the title WIP: code and example for classifying snow effects Code and example for classifying snow effects May 16, 2024
@cwhanse
Copy link
Member Author

cwhanse commented May 16, 2024

@kandersolar @kperrynrel I think we're far enough along for a first review, if you have time and interest.

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.

This is a rather large PR! Here is a partial review of just the gallery example, for now.

Comment on lines 94 to 96
print(f"There are {num_str_per_cb} modules connected in series in each string,"
f" and there are {num_mods_per_str} strings connected in"
f" parallel at each combiner")
Copy link
Member

Choose a reason for hiding this comment

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

The positions of these interpolated variables need to be swapped with each other, I think.

Comment on lines 126 to 132
data.loc[:, dc_voltage_cols] = np.maximum(data[dc_voltage_cols], 0)
data.loc[:, dc_current_cols] = np.maximum(data[dc_current_cols], 0)
data.loc[:, ac_power_cols] = np.maximum(data[ac_power_cols], 0)

data[dc_voltage_cols] = data[dc_voltage_cols].replace({np.nan: 0, None: 0})
data[dc_current_cols] = data[dc_current_cols].replace({np.nan: 0, None: 0})
data.loc[:, ac_power_cols] = data[ac_power_cols].replace({np.nan: 0, None: 0})
Copy link
Member

Choose a reason for hiding this comment

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

I think all four of these .loc[:, ] are unnecessary. I suggest also just using .fillna(0) instead of replace(). It should work on both None and nan.

print('End: {}'.format(data.index[-1]))
print('Frequency: {}'.format(data.index.inferred_freq))
print('Columns : ' + ', '.join(data.columns))
data.between_time('8:00', '16:00').head()
Copy link
Member

Choose a reason for hiding this comment

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

This line doesn't have any effect

# Plot DC voltage for each combiner input relative to inverter nameplate
# limits

fig, ax = plt.subplots(figsize=(10, 10))
Copy link
Member

Choose a reason for hiding this comment

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

I think these 10x10 figures throughout this file are a bit taller than they need to be. Maybe 6 or 7 instead of 10? fig.tight_layout() would help too.


# %%
# Plot DC voltage for each combiner input relative to inverter nameplate
# limits
Copy link
Member

Choose a reason for hiding this comment

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

Some explanation of why we are doing this would be helpful. Are we searching for values outside the inverter MPPT range? Why are those worth looking for? And same for the power plot -- what is it supposed to be telling us?

Copy link

Choose a reason for hiding this comment

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

Added some explanation - we're looking for DC voltages below the inverter's turn-on voltage because these values are recorded outside of MPP operating conditions, and therefore cannot be used in an apples-to-apples comparison with modeled MPP voltage. Similar deal with AC power, except we're looking for periods of clipping. These get put in the Mode -1 bucket later.

Comment on lines 216 to 217

# We want to exclude periods where array voltage is affected by horizon
Copy link
Member

Choose a reason for hiding this comment

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

Remove this blank line for the text to be rendered as text instead of a code comment block

fig, ax = plt.subplots()
ax.scatter(data['azimuth'], data['elevation'], s=0.5, label='data',
c=data['Horizon Mask'])
ax.scatter(horizon.index, horizon, s=0.5, label='mask')
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, does this location's horizon profile really look like this in real life? The portion under the solar elevation curve seems unnatural to me. Or is it just an artifact of how the horizon profile is estimated?

image

Copy link

Choose a reason for hiding this comment

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

I think that this is an artifact of how the horizon profile is estimated - as there is no data below the solar elevation curve, there is no way to determine what the horizon actually looks like in this region.

ax.legend(loc='lower left')
plt.show()

# %% Plot AC power relative to inverter nameplate limits
Copy link
Member

Choose a reason for hiding this comment

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

Looks like text on the same line as # %% doesn't get rendered in the HTML. Better to move the text to the next line. Note that there are several instances of this to fix in this file.

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