Skip to content

Commit 6d886dc

Browse files
kurt-rheeKurt RheekandersolarAdamRJensenKurt Rhee
authored
changed default types to float in solarposition.py (#2280)
* changed default types to float in solarposition.py * switched to floats in the docstrings and removed type hints * Update pvlib/solarposition.py Co-authored-by: Kevin Anderson <[email protected]> * Update pvlib/solarposition.py Co-authored-by: Adam R. Jensen <[email protected]> * attempt to fix flake8 errors I hope that this fixes the flake8 errors. I attempted to mimic the multi-line links seen in other parts of this .py file * Apply suggestions from code review --------- Co-authored-by: Kurt Rhee <[email protected]> Co-authored-by: Kevin Anderson <[email protected]> Co-authored-by: Adam R. Jensen <[email protected]> Co-authored-by: Kurt Rhee <[email protected]>
1 parent a17da47 commit 6d886dc

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

pvlib/solarposition.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
def get_solarposition(time, latitude, longitude,
3131
altitude=None, pressure=None,
3232
method='nrel_numpy',
33-
temperature=12, **kwargs):
33+
temperature=12.0, **kwargs):
3434
"""
3535
A convenience wrapper for the solar position calculators.
3636
@@ -125,8 +125,8 @@ def get_solarposition(time, latitude, longitude,
125125
return ephem_df
126126

127127

128-
def spa_c(time, latitude, longitude, pressure=101325, altitude=0,
129-
temperature=12, delta_t=67.0,
128+
def spa_c(time, latitude, longitude, pressure=101325., altitude=0.,
129+
temperature=12., delta_t=67.0,
130130
raw_spa_output=False):
131131
r"""
132132
Calculate the solar position using the C implementation of the NREL
@@ -149,11 +149,11 @@ def spa_c(time, latitude, longitude, pressure=101325, altitude=0,
149149
longitude : float
150150
Longitude in decimal degrees. Positive east of prime meridian,
151151
negative to west.
152-
pressure : float, default 101325
152+
pressure : float, default 101325.0
153153
Pressure in Pascals
154-
altitude : float, default 0
154+
altitude : float, default 0.0
155155
Height above sea level. [m]
156-
temperature : float, default 12
156+
temperature : float, default 12.0
157157
Temperature in C
158158
delta_t : float, default 67.0
159159
Difference between terrestrial time and UT1.
@@ -279,7 +279,7 @@ def _datetime_to_unixtime(dtindex):
279279

280280

281281
def spa_python(time, latitude, longitude,
282-
altitude=0, pressure=101325, temperature=12, delta_t=67.0,
282+
altitude=0., pressure=101325., temperature=12., delta_t=67.0,
283283
atmos_refract=None, how='numpy', numthreads=4):
284284
"""
285285
Calculate the solar position using a python implementation of the
@@ -302,11 +302,11 @@ def spa_python(time, latitude, longitude,
302302
longitude : float
303303
Longitude in decimal degrees. Positive east of prime meridian,
304304
negative to west.
305-
altitude : float, default 0
305+
altitude : float, default 0.0
306306
Distance above sea level.
307-
pressure : int or float, optional, default 101325
307+
pressure : int or float, optional, default 101325.0
308308
avg. yearly air pressure in Pascals.
309-
temperature : int or float, optional, default 12
309+
temperature : int or float, optional, default 12.0
310310
avg. yearly air temperature in degrees C.
311311
delta_t : float or array, optional, default 67.0
312312
Difference between terrestrial time and UT1.
@@ -507,9 +507,9 @@ def _ephem_setup(latitude, longitude, altitude, pressure, temperature,
507507

508508
def sun_rise_set_transit_ephem(times, latitude, longitude,
509509
next_or_previous='next',
510-
altitude=0,
511-
pressure=101325,
512-
temperature=12, horizon='0:00'):
510+
altitude=0.,
511+
pressure=101325.,
512+
temperature=12., horizon='0:00'):
513513
"""
514514
Calculate the next sunrise and sunset times using the PyEphem package.
515515
@@ -523,11 +523,11 @@ def sun_rise_set_transit_ephem(times, latitude, longitude,
523523
Longitude in degrees, positive east of prime meridian, negative to west
524524
next_or_previous : str
525525
'next' or 'previous' sunrise and sunset relative to time
526-
altitude : float, default 0
526+
altitude : float, default 0.0
527527
distance above sea level in meters.
528-
pressure : int or float, optional, default 101325
528+
pressure : int or float, optional, default 101325.0
529529
air pressure in Pascals.
530-
temperature : int or float, optional, default 12
530+
temperature : int or float, optional, default 12.0
531531
air temperature in degrees C.
532532
horizon : string, format +/-X:YY
533533
arc degrees:arc minutes from geometrical horizon for sunrise and
@@ -590,8 +590,8 @@ def sun_rise_set_transit_ephem(times, latitude, longitude,
590590
'transit': trans})
591591

592592

593-
def pyephem(time, latitude, longitude, altitude=0, pressure=101325,
594-
temperature=12, horizon='+0:00'):
593+
def pyephem(time, latitude, longitude, altitude=0., pressure=101325.,
594+
temperature=12., horizon='+0:00'):
595595
"""
596596
Calculate the solar position using the PyEphem package.
597597
@@ -605,11 +605,11 @@ def pyephem(time, latitude, longitude, altitude=0, pressure=101325,
605605
longitude : float
606606
Longitude in decimal degrees. Positive east of prime meridian,
607607
negative to west.
608-
altitude : float, default 0
608+
altitude : float, default 0.0
609609
Height above sea level in meters. [m]
610-
pressure : int or float, optional, default 101325
610+
pressure : int or float, optional, default 101325.0
611611
air pressure in Pascals.
612-
temperature : int or float, optional, default 12
612+
temperature : int or float, optional, default 12.0
613613
air temperature in degrees C.
614614
horizon : string, optional, default '+0:00'
615615
arc degrees:arc minutes from geometrical horizon for sunrise and
@@ -679,7 +679,7 @@ def pyephem(time, latitude, longitude, altitude=0, pressure=101325,
679679
return sun_coords
680680

681681

682-
def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):
682+
def ephemeris(time, latitude, longitude, pressure=101325.0, temperature=12.0):
683683
"""
684684
Python-native solar position calculator.
685685
The accuracy of this code is not guaranteed.
@@ -695,9 +695,9 @@ def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):
695695
longitude : float
696696
Longitude in decimal degrees. Positive east of prime meridian,
697697
negative to west.
698-
pressure : float or Series, default 101325
698+
pressure : float or Series, default 101325.0
699699
Ambient pressure (Pascals)
700-
temperature : float or Series, default 12
700+
temperature : float or Series, default 12.0
701701
Ambient temperature (C)
702702
703703
Returns
@@ -856,8 +856,8 @@ def ephemeris(time, latitude, longitude, pressure=101325, temperature=12):
856856

857857

858858
def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value,
859-
altitude=0, pressure=101325, temperature=12, horizon='+0:00',
860-
xtol=1.0e-12):
859+
altitude=0.0, pressure=101325.0, temperature=12.0,
860+
horizon='+0:00', xtol=1.0e-12):
861861
"""
862862
Calculate the time between lower_bound and upper_bound
863863
where the attribute is equal to value. Uses PyEphem for
@@ -879,12 +879,12 @@ def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value,
879879
and 'az' (which must be given in radians).
880880
value : int or float
881881
The value of the attribute to solve for
882-
altitude : float, default 0
882+
altitude : float, default 0.0
883883
Distance above sea level.
884-
pressure : int or float, optional, default 101325
884+
pressure : int or float, optional, default 101325.0
885885
Air pressure in Pascals. Set to 0 for no
886886
atmospheric correction.
887-
temperature : int or float, optional, default 12
887+
temperature : int or float, optional, default 12.0
888888
Air temperature in degrees C.
889889
horizon : string, optional, default '+0:00'
890890
arc degrees:arc minutes from geometrical horizon for sunrise and

0 commit comments

Comments
 (0)