Skip to content

Commit 369cb0c

Browse files
authored
Merge branch 'main' into detect_clearsky_errors
2 parents 3abe369 + a6995c3 commit 369cb0c

File tree

15 files changed

+385
-109
lines changed

15 files changed

+385
-109
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,21 @@ jobs:
3333
- name: Build packages
3434
run: python -m build
3535

36+
- name: List distribution file sizes
37+
run: du -h dist/*
38+
3639
- name: Check metadata verification
3740
run: python -m twine check --strict dist/*
3841

42+
- name: Ensure that the wheel installs successfully
43+
run: |
44+
mkdir ./tmp
45+
pip install $(find dist -type f -name "*.whl") --target=./tmp
46+
47+
- name: List installed file sizes
48+
run: du -h pvlib
49+
working-directory: ./tmp
50+
3951
# only publish distribution to PyPI for tagged commits
4052
- name: Publish distribution to PyPI
4153
if: startsWith(github.ref, 'refs/tags/v')
203 KB
Loading

docs/sphinx/source/contributing/style_guide.rst

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pvlib python generally follows the `PEP 8 -- Style Guide for Python Code
1313
is 79 characters.
1414

1515
pvlib python uses a mix of full and abbreviated variable names. See
16-
:ref:`variables_style_rules`. We could be better about consistency.
16+
:ref:`nomenclature`.
1717
Prefer full names for new contributions. This is especially important
1818
for the API. Abbreviations can be used within a function to improve the
1919
readability of formulae.
@@ -163,7 +163,7 @@ An easy way to do this is with::
163163

164164
Note: Anaconda users may have trouble using the above command to update an
165165
older version of docutils. If that happens, you can update it with ``conda``
166-
(e.g. ``conda install docutils=0.15.2``) and run the above command again.
166+
(e.g. ``conda install docutils=0.21``) and run the above command again.
167167

168168
Once the ``doc`` dependencies are installed, navigate to ``/docs/sphinx`` and
169169
execute::
@@ -182,6 +182,116 @@ Note that Windows users need not have the ``make`` utility installed as pvlib
182182
includes a ``make.bat`` batch file that emulates its interface.
183183

184184

185+
.. _example-docstring:
186+
187+
Example Docstring
188+
-----------------
189+
190+
Here is a template for a function docstring that encapsulates the main
191+
features that may be used in any docstring. Note that not all sections are
192+
required for every function.
193+
194+
.. code-block:: python
195+
196+
def example_function(poa_global, exponents, degree_symbol, time_ref='UT',
197+
optional_arg=None):
198+
r"""
199+
One-sentence summary of the function (no citations).
200+
201+
A longer description of the function. This can include citations
202+
(references) to literature [1]_, websites [2]_, and other code elements
203+
such as functions (:py:func:`pvlib.location.lookup_altitude`) and
204+
classes (:py:class:`pvlib.location.Location`).
205+
206+
.. versionadded:: 0.0.1
207+
There are many more purpose-specific directives, admonitions and such
208+
available at `this link <admonitions>`_. E.g.: ``.. versionchanged::``,
209+
``.. deprecated::``, ``.. note::`` and ``.. warning::``.
210+
211+
.. _admonitions: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#admonitions-messages-and-warnings
212+
213+
Parameters
214+
----------
215+
poa_global : numeric
216+
Plane-of-array global irradiance, see :term:`poa_global`. [Wm⁻²].
217+
exponents : array-like
218+
A list of exponents. [x⁰¹²³⁴⁵⁶⁷⁸⁹⁻].
219+
degree_symbol : pandas.Series or pandas.DataFrame
220+
It's different from superscript zero. [°].
221+
time_ref : ``'UT'`` or ``'TST'``, default: ``'UT'``
222+
``'UT'`` (universal time) or ``'TST'`` (True Solar Time).
223+
optional_arg : integer, optional
224+
A description of ``optional_arg``. [Unitless].
225+
226+
Specify a suitable datatype for each parameter. Other common
227+
data types include ``str``, ``bool``, ``float``, ``numeric``
228+
and ``pandas.DatetimeIndex``.
229+
230+
Returns
231+
-------
232+
name : numeric
233+
A description of the return value.
234+
235+
Raises
236+
------
237+
ValueError
238+
If ``poa_global`` is negative.
239+
KeyError
240+
If ``time_ref`` does not exist.
241+
242+
Notes
243+
-----
244+
This section can include additional information about the function.
245+
246+
For example, an equation using LaTeX markup:
247+
248+
.. math::
249+
250+
a = \left(\frac{b}{c}\right)^2
251+
252+
where :math:`a` is the result of the equation, and :math:`b` and :math:`c`
253+
are inputs.
254+
255+
Or a figure with a caption:
256+
257+
.. figure:: ../../_images/pvlib_logo_horiz.png
258+
:scale: 10%
259+
:alt: alternate text
260+
:align: center
261+
262+
Figure caption.
263+
264+
See Also
265+
--------
266+
pvlib.location.lookup_altitude, pvlib.location.Location
267+
268+
Examples
269+
--------
270+
>>> example_function(1, 1, pd.Series([1]), "TST", 2)
271+
'Something'
272+
273+
References
274+
----------
275+
A IEEE citation to a relevant reference. You may use an automatic
276+
citation generator to format the citation correctly.
277+
278+
.. [1] Anderson, K., Hansen, C., Holmgren, W., Jensen, A., Mikofski, M.,
279+
and Driesse, A. "pvlib python: 2023 project update." Journal of Open
280+
Source Software, 8(92), 5994, (2023). :doi:`10.21105/joss.05994`.
281+
.. [2] J. Smith and J. Doe. "Obama inaugurated as President." CNN.com.
282+
Accessed: Feb. 1, 2009. [Online.]
283+
Available: http://www.cnn.com/POLITICS/01/21/obama_inaugurated/index.html
284+
"""
285+
a = "Some"
286+
b = "thing"
287+
return a + b
288+
289+
A preview of how this docstring would render in the documentation can be seen in the
290+
following file: :download:`Example docstring<../_images/example_function_screenshot.png>`.
291+
292+
Remember that to show the docstring in the documentation, you must list
293+
the function in the appropriate ``.rst`` file in the ``docs/sphinx/source/reference`` folder.
294+
185295
.. _example-gallery:
186296

187297
Example Gallery

docs/sphinx/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pvlib python
2626
that-use-pvlib-python>`_ page for inspiration and listing of your
2727
application.
2828

29-
There is a :ref:`variable naming convention <variables_style_rules>` to
29+
There is a :ref:`variable naming convention <nomenclature>` to
3030
ensure consistency throughout the library.
3131

3232

docs/sphinx/source/user_guide/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ User Guide
1515
clearsky
1616
bifacial
1717
weather_data
18-
variables_style_rules
1918
singlediode
19+
nomenclature
2020
faq
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
.. _nomenclature:
2+
3+
Nomenclature
4+
============
5+
6+
There is a convention on consistent variable names throughout the library:
7+
8+
.. glossary::
9+
10+
airmass
11+
Airmass
12+
13+
airmass_absolute
14+
Absolute airmass
15+
16+
airmass_relative
17+
Relative airmass
18+
19+
albedo
20+
Ratio of reflected solar irradiance to global horizontal irradiance
21+
[unitless]
22+
23+
aoi
24+
Angle of incidence. Angle between the surface normal vector and the
25+
vector pointing towards the sun’s center
26+
27+
aoi_projection
28+
cos(aoi)
29+
30+
ape
31+
Average photon energy
32+
33+
apparent_zenith
34+
Refraction-corrected solar zenith angle in degrees
35+
36+
bhi
37+
Beam/direct horizontal irradiance
38+
39+
dhi
40+
Diffuse horizontal irradiance
41+
42+
dni
43+
Direct normal irradiance [Wm⁻²]. Irradiance received per unit area by a
44+
surface perpendicular (normal) to the sun's rays that propagate in a
45+
straight line from the sun.
46+
47+
dni_clear
48+
Clear sky direct normal irradiance
49+
50+
dni_extra
51+
Direct normal irradiance at top of atmosphere (extraterrestrial)
52+
53+
effective_irradiance
54+
Effective irradiance
55+
56+
eta_inv
57+
Inverter efficiency
58+
59+
eta_inv_nom
60+
Nominal inverter efficiency
61+
62+
eta_inv_ref
63+
Reference inverter efficiency
64+
65+
g_poa_effective
66+
Broadband plane of array effective irradiance
67+
68+
gamma_pdc
69+
Module temperature coefficient. Typically in units of 1/C.
70+
71+
ghi
72+
Global horizontal irradiance
73+
74+
ghi_extra
75+
Horizontal irradiance at top of atmosphere (extraterrestrial)
76+
77+
gri
78+
Ground-reflected irradiance
79+
80+
i_sc
81+
Short circuit module current
82+
83+
i_x, i_xx
84+
Sandia Array Performance Model IV curve parameters
85+
86+
latitude
87+
Latitude
88+
89+
longitude
90+
Longitude
91+
92+
pac, ac
93+
AC power
94+
95+
pdc, dc
96+
DC power
97+
98+
pdc0
99+
Nameplate DC rating
100+
101+
photocurrent
102+
Photocurrent
103+
104+
poa_diffuse
105+
Total diffuse irradiation in plane. Sum of ground and sky diffuse.
106+
107+
poa_direct
108+
Direct/beam irradiation in plane
109+
110+
poa_global
111+
Global irradiation in plane. sum of diffuse and beam projection.
112+
113+
poa_ground_diffuse
114+
In plane ground reflected irradiation
115+
116+
poa_sky_diffuse
117+
Diffuse irradiation in plane from scattered light in the atmosphere
118+
(without ground reflected irradiation)
119+
120+
precipitable_water
121+
Total precipitable water contained in a column of unit cross section
122+
from earth to top of atmosphere
123+
124+
pressure
125+
Atmospheric pressure
126+
127+
relative_humidity
128+
Relative humidity
129+
130+
resistance_series
131+
Series resistance
132+
133+
resistance_shunt
134+
Shunt resistance
135+
136+
saturation_current
137+
Diode saturation current
138+
139+
solar_azimuth
140+
Azimuth angle of the sun in degrees East of North
141+
142+
solar_zenith
143+
Zenith angle of the sun in degrees
144+
145+
surface_azimuth
146+
Azimuth angle of the surface
147+
148+
surface_tilt
149+
Panel tilt from horizontal [°]. For example, a surface facing up = 0°,
150+
surface facing horizon = 90°.
151+
152+
temp_air
153+
Temperature of the air
154+
155+
temp_cell
156+
Temperature of the cell
157+
158+
temp_dew
159+
Dewpoint temperature
160+
161+
temp_module
162+
Temperature of the module
163+
164+
transposition_factor
165+
The gain ratio of the radiation on inclined plane to global horizontal
166+
irradiation: :math:`\frac{poa\_global}{ghi}`
167+
168+
tz
169+
Timezone
170+
171+
v_mp, i_mp, p_mp
172+
Module voltage, current, power at the maximum power point
173+
174+
v_oc
175+
Open circuit module voltage
176+
177+
wind_direction
178+
Wind direction
179+
180+
wind_speed
181+
Wind speed
182+
183+
184+
For further explanation of the variables, common symbols, and
185+
units, refer to the following sources from `SoDa Service <http://www.soda-pro.com/home>`_:
186+
187+
* `Acronyms, Terminology and Units <https://www.soda-pro.com/help/general/acronyms-terminology-and-units>`_
188+
* `Plane orientations and radiation components <https://www.soda-pro.com/help/general/plane-orientations-and-radiation-components>`_
189+
* `Time references <https://www.soda-pro.com/help/general/time-references>`_
190+
191+
.. note:: These further references might not use the same terminology as
192+
*pvlib*. But the physical process referred to is the same.

docs/sphinx/source/user_guide/variables_style_rules.rst

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)