-
Notifications
You must be signed in to change notification settings - Fork 0
/
genmapvars.py
36 lines (26 loc) · 945 Bytes
/
genmapvars.py
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
import random
import numpy as np
#Generates random example features to be placed in a map.
#For example, a meteorlogical variable t850 at location 300 on lookaheada day 8
#will have the format string:
#
#300_t850_8
#This is the format I'll stick to when creating the final filtered list of
#features
#You can let this script save this as a file (called genvars.py) to load with
#numpy or you can copy-paste/import the function to where you need it
def genmapvars(genfile=False):
meteo_vars = ['pw','t850','v850','u850','v300','u300','z1000','z500','z300']
length = random.randint(25, 50)
arr = np.array([])
for i in range(0, length):
loc = random.randint(0, 5327)
day = random.randint(6,9)
var = meteo_vars[random.randint(0,8)]
string = '%d_%s_%d' % (loc, var, day)
random.randint(6,9)
arr = np.append(arr, string)
if(genfile):
np.save(file='genvars.npy', arr=arr)
return arr
print(genmapvars(genfile=False))