Skip to content

Commit 2e844a5

Browse files
mikofskiwholmgren
authored andcommitted
DOC: switch from numpydoc to napoleon, render sphinx docs right (pvlib#691)
* DOC: fix napoleon, render sphinx docs right * fix napoleon documentation issues * set napoleon_use_rtype = False - for nicer style, combines return type in parentheses after return name * in bifacial use Parameters instead of Inputs * in location use add newline and tab after kwargs parameter in two places * in model chain remove return and separate Notes * in solarposition, add newline and tab after return type * in tracking add Parameters to docstring for SingleAxisTracker * remove numpydoc depndency * remove from - INSTALL REQUIRES in setup.py - extensions in conf.py, also remove numpydoc directive - tutorials environment yml * fix typo for singleaxis in tracking.py * stickler CI - too long lines in tracking.py and modelchain.py * fix some formatting, confusing markdown and rst code backticks Signed-off-by: Mark Mikofski <[email protected]>
1 parent dd030a7 commit 2e844a5

10 files changed

+52
-28
lines changed

docs/environment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies:
1313
- ephem
1414
- numba
1515
- ipython=6.3
16-
- numpydoc
1716
- matplotlib=2.2.2
1817
- siphon=0.7.0
1918
- sphinx=1.7.2

docs/sphinx/source/conf.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def __getattr__(cls, name):
4040

4141
# -- General configuration ------------------------------------------------
4242

43-
# turns off numpydoc autosummary warnings
44-
numpydoc_show_class_members = False
43+
# use napoleon in lieu of numpydoc 2019-04-23
4544

4645
# If your documentation needs a minimal Sphinx version, state it here.
4746
#needs_sphinx = '1.0'
@@ -55,12 +54,14 @@ def __getattr__(cls, name):
5554
'sphinx.ext.viewcode',
5655
'sphinx.ext.intersphinx',
5756
'sphinx.ext.extlinks',
58-
'numpydoc',
57+
'sphinx.ext.napoleon',
5958
'sphinx.ext.autosummary',
6059
'IPython.sphinxext.ipython_directive',
6160
'IPython.sphinxext.ipython_console_highlighting'
6261
]
6362

63+
napoleon_use_rtype = False # group rtype on same line together with return
64+
6465
# Add any paths that contain templates here, relative to this directory.
6566
templates_path = ['_templates']
6667

docs/sphinx/source/contributing.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ Documentation
229229
~~~~~~~~~~~~~
230230

231231
Documentation must be written in
232-
`numpydoc format <https://numpydoc.readthedocs.io/>`_.
232+
`numpydoc format <https://numpydoc.readthedocs.io/>`_ format which is rendered
233+
using the `Sphinx Napoleon extension
234+
<https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html>`_.
233235

234236
The numpydoc format includes a specification for the allowable input
235237
types. Python's `duck typing <https://en.wikipedia.org/wiki/Duck_typing>`_

