Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

FIODaily off-by-one #2

Closed
kousu opened this issue Aug 30, 2016 · 2 comments
Closed

FIODaily off-by-one #2

kousu opened this issue Aug 30, 2016 · 2 comments
Assignees

Comments

@kousu
Copy link

kousu commented Aug 30, 2016

In FIODaily, day_1_* is actually day 8 and everything else is shifted by 1:

# daily_cycle_bug.py
from forecastiopy import *
import time

YOUR_API_KEY = open("FORECASTIO_API_KEY.txt").read().strip()

location=[25.5, -83.566667]

fio = ForecastIO.ForecastIO(YOUR_API_KEY, latitude=location[0], longitude=location[1])
d = FIODaily.FIODaily(fio)

print(time.ctime(d.day_1_time))
print(time.ctime(d.day_2_time))
print(time.ctime(d.day_3_time))
print(time.ctime(d.day_4_time))
print(time.ctime(d.day_5_time))
print(time.ctime(d.day_6_time))
print(time.ctime(d.day_7_time))
print(time.ctime(d.day_8_time))

output:

$ python daily_cycle_bug.py 
Mon Sep  5 00:00:00 2016
Mon Aug 29 00:00:00 2016
Tue Aug 30 00:00:00 2016
Wed Aug 31 00:00:00 2016
Thu Sep  1 00:00:00 2016
Fri Sep  2 00:00:00 2016
Sat Sep  3 00:00:00 2016
Sun Sep  4 00:00:00 2016
@dvdme
Copy link
Owner

dvdme commented Aug 31, 2016

That error was already identified by someone who emailed me days ago.
That happend because in Python some_list[-1] is the last element.
There is a branch fix_wrong_ids where this should be fixed, but the count now starts from 0, 0 being the current day. As it should be.
I still have to update pip.

@dvdme dvdme self-assigned this Aug 31, 2016
@kousu
Copy link
Author

kousu commented Sep 1, 2016

Oh cool. Thanks.

@kousu kousu closed this as completed Sep 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants