PYTHON: Add refinement 'level' to be read as dataset.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
81b94a8009
commit
0ceca17a95
@ -236,6 +236,7 @@ def amun_dataset(fname, vname, shrink = 1, progress = False):
|
||||
|
||||
# add derived variables if possible
|
||||
#
|
||||
variables.append('level')
|
||||
if 'velx' in variables and 'vely' in variables and 'velz' in variables:
|
||||
variables.append('velo')
|
||||
variables.append('divv')
|
||||
@ -311,7 +312,11 @@ def amun_dataset(fname, vname, shrink = 1, progress = False):
|
||||
dz = amun_coordinate(lname, 'dz')
|
||||
f = h5.File(lname, 'r')
|
||||
g = f['variables']
|
||||
if vname == 'velo':
|
||||
if vname == 'level':
|
||||
dataset = np.zeros(g[variables[0]].shape)
|
||||
for l in range(dblocks):
|
||||
dataset[:,:,:,l] = levels[l]
|
||||
elif vname == 'velo':
|
||||
dataset = np.sqrt(g['velx'][:,:,:,:]**2 \
|
||||
+ g['vely'][:,:,:,:]**2 \
|
||||
+ g['velz'][:,:,:,:]**2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user