-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeatherData.py
More file actions
59 lines (49 loc) · 1.59 KB
/
Copy pathWeatherData.py
File metadata and controls
59 lines (49 loc) · 1.59 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from datetime import datetime
# the weatherdata class stores the data for use
class WeatherDataStruct:
temps = []
dews = []
pressures = []
datatimes = []
times = []
def appendWeatherData(self, data):
self.temps.append(data.temp)
self.dews.append(data.dew)
self.pressures.append(data.pressure)
self.datatimes.append(data.datatime)
self.times.append(datetime.now().strftime('%m-%d-%y %H:%M'))
def appendTemp(self, temp):
self.temps.append(temp)
def appendDew(self, dew):
self.dews.append(dew)
def appendpressure(self, pressure):
self.pressures.append(pressure)
def appendNowTime(self):
self.times.append(datetime.now().strftime('%m-%d-%y %H:%M'))
def to_dict(self):
return {
'times': self.times,
'temps': self.temps,
'dews': self.dews,
'pressures': self.pressures,
'datatimes': self.datatimes
}
# the weatherdata class stores the data for use
class WeatherDataPoint:
temp = 0
dew = 0
pressure = 0
time = 0
datatime = ""
def __init__(self, temp, dew, pressure, datatime):
self.temp = temp
self.dew = dew
self.pressure = pressure
self.datatime = datatime
self.time = datetime.now().strftime('%m-%d-%y %H:%M')
def show(self):
print("the temperature is: " + self.temp)
print("the dew point is: " + self.dew)
print("the pressure is: " + self.pressure)
print("the data time is: " + self.datatime)
print("the time is:" + self.time)