-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utilities.py
40 lines (30 loc) · 1.27 KB
/
Utilities.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from datetime import tzinfo, timedelta, datetime
import csv
class UTC_Offset(tzinfo):
# Offset assumed to be hours
def __init__(self, offset=0, name=None):
self.offset = timedelta(seconds=offset*3600)
self.name = name or self.__class__.__name__
def utcoffset(self, dt):
return self.offset
def tzname(self, dt):
return self.name
def dst(self, dt):
return timedelta(0)
# Chile observes Chile Summer Time (CLST) from 1/1/2017 - 5/13/2017 => UTC-3
# Chile observes Chile Standard Time (CLT) from 5/13/2017 - 8/12/2017 => UTC-4
# Chile observes Chile Summer Time (CLST) from 8/13/2017 - 12/31/2017 => UTC-3
lco_clst_utc_offset = -3 # hours
lco_clt_utc_offset = -4 # hours
# California observes Pacific Standard Time (PST) from 1/1/2017 - 3/12/2017 => UTC-8
# California observes Pacific Daylight Time (PDT) from 3/12/2017 - 11/5/2017 => UTC-7
# California observes Pacific Standard Time (PST) from 11/5/2017 - 12/31/2017 => UTC-8
lick_pst_utc_offset = -8 # hours
lick_pdt_utc_offset = -7 # hours
# file_name assumed to be CSV with headers...
def get_targets(file_name):
csvfile = open(file_name, 'r')
reader = csv.reader(csvfile, delimiter=',')
next(reader, None) # Skip headers
data = list(reader)
return data