Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Extend functionality to sum up all wind directions
by mapping. Need to tidy up formatting and make it consistent and sort out the |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | origin/master |
Files: | files | file ages | folders |
SHA3-256: |
6912ce6208fd6f682c3b228d50dc2336 |
User & Date: | base@atomicules.co.uk 2014-11-30 11:02:39 |
2014-12-05
| ||
20:43 |
Housekeeping: Formatting, variable naming consistency, etc
- Get rid of the mixed up mess of CamelCase, underscores, prefixes, | |
2014-11-30
| ||
11:02 |
Extend functionality to sum up all wind directions
by mapping. Need to tidy up formatting and make it consistent and sort out the | |
2014-11-29
| ||
17:52 |
Yay! Working prototype. Will sum up the distances of headwinds...
...for a polyline route. I'd made silly mistakes like forgetting which order the list of tuples Now need to extend this to sum up all wind directions and check for | |
Changes to headsilose.erl.
︙ | ︙ | |||
206 207 208 209 210 211 212 | List_of_distances_and_compass = convert_lats_longs_to_distance_heading(Polyline_decoded), %If now have a set of co-ords need to figure out distances and directions List_of_distances_and_wind = lists:map(fun({Distance, Compass}) -> Wind = head_side_or_tail_wind(Compass, [Headwinds, Sidewinds, Tailwinds]), {Distance, Wind} end, List_of_distances_and_compass), | | < | | | > > | > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | List_of_distances_and_compass = convert_lats_longs_to_distance_heading(Polyline_decoded), %If now have a set of co-ords need to figure out distances and directions List_of_distances_and_wind = lists:map(fun({Distance, Compass}) -> Wind = head_side_or_tail_wind(Compass, [Headwinds, Sidewinds, Tailwinds]), {Distance, Wind} end, List_of_distances_and_compass), [Headw, Sidew, Tailw] = lists:map(fun(Wind_group) -> lists:filter(fun({_Distance, Wind_type}) -> Wind_type == Wind_group end, List_of_distances_and_wind) end, [headwind, sidewind, tailwind]), [Sum_of_Headw, Sum_of_Sidew, Sum_of_Tailw] = lists:map(fun(Windg) -> lists:foldl(fun({Distance2, _Wind}, Sum) -> Distance2 + Sum end, 0, Windg) end, [Headw, Sidew, Tailw]). %io:format("Direction: ~s~nSpeed: ~s mph~nGust: ~s mph~nWeather type: ~s~nTemperature: ~s deg C~n", [Direction, Speed, Gust, Weather_type, Temperature]). %Need to read API key from file readapikey() -> {_Status, KeyB} = file:read_file(os:getenv("HOME") ++ "/.datapoint"), string:strip(erlang:binary_to_list(KeyB),right,$\n). |