cylc/flow/etc/tutorial/runtime-introduction/bin/get-observations
raw| 1 | #!/usr/bin/env python3 |
| 2 | """A dummy script which randomly guesses weather conditions.""" |
| 3 | |
| 4 | from random import random |
| 5 | from time import sleep |
| 6 | |
| 7 | |
| 8 | def main(): |
| 9 | print('Guessing Weather Conditions') |
| 10 | wind_speed = random() * 10 |
| 11 | wind_direction = random() * 360 |
| 12 | |
| 13 | print('Writing Out Wind Data') |
| 14 | with open('wind.csv', 'w+') as data_file: |
| 15 | data_file.write('%f, %f' % (wind_speed, wind_direction)) |
| 16 | |
| 17 | sleep(3) |
| 18 | |
| 19 | if __name__ == '__main__': |
| 20 | main() |