-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add hsu soiling model gallery example. #990
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6af3473
Adding hsu soiling model example. Closes #989
jsstein 3a74e84
Added figure from paper to compare
jsstein f368dcb
formatting
jsstein 54ed79b
formatting
jsstein 252c383
added PR# to .rst file
jsstein 03c24d5
fixed y-axis label
jsstein 83b22fc
formatting reference
jsstein 1a45cb3
formatting
jsstein 3950fcc
Merge remote-tracking branch 'upstream/master' into pr/990
kandersolar 0ecbb31
move png to _images
kandersolar 2527deb
gallery example cleanup
kandersolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
""" | ||
HSU Soiling Model Example | ||
========================= | ||
|
||
Example of soiling using the HSU model. | ||
""" | ||
|
||
# %% | ||
# This example shows basic usage of pvlib's HSU Soiling model [1]_ with | ||
# :py:func:`pvlib.soiling.hsu`. | ||
# | ||
# References | ||
# ----------- | ||
# .. [1] M. Coello and L. Boyle, "Simple Model For Predicting Time Series | ||
# Soiling of Photovoltaic Panels," in IEEE Journal of Photovoltaics. | ||
# doi: 10.1109/JPHOTOV.2019.2919628 | ||
# | ||
# This example recreates figure 3A in [1]_ for the Fixed Settling | ||
# Velocity case. | ||
# Rainfall data comes from Imperial County, CA TMY3 file | ||
# PM2.5 and PM10 data come from the EPA. First, let's read in the | ||
# weather data and run the HSU soiling model: | ||
|
||
import pathlib | ||
from matplotlib import pyplot as plt | ||
from pvlib import soiling | ||
import pvlib | ||
import pandas as pd | ||
|
||
# get full path to the data directory | ||
DATA_DIR = pathlib.Path(pvlib.__file__).parent / 'data' | ||
|
||
# read rainfall, PM2.5, and PM10 data from file | ||
imperial_county = pd.read_csv(DATA_DIR / 'soiling_hsu_example_inputs.csv', | ||
index_col=0, parse_dates=True) | ||
rainfall = imperial_county['rain'] | ||
depo_veloc = {'2_5': 0.0009, '10': 0.004} # default values from [1] (m/s) | ||
rain_accum_period = pd.Timedelta('1h') # default | ||
cleaning_threshold = 0.5 | ||
tilt = 30 | ||
pm2_5 = imperial_county['PM2_5'].values | ||
pm10 = imperial_county['PM10'].values | ||
# run the hsu soiling model | ||
soiling_ratio = soiling.hsu(rainfall, cleaning_threshold, tilt, pm2_5, pm10, | ||
depo_veloc=depo_veloc, | ||
rain_accum_period=rain_accum_period) | ||
|
||
# %% | ||
# And now we'll plot the modeled daily soiling ratios and compare | ||
# with Coello and Boyle Fig 3A: | ||
|
||
daily_soiling_ratio = soiling_ratio.resample('d').mean() | ||
fig, ax1 = plt.subplots(figsize=(8, 2)) | ||
ax1.plot(daily_soiling_ratio.index, daily_soiling_ratio, marker='.', | ||
c='r', label='hsu function output') | ||
ax1.set_ylabel('Daily Soiling Ratio') | ||
ax1.set_ylim(0.79, 1.01) | ||
ax1.set_title('Imperial County TMY') | ||
ax1.legend(loc='center left') | ||
|
||
daily_rain = rainfall.resample('d').sum() | ||
ax2 = ax1.twinx() | ||
ax2.plot(daily_rain.index, daily_rain, marker='.', | ||
c='c', label='daily rainfall') | ||
ax2.set_ylabel('Daily Rain (mm)') | ||
ax2.set_ylim(-10, 210) | ||
ax2.legend(loc='center right') | ||
fig.tight_layout() | ||
fig.show() | ||
|
||
# %% | ||
# Here is the original figure from [1]_ for comparison: | ||
# | ||
# .. image:: ../_images/Coello_Boyle_2019_Fig3.png | ||
# :alt: Figure 3A from the paper showing a simulated soiling signal. | ||
# | ||
# Note that this figure shows additional timeseries not calculated here: | ||
# modeled soiling ratio using the 2015 PRISM rainfall dataset (orange) | ||
# and measured soiling ratio (dashed green). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.