-
Notifications
You must be signed in to change notification settings - Fork 0
/
endresread.ipy
46 lines (37 loc) · 1.43 KB
/
endresread.ipy
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
# Read residual arrays from SHEMAT-Suite vtk output
import numpy as np
from pskf.tools.plot import plotfunctions as pf
from pskf.tools.run import pythonmodule as pm
from pskf.tools.run import runmodule as rm
model_name = 'model'
num_ensemble_sizes = 7
residual_file_name = 'residual_E1.vtk'
which_res = 'endres' # 'endres' or 'begres'
dats = ['2010_01_30' for i in range(num_ensemble_sizes)]
lets = ['b', 'aln', 'bxz', 'dkl', 'ewx', 'gjj', 'hvv']
nums = [1000, 1000, 1000, 1000, 100, 100, 100]
num_obss = [100 for i in range(num_ensemble_sizes)]
for j in range(num_ensemble_sizes):
# Read in specific date, letter, array-size and number of observations
dat = dats[j]
let = lets[j]
num = nums[j]
num_obs = num_obss[j]
# Time index
nt = (num_obs-1 if which_res == 'endres' else 0)
# Read residual array
res = [pf.my_vtk_to_numpy(pf.my_vtk(
rm.make_output_dirs(model_name, dat, rm.get_let_num(i))[2],
residual_file_name,
'rms_kz_aft'))[nt][0]
for i in range(rm.get_num_let(let), rm.get_num_let(let)+num)]
# Save residual array
np.save(pm.py_output_filename('dists',
which_res,
model_name+'_'+dat+'_'+let,
'npy'),
res)
res = None
print('endresread.ipy for ', model_name)
print('\n', dats, '\n', lets, '\n', nums, '\n')
print(num_obss, '\n', 'Done')