Skip to content

Commit 300aedc

Browse files
echedey-lscwhanse
andauthored
Docstring cleanup: "default None", doi (#1828)
* Align reference * Update irradiance.py Exclude .*=| from negative lookahead ^(\s{8}|\s{4})(?!try|else|doi|DOI|Warning|Access|Requests|Note)(\w*): (?!.*:)(.+)$ Reason: just this line 🌝 Remaining matches are type annotations in modelchain.py and pvsystem.py * Remove parenthesis in types F: (?<spaces>\s{8}|\s{4})(?<name>\w*)\s?: (?<type>.*) \(optional, default=(?<default>.*)\)$ R: * Remove none in type definition #1574 1st-F: (?<spaces> {8}| {4})(?<name>\w*) : (?<types>.*), default None$ 2nd-F: (?<spaces> {8}| {4})(?<name>\w*) : [Nn}one or (?<type>.*), optional$ 3rd-F: (?<spaces> {8}| {4})(?<name>\w*) : (?<type>.*) or [nN]one, optional$ R: $1$2 : $3, optional * Change if none ocurrences (I) F: If None, R: If not specified, * Change if none ocurrences (II) F: If None R: If not specified, * Too long line * Too long line * fix doi external links Regex find: (?:doi|DOI):(?!`)\s?(.*?)(\.\n|\n) Replace: :doi:`$1`$2 * Apply cwhanse suggestion Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Apply cwhanse suggestion Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Apply cwhanse suggestion Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Apply cwhanse suggestion Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Modified cwhanse suggestion Co-Authored-By: Cliff Hansen <5393711+cwhanse@users.noreply.github.com> * Update modelchain.py Co-Authored-By: Cliff Hansen <5393711+cwhanse@users.noreply.github.com> * Some None's missed F: (?<spaces> {8}| {4})(?<name>\w*) : [Nn]one[ ,]*(?<type>.*), optional$ R: $1$2 : $3, optional Co-Authored-By: Cliff Hansen <5393711+cwhanse@users.noreply.github.com> * ``none``'s, some more ``'s to variables and some other nones Co-Authored-By: Cliff Hansen <5393711+cwhanse@users.noreply.github.com> * Special ``none`` cases (please review) Co-Authored-By: Cliff Hansen <5393711+cwhanse@users.noreply.github.com> * Linter Co-Authored-By: Cliff Hansen <5393711+cwhanse@users.noreply.github.com> * Run more regexes F1: (?<spaces> {8}| {4})(?<name>\w*) ?: (?<type>.*), default: None F2: (?<spaces> {8}| {4})(?<name>\w*) ?: (?<types>.*), default None$ F3: (?<spaces> {8}| {4})(?<name>\w*) ?: [Nn]one or (?<type>.*), optional$ zero results F4: (?<spaces> {8}| {4})(?<name>\w*) ?: (?<type>.*) or [nN]one, optional$ zero results R: $1$2 : $3, optional * More Nones F: (?<spaces> {8}| {4})(?<name>\w*) ?: (?<type>.*), default:? None\.? R: $1$2 : $3, optional F: (?<spaces> {8}| {4})(?<name>\w*) ?: [Nn]one, (?<type>.*), default:? (?<def>.*)\.? R: $1$2 : $3, default $4 F: (?<spaces> {8}| {4})(?<name>\w*) ?: [Nn]one or (?<types>.*) R: $1$2 : $3 F: (?<spaces> {8}| {4})(?<name>\w*) ?: (?<types>.*) or [Nn]one(?<trailing>.*) R: $1$2 : $3$4 F: (?<spaces> {8}| {4})(?<name>\w*) ?: [Nn]one(?:,|or) (?<types>.*) R: $1$2 : $3 * Update irradiance.py * Revert "Special ``none`` cases (please review)" This reverts commit b8f942b. * Apply suggestions from code review Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Update irradiance.py * Update pvlib/irradiance.py Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Update irradiance.py --------- Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> Co-authored-by: Cliff Hansen <5393711+cwhanse@users.noreply.github.com>
1 parent 6ff02e5 commit 300aedc

21 files changed

+177
-177
lines changed

pvlib/bifacial/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _unshaded_ground_fraction(surface_tilt, surface_azimuth, solar_zenith,
8080
.. [1] Mikofski, M., Darawali, R., Hamer, M., Neubert, A., and Newmiller,
8181
J. "Bifacial Performance Modeling in Large Arrays". 2019 IEEE 46th
8282
Photovoltaic Specialists Conference (PVSC), 2019, pp. 1282-1287.
83-
doi: 10.1109/PVSC40753.2019.8980572.
83+
:doi:`10.1109/PVSC40753.2019.8980572`.
8484
"""
8585
tan_phi = _solar_projection_tangent(solar_zenith, solar_azimuth,
8686
surface_azimuth)

pvlib/clearsky.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
159159
160160
longitude : float or int
161161
162-
filepath : None or string, default None
162+
filepath : string, optional
163163
The path to the ``.h5`` file.
164164
165165
interp_turbidity : bool, default True
@@ -703,9 +703,9 @@ def detect_clearsky(measured, clearsky, times=None, infer_limits=False,
703703
Time series of measured GHI. [W/m2]
704704
clearsky : array or Series
705705
Time series of the expected clearsky GHI. [W/m2]
706-
times : DatetimeIndex or None, default None.
707-
Times of measured and clearsky values. If None the index of measured
708-
will be used.
706+
times : DatetimeIndex, optional
707+
Times of measured and clearsky values. If not specified, the index of
708+
``measured`` will be used.
709709
infer_limits : bool, default False
710710
If True, does not use passed in kwargs (or defaults), but instead
711711
interpolates these values from Table 1 in [2]_.

pvlib/iam.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def physical(aoi, n=1.526, K=4.0, L=0.002, *, n_ar=None):
124124
125125
n_ar : numeric, optional
126126
The effective index of refraction of the anti-reflective (AR) coating
127-
(unitless). If n_ar is None (default), no AR coating is applied.
127+
(unitless). If ``n_ar`` is not supplied, no AR coating is applied.
128128
A typical value for the effective index of an AR coating is 1.29.
129129
130130
Returns
@@ -338,7 +338,7 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
338338
c2 : float
339339
Second fitting parameter for the expressions that approximate the
340340
integral of diffuse irradiance coming from different directions.
341-
If c2 is None, it will be calculated according to the linear
341+
If c2 is not specified, it will be calculated according to the linear
342342
relationship given in [3]_.
343343
344344
Returns
@@ -514,7 +514,7 @@ def sapm(aoi, module, upper=None):
514514
A dict or Series with the SAPM IAM model parameters.
515515
See the :py:func:`sapm` notes section for more details.
516516
517-
upper : None or float, default None
517+
upper : float, optional
518518
Upper limit on the results.
519519
520520
Returns
@@ -541,7 +541,7 @@ def sapm(aoi, module, upper=None):
541541
542542
.. [3] B.H. King et al, "Recent Advancements in Outdoor Measurement
543543
Techniques for Angle of Incidence Effects," 42nd IEEE PVSC (2015).
544-
DOI: 10.1109/PVSC.2015.7355849
544+
:doi:`10.1109/PVSC.2015.7355849`
545545
546546
See Also
547547
--------
@@ -607,7 +607,7 @@ def marion_diffuse(model, surface_tilt, **kwargs):
607607
.. [1] B. Marion "Numerical method for angle-of-incidence correction
608608
factors for diffuse radiation incident photovoltaic modules",
609609
Solar Energy, Volume 147, Pages 344-348. 2017.
610-
DOI: 10.1016/j.solener.2017.03.027
610+
:doi:`10.1016/j.solener.2017.03.027`
611611
612612
Examples
613613
--------
@@ -694,7 +694,7 @@ def marion_integrate(function, surface_tilt, region, num=None):
694694
.. [1] B. Marion "Numerical method for angle-of-incidence correction
695695
factors for diffuse radiation incident photovoltaic modules",
696696
Solar Energy, Volume 147, Pages 344-348. 2017.
697-
DOI: 10.1016/j.solener.2017.03.027
697+
:doi:`10.1016/j.solener.2017.03.027`
698698
699699
Examples
700700
--------

pvlib/iotools/epw.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def read_epw(filename, coerce_year=None):
2525
filename : String
2626
Can be a relative file path, absolute file path, or url.
2727
28-
coerce_year : None or int, default None
28+
coerce_year : int, optional
2929
If supplied, the year of the data will be set to this value. This can
3030
be a useful feature because EPW data is composed of data from
3131
different years.
@@ -247,7 +247,7 @@ def parse_epw(csvdata, coerce_year=None):
247247
csvdata : file-like buffer
248248
a file-like buffer containing data in the EPW format
249249
250-
coerce_year : None or int, default None
250+
coerce_year : int, optional
251251
If supplied, the year of the data will be set to this value. This can
252252
be a useful feature because EPW data is composed of data from
253253
different years.

pvlib/iotools/pvgis.py

+25-25
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
6363
In decimal degrees, between -90 and 90, north is positive (ISO 19115)
6464
longitude: float
6565
In decimal degrees, between -180 and 180, east is positive (ISO 19115)
66-
start: int or datetime like, default: None
66+
start : int or datetime like, optional
6767
First year of the radiation time series. Defaults to first year
6868
available.
69-
end: int or datetime like, default: None
69+
end : int or datetime like, optional
7070
Last year of the radiation time series. Defaults to last year
7171
available.
72-
raddatabase: str, default: None
72+
raddatabase : str, optional
7373
Name of radiation database. Options depend on location, see [3]_.
7474
components: bool, default: True
7575
Output solar radiation components (beam, diffuse, and reflected).
@@ -87,14 +87,14 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
8787
and pvlib<=0.9.5 is offset by 180 degrees.
8888
usehorizon: bool, default: True
8989
Include effects of horizon
90-
userhorizon: list of float, default: None
90+
userhorizon : list of float, optional
9191
Optional user specified elevation of horizon in degrees, at equally
9292
spaced azimuth clockwise from north, only valid if ``usehorizon`` is
93-
true, if ``usehorizon`` is true but ``userhorizon`` is ``None`` then
93+
true, if ``usehorizon`` is true but ``userhorizon`` is not specified then
9494
PVGIS will calculate the horizon [4]_
9595
pvcalculation: bool, default: False
9696
Return estimate of hourly PV production.
97-
peakpower: float, default: None
97+
peakpower : float, optional
9898
Nominal power of PV system in kW. Required if pvcalculation=True.
9999
pvtechchoice: {'crystSi', 'CIS', 'CdTe', 'Unknown'}, default: 'crystSi'
100100
PV technology.
@@ -309,12 +309,12 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
309309
----------
310310
filename : str, pathlib.Path, or file-like buffer
311311
Name, path, or buffer of hourly data file downloaded from PVGIS.
312-
pvgis_format : str, default None
312+
pvgis_format : str, optional
313313
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
314314
parameter in the PVGIS API. If ``filename`` is a file and
315-
``pvgis_format`` is ``None`` then the file extension will be used to
316-
determine the PVGIS format to parse. If ``filename`` is a buffer, then
317-
``pvgis_format`` is required and must be in ``['csv', 'json']``.
315+
``pvgis_format`` is not specified then the file extension will be used
316+
to determine the PVGIS format to parse. If ``filename`` is a buffer,
317+
then ``pvgis_format`` is required and must be in ``['csv', 'json']``.
318318
map_variables: bool, default True
319319
When true, renames columns of the DataFrame to pvlib variable names
320320
where applicable. See variable :const:`VARIABLE_MAP`.
@@ -336,11 +336,11 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
336336
Raises
337337
------
338338
ValueError
339-
if ``pvgis_format`` is ``None`` and the file extension is neither
339+
if ``pvgis_format`` is not specified and the file extension is neither
340340
``.csv`` nor ``.json`` or if ``pvgis_format`` is provided as
341341
input but isn't in ``['csv', 'json']``
342342
TypeError
343-
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer
343+
if ``pvgis_format`` is not specified and ``filename`` is a buffer
344344
345345
See Also
346346
--------
@@ -409,14 +409,13 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
409409
documentation [2]_ for more info.
410410
usehorizon : bool, default True
411411
include effects of horizon
412-
userhorizon : list of float, default None
413-
optional user specified elevation of horizon in degrees, at equally
414-
spaced azimuth clockwise from north, only valid if ``usehorizon`` is
415-
true, if ``usehorizon`` is true but ``userhorizon`` is ``None`` then
416-
PVGIS will calculate the horizon [3]_
417-
startyear : int, default None
412+
userhorizon : list of float, optional
413+
Optional user-specified elevation of horizon in degrees, at equally
414+
spaced azimuth clockwise from north. If not specified, PVGIS will
415+
calculate the horizon [3]_. If specified, requires ``usehorizon=True``.
416+
startyear : int, optional
418417
first year to calculate TMY
419-
endyear : int, default None
418+
endyear : int, optional
420419
last year to calculate TMY, must be at least 10 years from first year
421420
map_variables: bool, default True
422421
When true, renames columns of the Dataframe to pvlib variable names
@@ -573,12 +572,13 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
573572
----------
574573
filename : str, pathlib.Path, or file-like buffer
575574
Name, path, or buffer of file downloaded from PVGIS.
576-
pvgis_format : str, default None
575+
pvgis_format : str, optional
577576
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
578577
parameter in the PVGIS TMY API. If ``filename`` is a file and
579-
``pvgis_format`` is ``None`` then the file extension will be used to
580-
determine the PVGIS format to parse. For PVGIS files from the API with
581-
``outputformat='basic'``, please set ``pvgis_format`` to ``'basic'``.
578+
``pvgis_format`` is not specified then the file extension will be used
579+
to determine the PVGIS format to parse. For PVGIS files from the API
580+
with ``outputformat='basic'``, please set ``pvgis_format`` to
581+
``'basic'``.
582582
If ``filename`` is a buffer, then ``pvgis_format`` is required and must
583583
be in ``['csv', 'epw', 'json', 'basic']``.
584584
map_variables: bool, default True
@@ -600,11 +600,11 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
600600
Raises
601601
------
602602
ValueError
603-
if ``pvgis_format`` is ``None`` and the file extension is neither
603+
if ``pvgis_format`` is not specified and the file extension is neither
604604
``.csv``, ``.json``, nor ``.epw``, or if ``pvgis_format`` is provided
605605
as input but isn't in ``['csv', 'epw', 'json', 'basic']``
606606
TypeError
607-
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer
607+
if ``pvgis_format`` is not specified and ``filename`` is a buffer
608608
609609
See Also
610610
--------

pvlib/iotools/sodapro.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
7575
identifier: {'mcclear', 'cams_radiation'}
7676
Specify whether to retrieve CAMS Radiation or McClear parameters
7777
altitude: float, optional
78-
Altitude in meters. If None, then the altitude is determined from the
79-
NASA SRTM database
78+
Altitude in meters. If not specified, then the altitude is determined
79+
from the NASA SRTM database
8080
time_step: str, {'1min', '15min', '1h', '1d', '1M'}, default: '1h'
8181
Time step of the time series, either 1 minute, 15 minute, hourly,
8282
daily, or monthly.
@@ -88,7 +88,7 @@ def get_cams(latitude, longitude, start, end, email, identifier='mcclear',
8888
integrated: boolean, default False
8989
Whether to return radiation parameters as integrated values (Wh/m^2)
9090
or as average irradiance values (W/m^2) (pvlib preferred units)
91-
label: {'right', 'left'}, default: None
91+
label : {'right', 'left'}, optional
9292
Which bin edge label to label time-step with. The default is 'left' for
9393
all time steps except for '1M' which has a default of 'right'.
9494
map_variables: bool, default: True
@@ -241,7 +241,7 @@ def parse_cams(fbuf, integrated=False, label=None, map_variables=True):
241241
integrated: boolean, default False
242242
Whether to return radiation parameters as integrated values (Wh/m^2)
243243
or as average irradiance values (W/m^2) (pvlib preferred units)
244-
label: {'right', 'left'}, default: None
244+
label : {'right', 'left'}, optional
245245
Which bin edge label to label time-step with. The default is 'left' for
246246
all time steps except for '1M' which has a default of 'right'.
247247
map_variables: bool, default: True
@@ -342,7 +342,7 @@ def read_cams(filename, integrated=False, label=None, map_variables=True):
342342
integrated: boolean, default False
343343
Whether to return radiation parameters as integrated values (Wh/m^2)
344344
or as average irradiance values (W/m^2) (pvlib preferred units)
345-
label: {'right', 'left}, default: None
345+
label : {'right', 'left}, optional
346346
Which bin edge label to label time-step with. The default is 'left' for
347347
all time steps except for '1M' which has a default of 'right'.
348348
map_variables: bool, default: True

pvlib/iotools/tmy.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def read_tmy3(filename, coerce_year=None, map_variables=None, recolumn=None,
4040
----------
4141
filename : str
4242
A relative file path or absolute file path.
43-
coerce_year : None or int, default None
44-
If supplied, the year of the index will be set to `coerce_year`, except
43+
coerce_year : int, optional
44+
If supplied, the year of the index will be set to ``coerce_year``, except
4545
for the last index value which will be set to the *next* year so that
4646
the index increases monotonically.
47-
map_variables : bool, default None
47+
map_variables : bool, optional
4848
When True, renames columns of the DataFrame to pvlib variable names
4949
where applicable. See variable :const:`VARIABLE_MAP`.
5050
recolumn : bool (deprecated, use map_variables instead)

0 commit comments

Comments
 (0)