@@ -88,7 +88,7 @@ An easy way to do this is with::
8888
8989Note: Anaconda users may have trouble using the above command to update an
9090older version of docutils. If that happens, you can update it with ``conda ``
91- (e.g. ``conda install docutils=0.15.2 ``) and run the above command again.
91+ (e.g. ``conda install docutils=0.21 ``) and run the above command again.
9292
9393Once the ``doc `` dependencies are installed, navigate to ``/docs/sphinx `` and
9494execute::
@@ -107,6 +107,107 @@ Note that Windows users need not have the ``make`` utility installed as pvlib
107107includes a ``make.bat `` batch file that emulates its interface.
108108
109109
110+ .. _example-docstring :
111+
112+ Example Docstring
113+ -----------------
114+
115+ Here is a template for a function docstring that tries to encapsulate all
116+ the features that may be used in any docstring. This is a template, so
117+ not all sections are required for every function, but is a good starting point.
118+
119+ .. code-block :: python
120+
121+ def example_function (poa_global , exponents , degree_symbol ,
122+ default_arg = ' someval' , optional_arg = None ):
123+ r """
124+ A brief summary of the function.
125+
126+ A longer description of the function. This can include references
127+ to literature [1]_, websites, and other code elements such as
128+ functions (:py:func:`pvlib.location.lookup_altitude`) and
129+ classes (:py:class:`pvlib.location.Location`).
130+
131+ .. versionadded:: 0.0.1
132+
133+ .. note:: This docstring is a template.
134+
135+ .. warning:: Code body is not included in this example!
136+
137+ Parameters
138+ ----------
139+ poa_global : numeric
140+ Plane-of-array global irradiance, see :term:`poa_global`. [Wm⁻²].
141+ exponents : array-like
142+ A list of exponents. [x⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻].
143+ degree_symbol : numeric
144+ It's different from superscript zero. [°].
145+ default_arg : string, default ``'someval'``.
146+ Text enclosed in double backticks mean code formatting.
147+ optional_arg : integer, optional
148+ A description of ``optional_arg``. [Unitless].
149+
150+ Returns
151+ -------
152+ name : numeric
153+ A description of the return value.
154+
155+ Raises
156+ ------
157+ ValueError
158+ If ``poa_global`` is negative.
159+ KeyError
160+ If ``default_arg`` does not exist.
161+
162+ Notes
163+ -----
164+ This section can include additional information about the function.
165+
166+ For example, an equation using LaTeX markup:
167+
168+ .. math::
169+
170+ a = \left(\frac{b}{c}\right)^2
171+
172+ where :math:`a` is the result of the equation, :math:`b` and :math:`c`
173+ are inputs.
174+
175+ Or a figure with a caption:
176+
177+ .. figure:: ../../_images/pvlib_logo_horiz.png
178+ :scale: 10%
179+ :alt: alternate text
180+ :align: center
181+
182+ Figure caption.
183+
184+ See Also
185+ --------
186+ pvlib.location.lookup_altitude
187+ pvlib.location.Location
188+
189+ Examples
190+ --------
191+ >>> example_function(1, 1, 1)
192+ 'None'
193+
194+ References
195+ ----------
196+ A IEEE citation to a relevant reference. You may use an automatic
197+ citation generator to format the citation correctly.
198+
199+ .. [1] Anderson, K., Hansen, C., Holmgren, W., Jensen, A., Mikofski, M.,
200+ and Driesse, A. “pvlib python: 2023 project update.” Journal of Open
201+ Source Software, 8(92), 5994, (2023). :doi:`10.21105/joss.05994`.
202+ """
203+ return " None"
204+
205+ A preview on how this would render in the documentation can be seen in the
206+ following file: :download: `Example docstring<../_images/example_function_screenshot.png> `.
207+
208+ Remember that to show the docstring in the documentation, you must list
209+ the function in the appropriate ``.rst `` file in the ``docs/sphinx/source/reference `` file.
210+
110211.. _example-gallery :
111212
112213Example Gallery
0 commit comments