Skip to content
Merged
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
65 changes: 34 additions & 31 deletions pvlib/solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
def get_solarposition(time, latitude, longitude,
altitude=None, pressure=None,
method='nrel_numpy',
temperature=12, **kwargs):
temperature=12.0, **kwargs):
"""
A convenience wrapper for the solar position calculators.

Expand Down Expand Up @@ -125,8 +125,8 @@ def get_solarposition(time, latitude, longitude,
return ephem_df


def spa_c(time, latitude, longitude, pressure=101325, altitude=0,
temperature=12, delta_t=67.0,
def spa_c(time, latitude, longitude, pressure=101325., altitude=0.,
temperature=12., delta_t=67.0,
raw_spa_output=False):
r"""
Calculate the solar position using the C implementation of the NREL
Expand All @@ -149,11 +149,11 @@ def spa_c(time, latitude, longitude, pressure=101325, altitude=0,
longitude : float
Longitude in decimal degrees. Positive east of prime meridian,
negative to west.
pressure : float, default 101325
pressure : float, default 101325.0
Pressure in Pascals
altitude : float, default 0
altitude : float, default 0.0
Height above sea level. [m]
temperature : float, default 12
temperature : float, default 12.0
Temperature in C
delta_t : float, default 67.0
Difference between terrestrial time and UT1.
Expand Down Expand Up @@ -279,7 +279,7 @@ def _datetime_to_unixtime(dtindex):


def spa_python(time, latitude, longitude,
altitude=0, pressure=101325, temperature=12, delta_t=67.0,
altitude=0., pressure=101325., temperature=12., delta_t=67.0,
atmos_refract=None, how='numpy', numthreads=4):
"""
Calculate the solar position using a python implementation of the
Expand All @@ -302,11 +302,11 @@ def spa_python(time, latitude, longitude,
longitude : float
Longitude in decimal degrees. Positive east of prime meridian,
negative to west.
altitude : float, default 0
altitude : float, default 0.0
Distance above sea level.
pressure : int or float, optional, default 101325
pressure : int or float, optional, default 101325.0
avg. yearly air pressure in Pascals.
temperature : int or float, optional, default 12
temperature : int or float, optional, default 12.0
avg. yearly air temperature in degrees C.
delta_t : float or array, optional, default 67.0
Difference between terrestrial time and UT1.
Expand Down Expand Up @@ -507,9 +507,9 @@ def _ephem_setup(latitude, longitude, altitude, pressure, temperature,

def sun_rise_set_transit_ephem(times, latitude, longitude,
next_or_previous='next',
altitude=0,
pressure=101325,
temperature=12, horizon='0:00'):
altitude=0.,
pressure=101325.,
temperature=12., horizon='0:00'):
"""
Calculate the next sunrise and sunset times using the PyEphem package.

Expand All @@ -523,11 +523,11 @@ def sun_rise_set_transit_ephem(times, latitude, longitude,
Longitude in degrees, positive east of prime meridian, negative to west
next_or_previous : str
'next' or 'previous' sunrise and sunset relative to time
altitude : float, default 0
altitude : float, default 0.0
distance above sea level in meters.
pressure : int or float, optional, default 101325
pressure : int or float, optional, default 101325.0
air pressure in Pascals.
temperature : int or float, optional, default 12
temperature : int or float, optional, default 12.0
air temperature in degrees C.
horizon : string, format +/-X:YY
arc degrees:arc minutes from geometrical horizon for sunrise and
Expand Down Expand Up @@ -590,8 +590,8 @@ def sun_rise_set_transit_ephem(times, latitude, longitude,
'transit': trans})


def pyephem(time, latitude, longitude, altitude=0, pressure=101325,
temperature=12, horizon='+0:00'):
def pyephem(time, latitude, longitude, altitude=0., pressure=101325.,
temperature=12., horizon='+0:00'):
"""
Calculate the solar position using the PyEphem package.

Expand All @@ -605,11 +605,11 @@ def pyephem(time, latitude, longitude, altitude=0, pressure=101325,
longitude : float
Longitude in decimal degrees. Positive east of prime meridian,
negative to west.
altitude : float, default 0
altitude : float, default 0.0
Height above sea level in meters. [m]
pressure : int or float, optional, default 101325
pressure : int or float, optional, default 101325.0
air pressure in Pascals.
temperature : int or float, optional, default 12
temperature : int or float, optional, default 12.0
air temperature in degrees C.
horizon : string, optional, default '+0:00'
arc degrees:arc minutes from geometrical horizon for sunrise and
Expand Down Expand Up @@ -679,7 +679,7 @@ def pyephem(time, latitude, longitude, altitude=0, pressure=101325,
return sun_coords


def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):
def ephemeris(time, latitude, longitude, pressure=101325.0, temperature=12.0):
"""
Python-native solar position calculator.
The accuracy of this code is not guaranteed.
Expand All @@ -695,9 +695,9 @@ def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):
longitude : float
Longitude in decimal degrees. Positive east of prime meridian,
negative to west.
pressure : float or Series, default 101325
pressure : float or Series, default 101325.0
Ambient pressure (Pascals)
temperature : float or Series, default 12
temperature : float or Series, default 12.0
Ambient temperature (C)

Returns
Expand Down Expand Up @@ -856,8 +856,8 @@ def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):


def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value,
altitude=0, pressure=101325, temperature=12, horizon='+0:00',
xtol=1.0e-12):
altitude=0.0, pressure=101325.0, temperature=12.0,
horizon='+0:00', xtol=1.0e-12):
"""
Calculate the time between lower_bound and upper_bound
where the attribute is equal to value. Uses PyEphem for
Expand All @@ -879,12 +879,12 @@ def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value,
and 'az' (which must be given in radians).
value : int or float
The value of the attribute to solve for
altitude : float, default 0
altitude : float, default 0.0
Distance above sea level.
pressure : int or float, optional, default 101325
pressure : int or float, optional, default 101325.0
Air pressure in Pascals. Set to 0 for no
atmospheric correction.
temperature : int or float, optional, default 12
temperature : int or float, optional, default 12.0
Air temperature in degrees C.
horizon : string, optional, default '+0:00'
arc degrees:arc minutes from geometrical horizon for sunrise and
Expand Down Expand Up @@ -1052,7 +1052,9 @@ def equation_of_time_spencer71(dayofyear):
Myers [4]_ and printed in both the Fourier paper from the Sundial
Mailing List and R. Hulstrom's [5]_ book.

.. _Fourier paper: http://www.mail-archive.com/[email protected]/msg01050.html
.. `Fourier paper:
<http://www.mail-archive.com/
[email protected]/msg01050.html>`_

Parameters
----------
Expand Down Expand Up @@ -1100,7 +1102,8 @@ def equation_of_time_pvcdrom(dayofyear):
`PVCDROM`_ is a website by Solar Power Lab at Arizona State
University (ASU)

.. _PVCDROM: http://www.pveducation.org/pvcdrom/2-properties-sunlight/solar-time
.. `PVCDROM: <http://www.pveducation.org/
pvcdrom/2-properties-sunlight/solar-time>`_

Parameters
----------
Expand Down
Loading