Skip to content

Commit 0b4df80

Browse files
authored
Merge branch 'main' into get_irrad_float
2 parents f15a289 + b9946b2 commit 0b4df80

File tree

16 files changed

+460
-81
lines changed

16 files changed

+460
-81
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update Top Ranked Issues
2+
3+
on:
4+
schedule:
5+
# Runs every day at 00:00 AM UTC
6+
- cron: '0 0 * * *'
7+
8+
jobs:
9+
run-script:
10+
runs-on: ubuntu-latest
11+
12+
# Run only if the repository is pvlib/pvlib-python
13+
if: ${{ github.repository == 'pvlib/pvlib-python' }}
14+
15+
env:
16+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
steps:
19+
- name: Check out the repository
20+
uses: actions/checkout@v4 # This ensures the repository code is available
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install PyGithub
31+
32+
- name: Run update_top_ranking_issues.py
33+
run: |
34+
python ./scripts/update_top_ranking_issues.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Contributing
8181
============
8282

8383
We need your help to make pvlib-python a great tool!
84-
Please see the [Contributing page](http://pvlib-python.readthedocs.io/en/stable/contributing.html) for more on how you can contribute.
84+
Please see the [Contributing page](https://pvlib-python.readthedocs.io/en/stable/contributing/index.html) for more on how you can contribute.
8585
The long-term success of pvlib-python requires substantial community support.
8686

8787

docs/sphinx/source/contributing/style_guide.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,81 @@ the ``docs/readthedocs.org:pvlib-python`` link within the checks
7070
status box at the bottom of the pull request.
7171

7272

73+
.. _references:
74+
75+
References
76+
----------
77+
pvlib-python is transitioning to the `IEEE reference style <https://journals.ieeeauthorcenter.ieee.org/wp-content/uploads/sites/7/IEEE_Reference_Guide.pdf>`_,
78+
which should be used in all new contributions. At minimum, a reference should
79+
include:
80+
81+
* Author list (for more than six authors, list only the first with et al.)
82+
* Publication title
83+
* Publisher (journal title, laboratory name, etc.)
84+
* Year of publication
85+
* DOI (if available)
86+
87+
The recommended citation style for several media types is as follows:
88+
89+
**Journal article**:
90+
91+
Author initials and surname, "Title of article," abbreviated journal
92+
title, vol. number, issue number, page numbers, Abbreviated Month Year.
93+
94+
**Book**:
95+
96+
Author initials. Author Surname, "Chapter title" in Book Title, xth ed.
97+
City of Publisher, (only U.S. State), Country: Abbrev. of Publisher, year,
98+
ch. x, sec. x, pp. xxx–xxx.
99+
100+
**Technical report**:
101+
102+
Author initials. Author Surname, "Report title" Abbrev. publisher name,
103+
City of publisher, Abbrev. State, Country, Rep. xxx, year
104+
105+
The example below shows how to cite material and generate a reference list
106+
using the IEEE style in a docstring::
107+
108+
This is the recommended citation for the pvlib-python project [1]_. There
109+
are also some conference papers linked to pvlib, for example [2]_.
110+
111+
Other types of reference you may find in the pvlib-python documentation
112+
include books [3]_, technical reports [4]_, and websites [5]_.
113+
114+
References
115+
----------
116+
.. [1] K. Anderson, C. Hansen, W. Holmgren, A. Jensen, M. Mikofski,
117+
and A Driesse. "pvlib python: 2023 project update." J. Open Source
118+
Softw. vol. 8, no. 92, pp. 5994, Dec 2023,
119+
:doi:`10.21105/joss.05994`.
120+
121+
.. [2] J. S. Stein, "The Photovoltaic Performance Modeling Collaborative
122+
(PVPMC)," In Proc. 38th IEEE Photovoltaic Specialists Conference
123+
(PVSC), Austin, TX, USA, 2012, pp. 3048-3052,
124+
:doi:`10.1109/PVSC.2012.6318225`.
125+
126+
.. [3] J. A. Duffie and W. A. Beckman, "Solar Radiation" in Solar
127+
Engineering of Thermal Processes, 3rd ed, New York, USA, J. Wiley
128+
and Sons, 2006, ch. 1, sec. 1.5, pp.9-11.
129+
130+
.. [4] R. Bird and C. Riordan, "Simple solar spectral model for direct and
131+
diffuse irradiance on horizontal and tilted planes at the earth’s
132+
surface for cloudless atmospheres", NREL, Golden, CO, USA, Technical
133+
Report TR-215-2436, 1984, :doi:`10.2172/5986936`.
134+
135+
.. [5] "PVPMC Home." Sandia National Laboratories PV Performance Modeling
136+
Collaborative. Accessed: Oct. 17, 2024. [Online.] Available:
137+
<https://pvpmc.sandia.gov/>_
138+
139+
Things to note:
140+
141+
* In-text numeric citations are a number inside square brackets, followed
142+
by an underscore, e.g. ``[1]_``.
143+
* To include a DOI, you can use pvlib's custom ``:doi:``
144+
`Sphinx role <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_,
145+
followed by the DOI inside a set of backticks.
146+
147+
73148
.. _building-the-documentation:
74149

75150
Building the documentation

docs/sphinx/source/contributing/testing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _testing:
22

3-
Testing
4-
=======
3+
Testing and benchmarking
4+
========================
55

66
.. _overview:
77

docs/sphinx/source/whatsnew/v0.11.2.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,22 @@ Bug Fixes
1616
* :py:meth:`~pvlib.pvsystem.PVSystem.get_irradiance` accepts float inputs.
1717
(:issue:`1338`, :pull:`2227`)
1818

19+
Bug fixes
20+
~~~~~~~~~
21+
* :py:func:`~pvlib.spa.julian_day_dt` now accounts for the 10 day difference
22+
between Julian and Gregorian calendars prior to the year 1582. (:issue:`2077`, :pull:`2249`)
23+
1924
Documentation
2025
~~~~~~~~~~~~~
2126
* Edited docstrings for :py:func:`~pvlib.pvsystem.dc_ohms_from_percent` and
2227
:py:func:`~pvlib.pvsystem.dc_ohmic_loss` for clarity. (:issue:`1601`, :pull:`2229`)
2328
* Clarified that :py:meth:`~pvlib.pvsystem.PVSystem.get_irradiance` and
2429
:py:meth:`~pvlib.pvsystem.Array.get_irradiance` do not accept tuple of float
2530
as input. (:pull:`2227`)
26-
31+
* Added a new citation style guide (:ref:`references`) to the contributing
32+
page. (:issue:`2202`, :pull:`2226`)
33+
* Updated :py:func:`~pvlib.irradiance.reindl` to include definitions of terms
34+
and a new "notes" section (:issue:`2183`, :pull:`2193`)
2735

2836
Testing
2937
~~~~~~~
@@ -33,7 +41,18 @@ Requirements
3341
~~~~~~~~~~~~
3442

3543

44+
Maintenance
45+
~~~~~~~~~~~
46+
* Added a decorator to deprecate renamed keyword arguments in functions,
47+
:py:func:`pvlib._deprecation.renamed_kwarg_warning`. (:pull:`2237`)
48+
49+
3650
Contributors
3751
~~~~~~~~~~~~
3852
* Cliff Hansen (:ghuser:`cwhanse`)
39-
53+
* Rajiv Daxini (:ghuser:`RDaxini`)
54+
* Dave Pitts (:ghuser:`dgapitts`)
55+
* Kurt Rhee (:ghuser:`kurt-rhee`)
56+
* Mark Mikofski (:ghuser:`mikofski`)
57+
* matsuobasho (:ghuser:`matsuobasho`)
58+
* Echedey Luis (:ghuser:`echedey-ls`)

pvlib/_deprecation.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,76 @@ def wrapper(*args, **kwargs):
316316
return finalize(wrapper, new_doc)
317317

318318
return deprecate
319+
320+
321+
def renamed_kwarg_warning(since, old_param_name, new_param_name, removal=""):
322+
"""
323+
Decorator to mark a possible keyword argument as deprecated and replaced
324+
with other name.
325+
326+
Raises a warning when the deprecated argument is used, and replaces the
327+
call with the new argument name. Does not modify the function signature.
328+
329+
.. warning::
330+
Ensure ``removal`` date with a ``fail_on_pvlib_version`` decorator in
331+
the test suite.
332+
333+
.. note::
334+
Not compatible with positional-only arguments.
335+
336+
.. note::
337+
Documentation for the function may updated to reflect the new parameter
338+
name; it is suggested to add a |.. versionchanged::| directive.
339+
340+
Parameters
341+
----------
342+
since : str
343+
The release at which this API became deprecated.
344+
old_param_name : str
345+
The name of the deprecated parameter.
346+
new_param_name : str
347+
The name of the new parameter.
348+
removal : str, optional
349+
The expected removal version, in order to compose the Warning message.
350+
351+
Examples
352+
--------
353+
>>> @renamed_kwarg_warning("1.4.0", "old_name", "new_name", "1.6.0")
354+
>>> def some_function(new_name=None):
355+
>>> pass
356+
>>> some_function(old_name=1)
357+
Parameter 'old_name' has been renamed since 1.4.0. and
358+
will be removed in 1.6.0. Please use 'new_name' instead.
359+
360+
>>> @renamed_kwarg_warning("1.4.0", "old_name", "new_name")
361+
>>> def some_function(new_name=None):
362+
>>> pass
363+
>>> some_function(old_name=1)
364+
Parameter 'old_name' has been renamed since 1.4.0. and
365+
will be removed soon. Please use 'new_name' instead.
366+
"""
367+
368+
def deprecate(func, old=old_param_name, new=new_param_name, since=since):
369+
def wrapper(*args, **kwargs):
370+
if old in kwargs:
371+
if new in kwargs:
372+
raise ValueError(
373+
f"{func.__name__} received both '{old}' and '{new}', "
374+
"which are mutually exclusive since they refer to the "
375+
f"same parameter. Please remove deprecated '{old}'."
376+
)
377+
warnings.warn(
378+
f"Parameter '{old}' has been renamed since {since}. "
379+
f"and will be removed "
380+
+ (f"in {removal}" if removal else "soon")
381+
+ f". Please use '{new}' instead.",
382+
_projectWarning,
383+
stacklevel=2,
384+
)
385+
kwargs[new] = kwargs.pop(old)
386+
return func(*args, **kwargs)
387+
388+
wrapper = functools.wraps(func)(wrapper)
389+
return wrapper
390+
391+
return deprecate
-231 KB
Binary file not shown.

pvlib/data/variables_style_rules.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ghi;global horizontal irradiance
1111
ghi_extra;horizontal irradiance at top of atmosphere (extraterrestrial)
1212
gri;ground-reflected irradiance
1313
ape;average photon energy
14-
aoi;angle of incidence between :math:`90\deg` and :math:`90\deg`
14+
aoi;angle of incidence. Angle between the surface normal vector and the vector pointing towards the sun's center
1515
aoi_projection;cos(aoi)
1616
airmass;airmass
1717
airmass_relative;relative airmass

pvlib/iam.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ def martin_ruiz(aoi, a_r=0.16):
269269
270270
which is presented as :math:`AL(\alpha) = 1 - IAM` in equation 4 of [1]_,
271271
with :math:`\alpha` representing the angle of incidence AOI. Thus IAM = 1
272-
at AOI = 0, and IAM = 0 at AOI = 90. This equation is only valid for
273-
-90 <= aoi <= 90, therefore `iam` is constrained to 0.0 outside this
272+
at AOI = 0°, and IAM = 0 at AOI = 90°. This equation is only valid for
273+
<= aoi <= 90°, therefore `iam` is constrained to 0.0 outside this
274274
interval.
275275
276276
References
@@ -891,8 +891,8 @@ def schlick_diffuse(surface_tilt):
891891
implements only the integrated Schlick approximation.
892892
893893
Note also that the output of this function (which is an exact integration)
894-
can be compared with the output of :py:func:`marion_diffuse` which numerically
895-
integrates the Schlick approximation:
894+
can be compared with the output of :py:func:`marion_diffuse` which
895+
numerically integrates the Schlick approximation:
896896
897897
.. code::
898898

pvlib/irradiance.py

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -871,19 +871,14 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
871871
def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
872872
solar_zenith, solar_azimuth):
873873
r'''
874-
Determine diffuse irradiance from the sky on a tilted surface using
875-
Reindl's 1990 model
876-
877-
.. math::
874+
Determine the diffuse irradiance from the sky on a tilted surface using
875+
the Reindl (1990) model.
878876
879-
I_{d} = DHI \left(A R_b + (1 - A) \left(\frac{1 + \cos\beta}{2}\right)
880-
\left(1 + \sqrt{\frac{I_{hb}}{I_h}} \sin^3(\beta/2)\right) \right)
881-
882-
Reindl's 1990 model determines the diffuse irradiance from the sky
883-
(ground reflected irradiance is not included in this algorithm) on a
884-
tilted surface using the surface tilt angle, surface azimuth angle,
877+
The Reindl (1990) model [1]_ [2]_ determines the diffuse irradiance from
878+
the sky on
879+
a tilted surface using the surface tilt angle, surface azimuth angle,
885880
diffuse horizontal irradiance, direct normal irradiance, global
886-
horizontal irradiance, extraterrestrial irradiance, sun zenith
881+
horizontal irradiance, extraterrestrial normal irradiance, sun zenith
887882
angle, and sun azimuth angle.
888883
889884
Parameters
@@ -905,7 +900,7 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
905900
direct normal irradiance. [Wm⁻²]
906901
907902
ghi: numeric
908-
Global irradiance. [Wm⁻²]
903+
Global horizontal irradiance. [Wm⁻²]
909904
910905
dni_extra : numeric
911906
Extraterrestrial normal irradiance. [Wm⁻²]
@@ -925,23 +920,41 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
925920
926921
Notes
927922
-----
928-
The poa_sky_diffuse calculation is generated from the Loutzenhiser et al.
929-
(2007) paper, equation 8. Note that I have removed the beam and ground
930-
reflectance portion of the equation and this generates ONLY the diffuse
931-
radiation from the sky and circumsolar, so the form of the equation
932-
varies slightly from equation 8.
923+
The Reindl (1990) model for the sky diffuse irradiance,
924+
:math:`I_d`, is as follows:
925+
926+
.. math::
927+
928+
I_{d} = DHI \left(A \cdot R_b + (1 - A)
929+
\left(\frac{1 + \cos\beta}{2}\right)
930+
\left(1 + \sqrt{\frac{BHI}{GHI}} \sin^3(\beta/2)\right) \right).
931+
932+
:math:`DHI`, :math:`BHI`, and :math:`GHI` are the diffuse horizontal, beam
933+
(direct) horizontal and global horizontal irradiances, respectively.
934+
:math:`A` is the anisotropy index, which is the ratio of the direct normal
935+
irradiance to the direct extraterrestrial irradiation, :math:`R_b` is the
936+
projection ratio, which is defined as the ratio of the cosine of the angle
937+
of incidence (AOI) to the cosine of the zenith angle, and :math:`\beta`
938+
is the tilt angle of the array.
939+
940+
Implementation is based on Loutzenhiser et al.
941+
(2007) [3]_, Equation 8. The beam and ground reflectance portion of the
942+
equation have been removed, therefore the model described here generates
943+
ONLY the diffuse radiation from the sky and circumsolar, so the form of the
944+
equation varies slightly from Equation 8 in [3]_.
933945
934946
References
935947
----------
936-
.. [1] Loutzenhiser P.G. et. al. "Empirical validation of models to
937-
compute solar irradiance on inclined surfaces for building energy
938-
simulation" 2007, Solar Energy vol. 81. pp. 254-267
939-
940-
.. [2] Reindl, D.T., Beckmann, W.A., Duffie, J.A., 1990a. Diffuse
948+
.. [1] Reindl, D. T., Beckmann, W. A., Duffie, J. A., 1990a. Diffuse
941949
fraction correlations. Solar Energy 45(1), 1-7.
942-
943-
.. [3] Reindl, D.T., Beckmann, W.A., Duffie, J.A., 1990b. Evaluation of
950+
:doi:`10.1016/0038-092X(90)90060-P`
951+
.. [2] Reindl, D. T., Beckmann, W. A., Duffie, J. A., 1990b. Evaluation of
944952
hourly tilted surface radiation models. Solar Energy 45(1), 9-17.
953+
:doi:`10.1016/0038-092X(90)90061-G`
954+
.. [3] Loutzenhiser P. G. et. al., 2007. Empirical validation of models to
955+
compute solar irradiance on inclined surfaces for building energy
956+
simulation. Solar Energy 81(2), 254-267
957+
:doi:`10.1016/j.solener.2006.03.009`
945958
'''
946959

947960
cos_tt = aoi_projection(surface_tilt, surface_azimuth,

0 commit comments

Comments
 (0)