Skip to content

Commit 1e367f3

Browse files
committed
fix flake8 issues, add comment
1 parent de5d9cb commit 1e367f3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pvlib/clearsky.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,22 +264,26 @@ def _interpolate_turbidity(lts, time):
264264
# next Jan to the array so that the interpolation will work for
265265
# Jan 1 - Jan 15 and Dec 16 - Dec 31.
266266
lts_concat = np.concatenate([[lts[-1]], lts, [lts[0]]])
267-
# Then we map the month value to the day of year value.
268267

269-
# use this for the real code
268+
# handle leap years
270269
try:
271270
isleap = time.is_leap_year
272271
except AttributeError:
273272
year = time.year
274-
isleap = _is_leap_year(time.year)
273+
isleap = _is_leap_year(year)
275274

276275
dayofyear = time.dayofyear
277276
days_leap = _calendar_month_middles(2016)
278277
days_no_leap = _calendar_month_middles(2015)
278+
279+
# Then we map the month value to the day of year value.
280+
# Do it for both leap and non-leap years.
279281
lt_leap = np.interp(dayofyear, days_leap, lts_concat)
280282
lt_no_leap = np.interp(dayofyear, days_no_leap, lts_concat)
281283
linke_turbidity = np.where(isleap, lt_leap, lt_no_leap)
284+
282285
linke_turbidity = pd.Series(linke_turbidity, index=time)
286+
283287
return linke_turbidity
284288

285289

0 commit comments

Comments
 (0)