Skip to content
Merged
Changes from 2 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
68 changes: 37 additions & 31 deletions pvlib/solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@
from pvlib.tools import datetime_to_djd, djd_to_datetime


def get_solarposition(time, latitude, longitude,
altitude=None, pressure=None,
method='nrel_numpy',
temperature=12, **kwargs):
def get_solarposition(
time,
latitude,
longitude,
altitude,
pressure = None,

Check failure on line 35 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E251 unexpected spaces around keyword / parameter equals

Check failure on line 35 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E251 unexpected spaces around keyword / parameter equals
method = 'nrel_numpy',

Check failure on line 36 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E251 unexpected spaces around keyword / parameter equals

Check failure on line 36 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E251 unexpected spaces around keyword / parameter equals
temperature = 12.,

Check failure on line 37 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E251 unexpected spaces around keyword / parameter equals

Check failure on line 37 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E251 unexpected spaces around keyword / parameter equals
**kwargs
):
"""
A convenience wrapper for the solar position calculators.
Expand Down Expand Up @@ -125,8 +131,8 @@
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 +155,11 @@
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 +285,7 @@


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 +308,11 @@
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 +513,9 @@

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 +529,11 @@
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 +596,8 @@
'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 +611,11 @@
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 +685,7 @@
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 +701,9 @@
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,7 +862,7 @@


def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value,
altitude=0, pressure=101325, temperature=12, horizon='+0:00',
altitude=0.0, pressure=101325.0, temperature=12.0, horizon='+0:00',

Check failure on line 865 in pvlib/solarposition.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E501 line too long (81 > 79 characters)
xtol=1.0e-12):
"""
Calculate the time between lower_bound and upper_bound
Expand All @@ -879,12 +885,12 @@
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
Loading