-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
138 lines (99 loc) · 4.65 KB
/
main.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
'''
Created on 17.10.2014
This is the main file; where everything comes together.
It is in a do it yourself adventure style.
@author: Harald Ringbauer
'''
from load_data import WeatherData
from visualize_data import Analyze_WD
import datetime
import tkinter as tk # For the graphical user interface
def menu_text():
print("Heyyaa hope u doing well future Harald.")
wd = WeatherData()
while True:
int1 = input("\nWhat do you want to do? \n(1) Download Weather Data"
"\n(2) Calculate Summary Statistics \n(3) Analyze Weather Data"
"\n(9) Exit\n")
if int1 == 1:
while True:
int2 = input("""Download what? \n(1) Since Last Update"""
"""\n(2) All Data \n(3) Specific Dates \n(4) Back\n""")
if int2 == 1:
wd.update_local()
if int2 == 2:
int3 = input("\nWhat do you want to do?")
raise NotImplementedError("Implement this")
elif int2 == 3:
wd.update_local(all=1)
elif int2 == 4:
break
elif int1 == 3:
v_wd = Analyze_WD(wd) # Create the Analysis Object
while True:
int3 = input("What Analysis? \n(1) Monthly Rain Analysis \n(2) Monthly Sun Analysis"
"\n(3) Show Max/Min Month \n(4) Plot Mean per Month \n(5) Day Temperature\n(6) Show Records \n(9) Break\n")
if int3 == 1:
date = get_month() # Get the Date (via Input)
v_wd.visualize_rain_month(date_month=date)
elif int3 == 2:
date = get_month()
v_wd.visualize_solar_month(date_month=date)
elif int3 == 3:
date = get_month()
dtype = get_data_type()
v_wd.visualize_max_min_month(date, column=dtype)
elif int3 == 4:
date = get_month()
dtype = get_data_type()
v_wd.visualize_mean_month(date_month=date, column=dtype)
elif int3 == 5:
date = get_day() # Get the Date (via Input)
v_wd.visualize_day_data(date, column="temp")
elif int3 == 6:
date = get_month()
minimum = int(input("Value? \n(0) Maximum \n(1) Minimum\n"))
print(minimum)
dtype = get_data_type()
v_wd.visualize_records(date_month=date, date_year=0, minimum=minimum,
column=dtype)
elif int3 == 9:
break
else:
print("Invalid Input!!")
if int1 == 9: break
print("see u later alligata")
return 0
#######################################
#######################################
def doNothing():
print("lolol")
# ## Helper Input Functions; that will get called quite a bit
def get_day(year=None, month=None, day=None):
'''Return the Day Date object'''
if year == None:
year = input("What year?\n")
if month == None:
month = input("What month?\n")
if day == None:
day = input("What day?\n")
return datetime.date(year=year, month=month, day=day)
def get_month(year=None, month=None, day=None):
'''Return the Month Date object'''
if year == None:
year = input("What year?\n")
if month == None:
month = input("What month?\n")
return datetime.date(year=year, month=month, day=1)
def get_data_type():
'''What Data to visualize'''
i = input("What Data to you want to analyze?"
"\n(1) Temperature \n(2) Rain Total \n(3) Whateva\n")
if i == 1:
dtype = "temp"
elif i == 2:
dtype = "total_rain"
return dtype
# ## Call the main loop
if __name__ == "__main__":
menu_text()