Add `poa_` prefix to returned names when `return_components=True` in transposition functions by kandersolar · Pull Request #2627 · pvlib/pvlib-python · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/sphinx/source/whatsnew/v0.13.2.rst
5 changes: 3 additions & 2 deletions pvlib/bifacial/infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,16 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
sky_diffuse_comps_horizontal = haydavies(0, 180, dhi, dni, dni_extra,
solar_zenith, solar_azimuth,
return_components=True)
circumsolar_horizontal = sky_diffuse_comps_horizontal['circumsolar']
circumsolar_horizontal = \
sky_diffuse_comps_horizontal['poa_circumsolar']

# Call haydavies a second time where circumsolar_normal is facing
# directly towards sun, and can be added to DNI
sky_diffuse_comps_normal = haydavies(solar_zenith, solar_azimuth, dhi,
dni, dni_extra, solar_zenith,
solar_azimuth,
return_components=True)
circumsolar_normal = sky_diffuse_comps_normal['circumsolar']
circumsolar_normal = sky_diffuse_comps_normal['poa_circumsolar']

dhi = dhi - circumsolar_horizontal
dni = dni + circumsolar_normal
Expand Down
51 changes: 26 additions & 25 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,

diffuse_components : OrderedDict (array input) or DataFrame (Series input)
Keys/columns are:
* sky_diffuse: Total sky diffuse
* isotropic
* circumsolar
* horizon (always zero, not accounted for by the Hay-Davies model)
* poa_sky_diffuse: Total sky diffuse
* poa_isotropic
* poa_circumsolar
* poa_horizon (always zero, not accounted for by the
Hay-Davies model)

Notes
------
Expand Down Expand Up @@ -855,13 +856,13 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,

if return_components:
diffuse_components = OrderedDict()
diffuse_components['sky_diffuse'] = sky_diffuse
diffuse_components['poa_sky_diffuse'] = sky_diffuse

# Calculate the individual components
diffuse_components['isotropic'] = poa_isotropic
diffuse_components['circumsolar'] = poa_circumsolar
diffuse_components['horizon'] = np.where(
np.isnan(diffuse_components['isotropic']), np.nan, 0.)
diffuse_components['poa_isotropic'] = poa_isotropic
diffuse_components['poa_circumsolar'] = poa_circumsolar
diffuse_components['poa_horizon'] = np.where(
np.isnan(diffuse_components['poa_isotropic']), np.nan, 0.)

if isinstance(sky_diffuse, pd.Series):
diffuse_components = pd.DataFrame(diffuse_components)
Expand Down Expand Up @@ -1111,10 +1112,10 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,

diffuse_components : OrderedDict (array input) or DataFrame (Series input)
Keys/columns are:
* sky_diffuse: Total sky diffuse
* isotropic
* circumsolar
* horizon
* poa_sky_diffuse: Total sky diffuse
* poa_isotropic
* poa_circumsolar
* poa_horizon


References
Expand Down Expand Up @@ -1197,12 +1198,12 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,

if return_components:
diffuse_components = OrderedDict()
diffuse_components['sky_diffuse'] = sky_diffuse
diffuse_components['poa_sky_diffuse'] = sky_diffuse

# Calculate the different components
diffuse_components['isotropic'] = dhi * term1
diffuse_components['circumsolar'] = dhi * term2
diffuse_components['horizon'] = dhi * term3
diffuse_components['poa_isotropic'] = dhi * term1
diffuse_components['poa_circumsolar'] = dhi * term2
diffuse_components['poa_horizon'] = dhi * term3

# Set values of components to 0 when sky_diffuse is 0
mask = sky_diffuse == 0
Expand Down Expand Up @@ -1353,10 +1354,10 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,

diffuse_components : OrderedDict (array input) or DataFrame (Series input)
Keys/columns are:
* sky_diffuse: Total sky diffuse
* isotropic
* circumsolar
* horizon
* poa_sky_diffuse: Total sky diffuse
* poa_isotropic
* poa_circumsolar
* poa_horizon

Notes
-----
Expand Down Expand Up @@ -1417,12 +1418,12 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,

if return_components:
diffuse_components = OrderedDict()
diffuse_components['sky_diffuse'] = sky_diffuse
diffuse_components['poa_sky_diffuse'] = sky_diffuse

# Calculate the different components
diffuse_components['isotropic'] = dhi * term1
diffuse_components['circumsolar'] = dhi * term2
diffuse_components['horizon'] = dhi * term3
diffuse_components['poa_isotropic'] = dhi * term1
diffuse_components['poa_circumsolar'] = dhi * term2
diffuse_components['poa_horizon'] = dhi * term3

if isinstance(sky_diffuse, pd.Series):
diffuse_components = pd.DataFrame(diffuse_components)
Expand Down
40 changes: 19 additions & 21 deletions tests/test_irradiance.py