@@ -271,6 +271,8 @@ def ephemeris(time, location, pressure=101325, temperature=12):
271
271
# Most comments in this function are from PVLIB_MATLAB or from
272
272
# pvlib-python's attempt to understand and fix problems with the
273
273
# algorithm. The comments are *not* based on the reference material.
274
+ # This helps a little bit:
275
+ # http://www.cv.nrao.edu/~rfisher/Ephemerides/times.html
274
276
275
277
pvl_logger .warning ('Using solarposition.ephemeris is discouraged. '
276
278
'solarposition.pyephem and solarposition.spa are '
@@ -301,15 +303,14 @@ def ephemeris(time, location, pressure=101325, temperature=12):
301
303
302
304
# strip out the day of the year and calculate the decimal hour
303
305
DayOfYear = time_utc .dayofyear
304
- DecHours = (time_utc .hour + time_utc .minute / 60. + time_utc .second / 3600.
306
+ DecHours = (time_utc .hour + time_utc .minute / 60. + time_utc .second / 3600. +
305
307
time_utc .microsecond / 3600.e6 )
306
308
307
309
UnivDate = DayOfYear
308
310
UnivHr = DecHours
309
311
310
312
Yr = Year - 1900
311
-
312
- YrBegin = 365 * Yr + np .floor ((Yr - 1 ) / float (4 )) - 0.5
313
+ YrBegin = 365 * Yr + np .floor ((Yr - 1 ) / 4. ) - 0.5
313
314
314
315
Ezero = YrBegin + UnivDate
315
316
T = Ezero / 36525.
@@ -318,7 +319,7 @@ def ephemeris(time, location, pressure=101325, temperature=12):
318
319
GMST0 = 6 / 24. + 38 / 1440. + (
319
320
45.836 + 8640184.542 * T + 0.0929 * T ** 2 ) / 86400.
320
321
GMST0 = 360 * (GMST0 - np .floor (GMST0 ))
321
- GMSTi = np .mod (GMST0 + 360 * (1.0027379093 * UnivHr / float ( 24 ) ), 360 )
322
+ GMSTi = np .mod (GMST0 + 360 * (1.0027379093 * UnivHr / 24. ), 360 )
322
323
323
324
LocAST = np .mod ((360 + GMSTi - Longitude ), 360 )
324
325
EpochDate = Ezero + UnivHr / 24.
@@ -357,7 +358,7 @@ def ephemeris(time, location, pressure=101325, temperature=12):
357
358
# potential error in the following line
358
359
SunEl = np .degrees (np .arcsin ((np .cos (LatR ) * (np .cos (DecR )) *
359
360
(np .cos (HrAngleR )) + np .sin (LatR )* (np .sin (DecR )))))
360
- SolarTime = (180 + HrAngle ) / float ( 15 )
361
+ SolarTime = (180 + HrAngle ) / 15.
361
362
362
363
# replace with conditional array assignment
363
364
Refract = []
@@ -375,7 +376,7 @@ def ephemeris(time, location, pressure=101325, temperature=12):
375
376
else :
376
377
Refract .append (0 )
377
378
378
- Refract = (np .array (Refract ) * ((283 / float (273 + temperature ))) *
379
+ Refract = (np .array (Refract ) * ((283 / (273. + temperature ))) *
379
380
pressure / 101325. / 3600. )
380
381
381
382
SunZen = 90 - SunEl
0 commit comments