Skip to content
Newer
Older
100644 207 lines (180 sloc) 5.68 KB
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 14, 2012
1 /*
2 * history.go
3 *
4 * This file is part of wu. It contains functions related to
5 * the --planner switch (travel planner based on historical data).
6 *
7 * Written and maintained by Stephen Ramsay <sramsay.unl@gmail.com>
8 * and Anthony Starks.
9 *
583b495 @sramsay Leveled package structure (to main).
authored Apr 21, 2012
10 * Last Modified: Sat Apr 21 14:39:23 CDT 2012
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
11 *
12 * Copyright © 2010-2011 by Stephen Ramsay and Anthony Starks.
13 *
14 * wu is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3, or (at your option)
17 * any later version.
18 *
19 * wu is distributed in the hope that it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 * License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with wu; see the file COPYING. If not see
26 * <http://www.gnu.org/licenses/>.
27 */
28
a385f01 @sramsay Reorganizing files.
authored Apr 21, 2012
29 package main
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
30
31 import (
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
32 "fmt"
33 "os"
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
34 )
35
36 type PlannerConditions struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
37 Trip Trip
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
38 }
39
40 type Trip struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
41 Title string
42 Airport_code string
43 Error string
44 Chance_of Chance_of
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
45 }
46
47 type Chance_of struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
48 Tempoversixty Tempoversixty
49 Chanceofwindyday Chanceofwindyday
50 Chanceofsunnycloudyday Chanceofsunnycloudyday
51 Chanceofprecip Chanceofprecip
52 Chanceofrainday Chanceofrainday
53 Chanceofpartlycloudyday Chanceofpartlycloudyday
54 Chanceofthunderday Chanceofthunderday
55 Chanceofhumidday Chanceofhumidday
56 Chanceofcloudyday Chanceofcloudyday
57 Tempoverfreezing Tempoverfreezing
58 Tempoverninety Tempoverninety
59 Chanceoffogday Chanceoffogday
60 Chanceofsnowonground Chanceofsnowonground
61 Chanceoftornadoday Chanceoftornadoday
62 Chanceofsultryday Chanceofsultryday
63 Tempbelowfreezing Tempbelowfreezing
64 Chanceofhailday Chanceofhailday
65 Chanceofsnowday Chanceofsnowday
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
66 }
67
68 type Tempoversixty struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
69 Name string
70 Description string
71 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
72 }
73
74 type Chanceofwindyday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
75 Name string
76 Description string
77 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
78 }
79
80 type Chanceofsunnycloudyday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
81 Name string
82 Description string
83 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
84 }
85
86 type Chanceofprecip struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
87 Name string
88 Description string
89 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
90 }
91
92 type Chanceofrainday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
93 Name string
94 Description string
95 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
96 }
97
98 type Chanceofpartlycloudyday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
99 Name string
100 Description string
101 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
102 }
103
104 type Chanceofthunderday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
105 Name string
106 Description string
107 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
108 }
109
110 type Chanceofhumidday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
111 Name string
112 Description string
113 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
114 }
115
116 type Chanceofcloudyday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
117 Name string
118 Description string
119 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
120 }
121
122 type Tempoverfreezing struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
123 Name string
124 Description string
125 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
126 }
127
128 type Tempoverninety struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
129 Name string
130 Description string
131 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
132 }
133
134 type Chanceoffogday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
135 Name string
136 Description string
137 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
138 }
139
140 type Chanceofsnowonground struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
141 Name string
142 Description string
143 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
144 }
145
146 type Chanceoftornadoday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
147 Name string
148 Description string
149 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
150 }
151
152 type Chanceofsultryday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
153 Name string
154 Description string
155 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
156 }
157
158 type Tempbelowfreezing struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
159 Name string
160 Description string
161 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
162 }
163
164 type Chanceofhailday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
165 Name string
166 Description string
167 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
168 }
169
170 type Chanceofsnowday struct {
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
171 Name string
172 Description string
173 Percentage string
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
174 }
175
176 func PrintPlanner(obs *PlannerConditions, stationId string) {
177
0156002 @sramsay Reformatted code.
authored Apr 21, 2012
178 if obs.Trip.Error != "" {
179 fmt.Println(obs.Trip.Error)
180 os.Exit(0)
181 }
182
183 planner := obs.Trip.Chance_of
184 fmt.Println(obs.Trip.Title)
185 fmt.Println("Station: " + obs.Trip.Airport_code)
186 fmt.Println("Chance of: ")
187 fmt.Println(" Temps:")
188 fmt.Printf(" Over 90 F (32 C): %s%%\n", planner.Tempoverninety.Percentage)
189 fmt.Printf(" Between 60 F (15 C) and 90 F (32 C): %s%%\n", planner.Tempoversixty.Percentage)
190 fmt.Printf(" Between 32 F (0 C) and 60 (16 C): %s%%\n", planner.Tempoversixty.Percentage)
191 fmt.Printf(" Below 32 F (0 C): %s%%\n", planner.Tempbelowfreezing.Percentage)
192 fmt.Printf(" Dewpoint above 70 F (21 C): %s%%\n", planner.Chanceofsultryday.Percentage)
193 fmt.Printf(" Dewpoint above 60 F (15 C): %s%%\n", planner.Chanceofhumidday.Percentage)
194 fmt.Printf(" Winds over 10 mph (15 km/h): %s%%\n", planner.Chanceofwindyday.Percentage)
195 fmt.Printf(" %s day: %s%%\n", planner.Chanceofsunnycloudyday.Name, planner.Chanceofsunnycloudyday.Percentage)
196 fmt.Printf(" %s day: %s%%\n", planner.Chanceofcloudyday.Name, planner.Chanceofcloudyday.Percentage)
197 fmt.Printf(" %s day: %s%%\n", planner.Chanceofpartlycloudyday.Name, planner.Chanceofpartlycloudyday.Percentage)
198 fmt.Printf(" %s: %s%%\n", planner.Chanceofprecip.Name, planner.Chanceofprecip.Percentage)
199 fmt.Printf(" %s: %s%%\n", planner.Chanceoffogday.Name, planner.Chanceoffogday.Percentage)
200 fmt.Printf(" %s: %s%%\n", planner.Chanceofrainday.Name, planner.Chanceofrainday.Percentage)
201 fmt.Printf(" %s: %s%%\n", planner.Chanceofthunderday.Name, planner.Chanceofthunderday.Percentage)
202 fmt.Printf(" %s: %s%%\n", planner.Chanceoftornadoday.Name, planner.Chanceoftornadoday.Percentage)
203 fmt.Printf(" %s: %s%%\n", planner.Chanceofhailday.Name, planner.Chanceofhailday.Percentage)
204 fmt.Printf(" %s: %s%%\n", planner.Chanceofsnowday.Name, planner.Chanceofsnowday.Percentage)
205 fmt.Printf(" %s: %s%%\n", planner.Chanceofsnowonground.Name, planner.Chanceofsnowonground.Percentage)
66db80f @sramsay Added travel planner (--planner=MMDDMMDD).
authored Jan 15, 2012
206 }
Something went wrong with that request. Please try again.