-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-random-forecast-data.py
More file actions
executable file
·59 lines (47 loc) · 1.26 KB
/
generate-random-forecast-data.py
File metadata and controls
executable file
·59 lines (47 loc) · 1.26 KB
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
#!/usr/bin/env python3
#
# This Python 3 script generates a set of randomized data for import into
# AWS Forecast.
#
# The output is sent to the terminal.
# To generate a file, pipe the output to a file.
import random
# Arbitrary values given to latitude, longitude and the current hour
latitude = 30
longitude = 30
hour = 8
# Array to keep track of the days of the week
days = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday' ]
day = 0
# Pick a random number between 1 and 100, and set a range for the random number
number = random.uniform(1.0,100.0)
low = 0.0
high = 100.0
if number < 20:
low = number-1
high = number+1
else:
low = number-(number/10)
high = number+(number/10)
# Print a semi-randomly generated data for our application
for i in range(50):
hour = 8
for j in range(6):
# Add leading 0
if (hour == 8 or hour == 9):
print('2019-09-08 0%d:00:00,%.4f,%.4f,%.4f,%s' % (hour,random.uniform(low,high),latitude,longitude,days[day]))
else:
print('2019-09-08 %d:00:00,%.4f,%.4f,%.4f,%s' % (hour,random.uniform(low,high),latitude,longitude,days[day]))
hour += 1
if day == 7:
day = 0
else:
day += 1