File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -264,22 +264,26 @@ def _interpolate_turbidity(lts, time):
264
264
# next Jan to the array so that the interpolation will work for
265
265
# Jan 1 - Jan 15 and Dec 16 - Dec 31.
266
266
lts_concat = np .concatenate ([[lts [- 1 ]], lts , [lts [0 ]]])
267
- # Then we map the month value to the day of year value.
268
267
269
- # use this for the real code
268
+ # handle leap years
270
269
try :
271
270
isleap = time .is_leap_year
272
271
except AttributeError :
273
272
year = time .year
274
- isleap = _is_leap_year (time . year )
273
+ isleap = _is_leap_year (year )
275
274
276
275
dayofyear = time .dayofyear
277
276
days_leap = _calendar_month_middles (2016 )
278
277
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.
279
281
lt_leap = np .interp (dayofyear , days_leap , lts_concat )
280
282
lt_no_leap = np .interp (dayofyear , days_no_leap , lts_concat )
281
283
linke_turbidity = np .where (isleap , lt_leap , lt_no_leap )
284
+
282
285
linke_turbidity = pd .Series (linke_turbidity , index = time )
286
+
283
287
return linke_turbidity
284
288
285
289
You can’t perform that action at this time.
0 commit comments