forked from guglielmopadula/MedROM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
57 lines (40 loc) · 1.18 KB
/
test.py
File metadata and controls
57 lines (40 loc) · 1.18 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
import numpy as np
import cloudpickle
import matplotlib.pyplot as plt
Po=np.linspace(200,8000,10000)
Isonzo=np.linspace(0,1500,10000)
Timavo=np.linspace(8,150,10000)
variables=["N1p","N3n","S","T","Chla"]
depth={"O m":0, "10 m":1, "30 m":2, "60 m":3, "100 m":4}
# --- CONFIGURE YOUR CHOICES ---
depth_list = [0,10,30,60,100]
variables_list=["N1p","N3n","S","T","Chla"]
days_list=[0,1,2,3,4]
depth_dict={
0:0,
10:1,
30:2,
60:3,
100:4
}
# --- WIDGETS ---
days_ctx = 0
variables_ctx = 0
depth_ctx = 0
po= value=Po[-1]/2
isonzo = Isonzo[-1]/2
timavo = value=Timavo[-1]/2
# --- MODEL PREDICTION (placeholder) ---
def model_predict(days, variable, depth, po, isonzo, timavo):
tmp=np.load("{}_{}.npy".format(variable,depth))
with open("model_{}_{}.pkl".format(variable,depth_dict[depth]), 'rb') as f:
model = cloudpickle.load(f)
output=model(tmp.reshape(1,-1), isonzo.reshape(1,-1), po.reshape(1,-1), timavo.reshape(1,-1), days)
return output
# Compute
Z = model_predict(days_ctx, variables[variables_ctx], depth_ctx, po, isonzo, timavo)
# --- PLOT ---
fig, ax = plt.subplots()
ax.imshow(Z, origin='lower', aspect='auto')
# --- DISPLAY ---
plt.show()