Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.6.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Bug fixes
near horizon. (:issue:`656`)
* Fixed numpy warnings in :py:func:`~pvlib.tracking.singleaxis` when
comparing NaN values to limits. (:issue:`622`)
* Fixed a bug in the day angle equation for the ASCE
extraterrestrial irradiance model. (:issue:`211`)
* Silenced divide by 0 irradiance warnings in
:py:func:`~pvlib.irradiance.klucher` and
:py:func:`~pvlib.pvsystem.calcparams_desoto`. (:issue:`698`)
Expand Down
7 changes: 6 additions & 1 deletion pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def get_extra_radiation(datetime_or_doy, solar_constant=1366.1,

[4] Duffie, J. A. and Beckman, W. A. 1991. Solar Engineering of
Thermal Processes, 2nd edn. J. Wiley and Sons, New York.

[5] ASCE, 2005. The ASCE Standardized Reference Evapotranspiration
Equation, Environmental and Water Resources Institute of the American
Civil Engineers, Ed. R. G. Allen et al.
"""

to_doy, to_datetimeindex, to_output = \
Expand All @@ -88,7 +92,8 @@ def get_extra_radiation(datetime_or_doy, solar_constant=1366.1,
# consider putting asce and spencer methods in their own functions
method = method.lower()
if method == 'asce':
B = solarposition._calculate_simple_day_angle(to_doy(datetime_or_doy))
B = solarposition._calculate_simple_day_angle(to_doy(datetime_or_doy),
offset=0)
RoverR0sqrd = 1 + 0.033 * np.cos(B)
elif method == 'spencer':
B = solarposition._calculate_simple_day_angle(to_doy(datetime_or_doy))
Expand Down
6 changes: 4 additions & 2 deletions pvlib/solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,19 +988,21 @@ def nrel_earthsun_distance(time, how='numpy', delta_t=67.0, numthreads=4):
return dist


def _calculate_simple_day_angle(dayofyear):
def _calculate_simple_day_angle(dayofyear, offset=1):
"""
Calculates the day angle for the Earth's orbit around the Sun.

Parameters
----------
dayofyear : numeric
offset : int, default 1
For the Spencer method, offset=1; for the ASCE method, offset=0

Returns
-------
day_angle : numeric
"""
return (2. * np.pi / 365.) * (dayofyear - 1)
return (2. * np.pi / 365.) * (dayofyear - offset)


def equation_of_time_spencer71(dayofyear):
Expand Down