pvlib/bifacial.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def pvfactors_timeseries(
2020
Please refer to pvfactors online documentation for more details:
2121
https://sunpower.github.io/pvfactors/
2222
23-
Inputs
24-
------
23+
Parameters
24+
----------
2525
solar_azimuth: numeric
2626
Sun's azimuth angles using pvlib's azimuth convention (deg)
2727
solar_zenith: numeric

pvlib/location.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def get_solarposition(self, times, pressure=None, temperature=12,
142142
:py:func:`atmosphere.alt2pres` and ``self.altitude``.
143143
temperature : None, float, or array-like, default 12
144144
145-
kwargs passed to :py:func:`solarposition.get_solarposition`
145+
kwargs
146+
passed to :py:func:`solarposition.get_solarposition`
146147
147148
Returns
148149
-------
@@ -178,8 +179,9 @@ def get_clearsky(self, times, model='ineichen', solar_position=None,
178179
dni_extra: None or numeric, default None
179180
If None, will be calculated from times.
180181
181-
kwargs passed to the relevant functions. Climatological values
182-
are assumed in many cases. See source code for details!
182+
kwargs
183+
Extra parameters passed to the relevant functions. Climatological
184+
values are assumed in many cases. See source code for details!
183185
184186
Returns
185187
-------

pvlib/modelchain.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -798,21 +798,19 @@ def prepare_inputs(self, times=None, weather=None):
798798
Times at which to evaluate the model. Can be None if
799799
attribute `times` is already set.
800800
weather : None or DataFrame, default None
801-
If None, the weather attribute is used. If the weather
802-
attribute is also None assumes air temperature is 20 C, wind
801+
If ``None``, the weather attribute is used. If the weather
802+
attribute is also ``None`` assumes air temperature is 20 C, wind
803803
speed is 0 m/s and irradiation calculated from clear sky
804-
data. Column names must be 'wind_speed', 'temp_air', 'dni',
805-
'ghi', 'dhi'. Do not pass incomplete irradiation data. Use
806-
method
804+
data. Column names must be ``'wind_speed'``, ``'temp_air'``,
805+
``'dni'``, ``'ghi'``, ``'dhi'``. Do not pass incomplete irradiation
806+
data. Use method
807807
:py:meth:`~pvlib.modelchain.ModelChain.complete_irradiance`
808808
instead.
809809
810-
Returns
811-
-------
812-
self
813-
814-
Assigns attributes: times, solar_position, airmass, total_irrad,
815-
aoi
810+
Notes
811+
-----
812+
Assigns attributes: ``times``, ``solar_position``, ``airmass``,
813+
``total_irrad``, `aoi`
816814
"""
817815
if weather is not None:
818816
self.weather = weather

pvlib/pvsystem.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
247247
model : String, default 'haydavies'
248248
Irradiance model.
249249
250-
**kwargs
251-
Passed to :func:`irradiance.total_irrad`.
250+
kwargs
251+
Extra parameters passed to :func:`irradiance.total_irrad`.
252252
253253
Returns
254254
-------
@@ -429,7 +429,7 @@ def sapm(self, effective_irradiance, temp_cell, **kwargs):
429429
aoi : Series
430430
Angle of incidence (degrees).
431431
432-
**kwargs
432+
kwargs
433433
See pvsystem.sapm for details
434434
435435
Returns

pvlib/solarposition.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,8 @@ def solar_zenith_analytical(latitude, hourangle, declination):
12781278
12791279
Returns
12801280
-------
1281-
zenith : numeric Solar zenith angle in radians.
1281+
zenith : numeric
1282+
Solar zenith angle in radians.
12821283
12831284
References
12841285
----------
@@ -1299,7 +1300,9 @@ def solar_zenith_analytical(latitude, hourangle, declination):
12991300
13001301
See Also
13011302
--------
1302-
declination_spencer71 declination_cooper69 hour_angle
1303+
declination_spencer71
1304+
declination_cooper69
1305+
hour_angle
13031306
"""
13041307
return np.arccos(
13051308
np.cos(declination) * np.cos(latitude) * np.cos(hourangle) +

pvlib/tracking.py

+20
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class SingleAxisTracker(PVSystem):
1313
"""
1414
Inherits the PV modeling methods from :py:class:`~pvlib.pvsystem.PVSystem`.
1515
16+
17+
Parameters
18+
----------
1619
axis_tilt : float, default 0
1720
The tilt of the axis of rotation (i.e, the y-axis defined by
1821
axis_azimuth) with respect to horizontal, in decimal degrees.
@@ -40,6 +43,7 @@ class SingleAxisTracker(PVSystem):
4043
2 meters wide, centered on the tracking axis, with 6 meters
4144
between the tracking axes has a gcr of 2/6=0.333. If gcr is not
4245
provided, a gcr of 2/7 is default. gcr must be <=1.
46+
4347
"""
4448

4549
def __init__(self, axis_tilt=0, axis_azimuth=0,
@@ -67,6 +71,22 @@ def __repr__(self):
6771
return sat_repr + '\n' + pvsystem_repr
6872

6973
def singleaxis(self, apparent_zenith, apparent_azimuth):
74+
"""
75+
Get tracking data. See :py:func:`pvlib.tracking.singleaxis` more
76+
detail.
77+
78+
Parameters
79+
----------
80+
apparent_zenith : float, 1d array, or Series
81+
Solar apparent zenith angles in decimal degrees.
82+
83+
apparent_azimuth : float, 1d array, or Series
84+
Solar apparent azimuth angles in decimal degrees.
85+
86+
Returns
87+
-------
88+
tracking data
89+
"""
7090
tracking_data = singleaxis(apparent_zenith, apparent_azimuth,
7191
self.axis_tilt, self.axis_azimuth,
7292
self.max_angle,

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
EXTRAS_REQUIRE = {
4747
'optional': ['scipy', 'tables', 'numba', 'siphon', 'netcdf4',
4848
'ephem', 'cython', 'pvfactors'],
49-
'doc': ['sphinx', 'ipython', 'sphinx_rtd_theme', 'numpydoc',
50-
'matplotlib'],
49+
'doc': ['sphinx', 'ipython', 'sphinx_rtd_theme', 'matplotlib'],
5150
'test': TESTS_REQUIRE
5251
}
5352
EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), [])))

0 commit comments

Comments
 (0)