cell = ['{}, {}. {}'.format(DAY_OF_WEEK_DE[d.weekday()], d.day, MONTH_DE[d.month-1])]
for t in report_times:
report_datetime = datetime.datetime.combine(d.date(), t)
- closed_index = np.argmin(np.abs(x - report_datetime))
- if abs(x[closed_index] - report_datetime) > datetime.timedelta(hours=1):
+ closest_index = np.argmin(np.abs(x - report_datetime))
+ if abs(x[closest_index] - report_datetime) > datetime.timedelta(hours=1):
cell.append('N/A')
else:
- value = y[closed_index]
+ value = y[closest_index]
cell.append('{:.1f}° C'.format(value))
cells.append(cell)