def get_extra_radiation(doy, solar_constant=1366.1):
    """
    Determine extraterrestrial radiation from day of year (using the spencer method).

    Note:
        [1] M. Reno, C. Hansen, and J. Stein, "Global Horizontal Irradiance
        Clear Sky Models: Implementation and Analysis", Sandia National
        Laboratories, SAND2012-2389, 2012.

        [2] <http://solardat.uoregon.edu/SolarRadiationBasics.html>, Eqs.
        SR1 and SR2

    Args:
        doy : array of integers representing the days of the year.
        solar_constant : float, default 1366.1
            The solar constant.

    Returns:
        dni_extra : float, array, or Series
            The extraterrestrial radiation present in watts per square meter
            on a surface which is normal to the sun. Pandas Timestamp and
            DatetimeIndex inputs will yield a Pandas TimeSeries. All other
            inputs will yield a float or an array of floats.
    """
    # Calculates the day angle for the Earth's orbit around the Sun.
    B = (2. * math.pi / 365.) * (doy - 1)
    # Calculate R over R squared from the angle
    RoverR0sqrd = (1.00011 + 0.034221 * math.cos(B) + 0.00128 * math.sin(B) +
                   0.000719 * math.cos(2 * B) + 7.7e-05 * math.sin(2 * B))

    Ea = solar_constant * RoverR0sqrd

    return Ea