Skip to content

Fixed errors in soiling.hsu function and tests #977

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 5 commits into from
Jun 11, 2020
Merged

Conversation

jsstein
Copy link
Contributor

@jsstein jsstein commented Jun 9, 2020

  • Closes pvlib.soiling.hsu model implementation errors #970
  • I am familiar with the contributing guidelines
  • Tests added
  • [n/a] Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate "what's new" file in 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 compliant docstrings, examples, and comments where necessary.
  • 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 the bug label Jun 10, 2020
@cwhanse cwhanse added this to the 0.8.0 milestone Jun 10, 2020
Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

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

Looks like mostly formatting corrections, click through the stickler-ci details in the list of checks. Do you want me to get a copy of the reference paper and double check the default values?

@wholmgren
Copy link
Member

E203 can be ignored in the test suite as far as I'm concerned.

@jsstein
Copy link
Contributor Author

jsstein commented Jun 11, 2020

I think I have addressed most of the the stickler-ci details (except for the E203 ones which add readability). I pushed the changes.

@jsstein
Copy link
Contributor Author

jsstein commented Jun 11, 2020 via email

@cwhanse cwhanse merged commit e22c085 into pvlib:master Jun 11, 2020
@cwhanse
Copy link
Member

cwhanse commented Jun 11, 2020

Thanks @jsstein

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.

A couple comments (sorry for the post-merge review)

@@ -11,6 +11,7 @@ Enhancements

Bug fixes
~~~~~~~~~
* Fixed unit and default value errors in :py:func:`pvlib.soiling.hsu`. (:pull:`XXX`)
Copy link
Member

Choose a reason for hiding this comment

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

Missed the PR number in the whatsnew entry

Copy link
Member

@cwhanse cwhanse Jun 11, 2020

Choose a reason for hiding this comment

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

I merged too early, thanks for taking a careful look

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just submitted PR980 that addresses @kanderso-nrel 's comment about arbitrary time intervals. Next I will submit a demonstration of the hsu function showing that it matches one of the figures in the original JPV paper.


# accumulate rainfall into periods for comparison with threshold
accum_rain = rainfall.rolling(rain_accum_period, closed='right').sum()
# cleaning is True for intervals with rainfall greater than threshold
cleaning_times = accum_rain.index[accum_rain >= cleaning_threshold]

horiz_mass_rate = pm2_5 * depo_veloc['2_5']\
+ np.maximum(pm10 - pm2_5, 0.) * depo_veloc['10']
+ np.maximum(pm10 - pm2_5, 0.) * depo_veloc['10'] * 3600
Copy link
Member

Choose a reason for hiding this comment

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

Sorry if I'm thinking about this wrong, but I want to raise two points about this calculation:

  • Is it correct to hardcode the 3600? Shouldn't it be based on the datetime index's interval? I'm not seeing any documentation requiring the input timeseries to be hourly.
  • Regardless of whatever value that timescale coefficient takes, shouldn't it apply to both particulate sizes? Right now it only affects pm10.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kanderson-nrel: I agree that I should take another look at the hardcoding of 3600. About your second point, let me look more carefully at the Matlab version and see how it deals with it.

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

Successfully merging this pull request may close these issues.

pvlib.soiling.hsu model implementation errors
4 participants