comparison weather.tcl @ 201:92f4a489b7ef

Add data type index.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 18 Jun 2014 20:46:15 +0300
parents a496dc87a7c1
children 9b47f6d6c8bb 28ee3578a6d1
comparison
equal deleted inserted replaced
200:bfa9bbcad2e5 201:92f4a489b7ef
194 } 194 }
195 195
196 196
197 # Produce one location of weather data as a string 197 # Produce one location of weather data as a string
198 proc weather_get_data {ukey udata} { 198 proc weather_get_data {ukey udata} {
199 set str "\002[lindex $udata 0]\002, mitattu klo [weather_ctime [lindex $udata 1]]: \002[lindex $udata 2]°C\002" 199 set str "\002[lindex $udata 0]\002, mitattu klo [weather_ctime [lindex $udata 2]]: \002[lindex $udata 3]°C\002"
200 append str [weather_item $udata 4 ", @@"] 200 append str [weather_item $udata 5 ", @@"]
201 append str [weather_item $udata 5 ", kosteus \002@@%\002"] 201 append str [weather_item $udata 6 ", kosteus \002@@%\002"]
202 append str [weather_item $udata 3 ", tien pinta @@°C"] 202 append str [weather_item $udata 4 ", tien pinta @@°C"]
203 return "${str}." 203 return "${str}."
204 } 204 }
205 205
206 206
207 # Get data by location key 207 # Get data by location key
229 # Read in the data 229 # Read in the data
230 while {![eof $ufile]} { 230 while {![eof $ufile]} {
231 gets $ufile uline 231 gets $ufile uline
232 set udata [split $uline "|"] 232 set udata [split $uline "|"]
233 if {[llength $udata] > 0} { 233 if {[llength $udata] > 0} {
234 set utemp [lindex $udata 2] 234 set utemp [lindex $udata 3]
235 set ukey [lindex $udata 0] 235 set ukey [lindex $udata 0]
236 236
237 set weather_data($ukey) $udata 237 set weather_data($ukey) $udata
238 238
239 if {[string is double -strict $utemp]} { 239 if {[string is double -strict $utemp]} {