Skip to content

Commit 1c459d3

Browse files
committed
Add return_components to isotropic
1 parent ba4c7c5 commit 1c459d3

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

pvlib/irradiance.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
595595
return diffuse_irrad
596596

597597

598-
def isotropic(surface_tilt, dhi):
598+
def isotropic(surface_tilt, dhi, return_components=False):
599599
r'''
600600
Determine diffuse irradiance from the sky on a tilted surface using
601601
the isotropic sky model.
@@ -619,11 +619,27 @@ def isotropic(surface_tilt, dhi):
619619
dhi : numeric
620620
Diffuse horizontal irradiance, must be >=0. See :term:`dhi`.
621621
622+
return_components : bool, default `False`
623+
If `False`, ``sky_diffuse`` is returned.
624+
If `True`, ``diffuse_components`` is returned.
625+
For this model, return_components does not add more information,
626+
but it is included for consistency with the other sky diffuse models.
627+
622628
Returns
623629
-------
624-
diffuse : numeric
630+
numeric, OrderedDict, or DataFrame
631+
Return type controlled by ``return_components`` argument.
632+
If `False`, ``sky_diffuse`` is returned.
633+
If `True`, ``diffuse_components`` is returned.
634+
635+
sky_diffuse : numeric
625636
The sky diffuse component of the solar radiation. [Wm⁻²]
626637
638+
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
639+
Keys/columns are:
640+
* poa_sky_diffuse: Total sky diffuse
641+
* poa_isotropic
642+
627643
References
628644
----------
629645
.. [1] Loutzenhiser P.G. et al. "Empirical validation of models to
@@ -638,7 +654,17 @@ def isotropic(surface_tilt, dhi):
638654
'''
639655
sky_diffuse = dhi * (1 + tools.cosd(surface_tilt)) * 0.5
640656

641-
return sky_diffuse
657+
if return_components:
658+
diffuse_components = OrderedDict()
659+
diffuse_components['poa_sky_diffuse'] = sky_diffuse
660+
diffuse_components['poa_isotropic'] = sky_diffuse
661+
662+
if isinstance(sky_diffuse, pd.Series):
663+
diffuse_components = pd.DataFrame(diffuse_components)
664+
665+
return diffuse_components
666+
else:
667+
return sky_diffuse
642668

643669

644670
def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,

0 commit comments

Comments
 (0)