Skip to content

Commit 1e6f870

Browse files
authored
Standardize diffuse irradiance component names and descriptions in docstrings (#2827)
* Standardize component names and descriptions * Add whatsnew entry * Fix list indentation * Edit nomenclature
1 parent 38586c1 commit 1e6f870

4 files changed

Lines changed: 91 additions & 66 deletions

File tree

‎docs/sphinx/source/user_guide/extras/nomenclature.rst‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,33 @@ There is a convention on consistent variable names throughout the library:
134134

135135
photocurrent
136136
Photocurrent
137+
138+
poa_circumsolar
139+
The portion of sky diffuse irradiance on a tilted plane from the circumsolar
140+
region. [Wm⁻²]
137141

138142
poa_diffuse
139-
Total diffuse irradiance in plane [Wm⁻²]. Sum of ground and sky diffuse
143+
Total diffuse irradiance on a tilted plane [Wm⁻²]. Sum of ground and sky diffuse
140144
components of global irradiance.
141145

142146
poa_direct
143-
Direct/beam irradiance in plane [Wm⁻²].
147+
Direct irradiance on a tilted plane [Wm⁻²].
144148

145149
poa_global
146-
Global irradiance in plane. Sum of diffuse and beam projection [Wm⁻²].
150+
Total irradiance on a tilted plane. [Wm⁻²]
147151

148152
poa_ground_diffuse
149-
In plane ground reflected irradiance [Wm⁻²].
153+
The ground diffuse component of irradiance on a tilted plane. [Wm⁻²]
154+
155+
poa_horizon
156+
The portion of sky diffuse irradiance on a tilted plane from the horizon. [Wm⁻²]
157+
158+
poa_isotropic
159+
The portion of sky diffuse irradiance on a tilted plane from the isotropic
160+
sky dome. [Wm⁻²]
150161

151162
poa_sky_diffuse
152-
Diffuse irradiance in plane from scattered light in the atmosphere
153-
(without ground reflected irradiance) [Wm⁻²].
163+
The sky diffuse component of irradiance on a tilted plane. [Wm⁻²]
154164

155165
precipitable_water
156166
Total precipitable water contained in a column of unit cross section

‎docs/sphinx/source/whatsnew/v0.15.3.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Documentation
3939
* Fix broken link in GitHub Contributing tab. (:issue:`2628`, :pull:`2806`)
4040
* Fixed broken ``interval`` keyword argument in the ``oedi_9068`` gallery
4141
example; the correct parameter name is ``time_step``. (:issue:`2791`)
42+
* Standardized diffuse component names and descriptions in the docstrings of
43+
multiple functions in :py:mod:`pvlib.irradiance`. (:pull:`2827`)
4244

4345

4446
Testing

‎pvlib/irradiance.py‎

Lines changed: 71 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
566566
567567
Returns
568568
-------
569-
grounddiffuse : numeric
570-
Ground reflected irradiance. [Wm⁻²]
569+
poa_ground_diffuse : numeric
570+
The ground diffuse component of irradiance on a tilted plane. [Wm⁻²]
571571
572572
Notes
573573
-----
@@ -589,14 +589,17 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
589589
if surface_type is not None:
590590
albedo = pvlib.albedo.SURFACE_ALBEDOS[surface_type]
591591

592-
diffuse_irrad = ghi * albedo * (1 - np.cos(np.radians(surface_tilt))) * 0.5
592+
poa_ground_diffuse = (
593+
ghi * albedo *
594+
(1 - np.cos(np.radians(surface_tilt))) * 0.5
595+
)
593596

594597
try:
595-
diffuse_irrad.name = 'diffuse_ground'
598+
poa_ground_diffuse.name = 'poa_ground_diffuse'
596599
except AttributeError:
597600
pass
598601

599-
return diffuse_irrad
602+
return poa_ground_diffuse
600603

601604

602605
def isotropic(surface_tilt, dhi):
@@ -673,8 +676,8 @@ def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,
673676
674677
Returns
675678
-------
676-
diffuse : numeric
677-
The sky diffuse component of the solar radiation. [Wm⁻²]
679+
poa_sky_diffuse : numeric
680+
The sky diffuse component of irradiance on a tilted plane. [Wm⁻²]
678681
679682
Notes
680683
-----
@@ -699,7 +702,7 @@ def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,
699702
700703
F' = 1 - (DHI / GHI)^2,
701704
702-
where GHI is the global horiztonal irradiance.
705+
where GHI is the global horizontal irradiance.
703706
704707
References
705708
----------
@@ -731,9 +734,9 @@ def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,
731734
term2 = 1 + F * (tools.sind(0.5 * surface_tilt) ** 3)
732735
term3 = 1 + F * (cos_tt ** 2) * (tools.sind(solar_zenith) ** 3)
733736

734-
sky_diffuse = dhi * term1 * term2 * term3
737+
poa_sky_diffuse = dhi * term1 * term2 * term3
735738

736-
return sky_diffuse
739+
return poa_sky_diffuse
737740

738741

739742
def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
@@ -782,25 +785,28 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
782785
or supply ``projection_ratio``.
783786
784787
return_components : bool, default `False`
785-
If `False`, ``sky_diffuse`` is returned.
788+
If `False`, ``poa_sky_diffuse`` is returned.
786789
If `True`, ``diffuse_components`` is returned.
787790
788791
Returns
789792
--------
790793
numeric, dict, or DataFrame
791794
Return type controlled by ``return_components`` argument.
792-
If `False`, ``sky_diffuse`` is returned.
795+
If `False`, ``poa_sky_diffuse`` is returned.
793796
If `True`, ``diffuse_components`` is returned.
794797
795-
sky_diffuse : numeric
796-
The sky diffuse component of the solar radiation on a tilted
797-
surface. [Wm⁻²]
798+
poa_sky_diffuse : numeric
799+
The sky diffuse component of irradiance on a tilted plane. [Wm⁻²]
798800
799801
diffuse_components : dict (array input) or DataFrame (Series input)
800802
Keys/columns are:
801-
* poa_sky_diffuse: Total sky diffuse
802-
* poa_isotropic
803-
* poa_circumsolar
803+
* poa_sky_diffuse: The sky diffuse component of irradiance on a
804+
tilted plane. [Wm⁻²]
805+
* poa_isotropic: The portion of sky diffuse irradiance on a tilted
806+
plane from the isotropic sky dome. [Wm⁻²]
807+
* poa_circumsolar: The portion of sky diffuse irradiance on a
808+
tilted plane from the circumsolar region. [Wm⁻²]
809+
804810
805811
Notes
806812
------
@@ -855,20 +861,20 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
855861

856862
poa_isotropic = np.maximum(dhi * term1 * term2, 0)
857863
poa_circumsolar = np.maximum(dhi * (AI * Rb), 0)
858-
sky_diffuse = poa_isotropic + poa_circumsolar
864+
poa_sky_diffuse = poa_isotropic + poa_circumsolar
859865

860866
if return_components:
861867
diffuse_components = {
862-
'poa_sky_diffuse': sky_diffuse,
868+
'poa_sky_diffuse': poa_sky_diffuse,
863869
'poa_isotropic': poa_isotropic,
864870
'poa_circumsolar': poa_circumsolar
865871
}
866872

867-
if isinstance(sky_diffuse, pd.Series):
873+
if isinstance(poa_sky_diffuse, pd.Series):
868874
diffuse_components = pd.DataFrame(diffuse_components)
869875
return diffuse_components
870876
else:
871-
return sky_diffuse
877+
return poa_sky_diffuse
872878

873879

874880
def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
@@ -1055,15 +1061,17 @@ def king(surface_tilt, dhi, ghi, solar_zenith):
10551061
Returns
10561062
--------
10571063
poa_sky_diffuse : numeric
1058-
The diffuse component of the solar radiation.
1064+
The sky diffuse component of irradiance on a tilted plane. [Wm⁻²]
10591065
'''
10601066

1061-
sky_diffuse = (dhi * (1 + tools.cosd(surface_tilt)) / 2 + ghi *
1062-
(0.012 * solar_zenith - 0.04) *
1063-
(1 - tools.cosd(surface_tilt)) / 2)
1064-
sky_diffuse = np.maximum(sky_diffuse, 0)
1067+
poa_sky_diffuse = (
1068+
dhi * (1 + tools.cosd(surface_tilt)) / 2 + ghi *
1069+
(0.012 * solar_zenith - 0.04) *
1070+
(1 - tools.cosd(surface_tilt)) / 2
1071+
)
1072+
poa_sky_diffuse = np.maximum(poa_sky_diffuse, 0)
10651073

1066-
return sky_diffuse
1074+
return poa_sky_diffuse
10671075

10681076

10691077
def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
@@ -1103,7 +1111,6 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11031111
dni : numeric
11041112
Direct normal irradiance, must be >=0. [Wm⁻²]
11051113
1106-
11071114
dni_extra : numeric
11081115
Extraterrestrial normal irradiance. [Wm⁻²]
11091116
@@ -1145,19 +1152,23 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11451152
--------
11461153
numeric, dict, or DataFrame
11471154
Return type controlled by `return_components` argument.
1148-
If ``return_components=False``, `sky_diffuse` is returned.
1155+
If ``return_components=False``, `poa_sky_diffuse` is returned.
11491156
If ``return_components=True``, `diffuse_components` is returned.
11501157
1151-
sky_diffuse : numeric
1158+
poa_sky_diffuse : numeric
11521159
The sky diffuse component of the solar radiation on a tilted
1153-
surface.
1160+
plane. [Wm⁻²]
11541161
11551162
diffuse_components : dict (array input) or DataFrame (Series input)
11561163
Keys/columns are:
1157-
* poa_sky_diffuse: Total sky diffuse
1158-
* poa_isotropic
1159-
* poa_circumsolar
1160-
* poa_horizon
1164+
* poa_sky_diffuse: The sky diffuse component of irradiance on a
1165+
tilted plane. [Wm⁻²]
1166+
* poa_isotropic: The portion of sky diffuse irradiance on a tilted
1167+
plane from the isotropic sky dome. [Wm⁻²]
1168+
* poa_circumsolar: The portion of sky diffuse irradiance on a
1169+
tilted plane from the circumsolar region. [Wm⁻²]
1170+
* poa_horizon: The portion of sky diffuse irradiance on a tilted
1171+
plane from the horizon. [Wm⁻²]
11611172
11621173
11631174
References
@@ -1230,33 +1241,33 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
12301241
term2 = F1 * A / B
12311242
term3 = F2 * tools.sind(surface_tilt)
12321243

1233-
sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0)
1244+
poa_sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0)
12341245

12351246
# we've preserved the input type until now, so don't ruin it!
1236-
if isinstance(sky_diffuse, pd.Series):
1237-
sky_diffuse[np.isnan(airmass)] = 0
1247+
if isinstance(poa_sky_diffuse, pd.Series):
1248+
poa_sky_diffuse[np.isnan(airmass)] = 0
12381249
else:
1239-
sky_diffuse = np.where(np.isnan(airmass), 0, sky_diffuse)
1250+
poa_sky_diffuse = np.where(np.isnan(airmass), 0, poa_sky_diffuse)
12401251

12411252
if return_components:
12421253
diffuse_components = {
1243-
'poa_sky_diffuse': sky_diffuse,
1254+
'poa_sky_diffuse': poa_sky_diffuse,
12441255
'poa_isotropic': dhi * term1,
12451256
'poa_circumsolar': dhi * term2,
12461257
'poa_horizon': dhi * term3
12471258
}
12481259

1249-
# Set values of components to 0 when sky_diffuse is 0
1250-
mask = sky_diffuse == 0
1251-
if isinstance(sky_diffuse, pd.Series):
1260+
# Set values of components to 0 when poa_sky_diffuse is 0
1261+
mask = poa_sky_diffuse == 0
1262+
if isinstance(poa_sky_diffuse, pd.Series):
12521263
diffuse_components = pd.DataFrame(diffuse_components)
12531264
diffuse_components.loc[mask] = 0
12541265
else:
12551266
diffuse_components = {k: np.where(mask, 0, v) for k, v in
12561267
diffuse_components.items()}
12571268
return diffuse_components
12581269
else:
1259-
return sky_diffuse
1270+
return poa_sky_diffuse
12601271

12611272

12621273
def _calc_delta(dhi, dni_extra, solar_zenith, airmass=None):
@@ -1362,7 +1373,6 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
13621373
dni : numeric
13631374
Direct normal irradiance, must be >=0. [Wm⁻²]
13641375
1365-
13661376
dni_extra : numeric
13671377
Extraterrestrial normal irradiance. [Wm⁻²]
13681378
@@ -1386,19 +1396,22 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
13861396
--------
13871397
numeric, dict, or DataFrame
13881398
Return type controlled by `return_components` argument.
1389-
If ``return_components=False``, `sky_diffuse` is returned.
1399+
If ``return_components=False``, `poa_sky_diffuse` is returned.
13901400
If ``return_components=True``, `diffuse_components` is returned.
13911401
1392-
sky_diffuse : numeric
1393-
The sky diffuse component of the solar radiation on a tilted
1394-
surface.
1402+
poa_sky_diffuse : numeric
1403+
The sky diffuse component of irradiance on a tilted plane. [Wm⁻²]
13951404
13961405
diffuse_components : dict (array input) or DataFrame (Series input)
13971406
Keys/columns are:
1398-
* poa_sky_diffuse: Total sky diffuse
1399-
* poa_isotropic
1400-
* poa_circumsolar
1401-
* poa_horizon
1407+
* poa_sky_diffuse: The sky diffuse component of irradiance on a
1408+
tilted plane. [Wm⁻²]
1409+
* poa_isotropic: The portion of sky diffuse irradiance on a
1410+
tilted plane from the isotropic sky dome. [Wm⁻²]
1411+
* poa_circumsolar: The portion of sky diffuse irradiance on a
1412+
tilted plane from the circumsolar region. [Wm⁻²]
1413+
* poa_horizon: The portion of sky diffuse irradiance on a tilted
1414+
plane from the horizon. [Wm⁻²]
14021415
14031416
Notes
14041417
-----
@@ -1455,22 +1468,22 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
14551468
term2 = F1 * A / B
14561469
term3 = F2 * tools.sind(surface_tilt)
14571470

1458-
sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0)
1471+
poa_sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0)
14591472

14601473
if return_components:
14611474
diffuse_components = {
1462-
'poa_sky_diffuse': sky_diffuse,
1475+
'poa_sky_diffuse': poa_sky_diffuse,
14631476
'poa_isotropic': dhi * term1,
14641477
'poa_circumsolar': dhi * term2,
14651478
'poa_horizon': dhi * term3
14661479
}
14671480

1468-
if isinstance(sky_diffuse, pd.Series):
1481+
if isinstance(poa_sky_diffuse, pd.Series):
14691482
diffuse_components = pd.DataFrame(diffuse_components)
14701483

14711484
return diffuse_components
14721485
else:
1473-
return sky_diffuse
1486+
return poa_sky_diffuse
14741487

14751488

14761489
def _poa_from_ghi(surface_tilt, surface_azimuth,

‎tests/test_irradiance.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_get_ground_diffuse_simple_float():
128128

129129
def test_get_ground_diffuse_simple_series(irrad_data):
130130
ground_irrad = irradiance.get_ground_diffuse(40, irrad_data['ghi'])
131-
assert ground_irrad.name == 'diffuse_ground'
131+
assert ground_irrad.name == 'poa_ground_diffuse'
132132

133133

134134
def test_get_ground_diffuse_albedo_0(irrad_data):
@@ -142,7 +142,7 @@ def test_get_ground_diffuse_albedo_series(times):
142142
ground_irrad = irradiance.get_ground_diffuse(
143143
45, pd.Series(1000, index=times), albedo)
144144
expected = albedo * 0.5 * (1 - np.sqrt(2) / 2.) * 1000
145-
expected.name = 'diffuse_ground'
145+
expected.name = 'poa_ground_diffuse'
146146
assert_series_equal(ground_irrad, expected)
147147

148148

0 commit comments

Comments
 (0)