Convert irradiance.liujordan to irradiance.campbell_norman#1104
Convert irradiance.liujordan to irradiance.campbell_norman#1104wholmgren merged 10 commits intopvlib:masterfrom
Conversation
wholmgren
left a comment
There was a problem hiding this comment.
also need to deprecate
ForecastModel.cloud_cover_to_irradiance_liujordanand replace withForecastModel.cloud_cover_to_irradiance_campbell_norman- the
'liujordan'option inForecastModel.cloud_cover_to_irradiance.
pvlib/irradiance.py
Outdated
| return data | ||
|
|
||
|
|
||
| def campbellnorman(zenith, transmittance, pressure=101325.0, dni_extra=1367.0): |
There was a problem hiding this comment.
Mild preference for campbell_norman.
pvlib/irradiance.py
Outdated
| dhi = 0.3 * (1.0 - tau**airmass) * dni_extra * np.cos(np.radians(zenith)) | ||
| ghi = dhi + dni * np.cos(np.radians(zenith)) |
There was a problem hiding this comment.
| dhi = 0.3 * (1.0 - tau**airmass) * dni_extra * np.cos(np.radians(zenith)) | |
| ghi = dhi + dni * np.cos(np.radians(zenith)) | |
| cos_zen = np.cos(np.radians(zenith)) | |
| dhi = 0.3 * (1.0 - tau**airmass) * dni_extra * cos_zen | |
| ghi = dhi + dni * cos_zen |
| @@ -295,6 +296,17 @@ def test_liujordan(): | |||
| assert_frame_equal(out, expected) | |||
There was a problem hiding this comment.
This test is going to emit a deprecation warning and we want to avoid that. We could delete it or we could skip the new test_deprecated_09 test, add @fail_on_pvlib_version('0.9') around this test, and add the with pytest.warns... here
There was a problem hiding this comment.
I prefer the option after "or"
pvlib/irradiance.py
Outdated
|
|
||
|
|
||
| liujordan = deprecated('0.8', alternative='campbellnormam', | ||
| name='liujordan', removal='0.9')(liujordan) |
There was a problem hiding this comment.
I don't think there's anything wrong with this, but it might be a little more clear if we change the function definition to _liujordan so that readers of the code cannot miss the deprecation wrapper.
There was a problem hiding this comment.
Not needed if the deprecation warning and @fail_on_pvlib_version('0.9') are made part of the old test_liujordan, right?
There was a problem hiding this comment.
My concern is just that we're redefining what liujordan points to (first it points to the original function, then we redefine it to point to a function that wraps the original function). There's no practical difference for a user of the public API, but a reader of the source code could miss the redefinition of liujordan.
def _liujordan(...)
# the original docstring and code
liujordan = deprecated(...)(_liujordan)It's minor and I'm fine to leave it as is.
The tests as written in the latest commit (b2ba8a6) should continue to work without modification.
There was a problem hiding this comment.
remove irradiance.liujordan from api.rst?
| Deprecations | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| * :py:func:`pvlib.irradiance.liujordan` is deprecated. |
There was a problem hiding this comment.
these links will break and cause documentation build warnings when we remove the function, so I'd rather use double ticks now
| Deprecations | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| * :py:func:`pvlib.irradiance.liujordan` is deprecated. |
There was a problem hiding this comment.
| * :py:func:`pvlib.irradiance.liujordan` is deprecated. | |
| * ``pvlib.irradiance.liujordan`` is deprecated. |
|
test failures related to |
|
@wholmgren do you think it is worthwhile / necessary to add tests for forecast.cloud_cover_to_irradiance_how for how='campbell_norman' and 'liujordan'? The latter would only be a deprecation test. It looks like it would take a bit of work to assemble the test input. |
|
not necessary |
|
test failures are get_psm3. coverage decreases because we're not testing the deprecated forecast method. I didn't remove the deprecated method. |
correct misspelling Co-authored-by: Will Holmgren <william.holmgren@gmail.com>
|
FYI looks like this introduced a docs build warning in |
docs/sphinx/source/api.rstfor API changes.docs/sphinx/source/whatsnewfor 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`).Replaces
irradiance.liujordanwithirradiance.campbellnorman.liujordanis deprecated.