Merge branch 'master' into reconnection
This commit is contained in:
commit
6c7aa6dd13
@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||
|
||||
setuptools.setup(
|
||||
name="amunpy",
|
||||
version="0.9.4",
|
||||
version="0.9.5",
|
||||
author="Grzegorz Kowal",
|
||||
author_email="grzegorz@amuncode.org",
|
||||
description="Python Interface for the AMUN code's snapshots",
|
||||
|
@ -21,6 +21,6 @@ __all__ = [ 'AmunXML', 'AmunH5', 'WriteVTK', \
|
||||
|
||||
__author__ = "Grzegorz Kowal"
|
||||
__copyright__ = "Copyright 2018-2021, Grzegorz Kowal <grzegorz@amuncode.org>"
|
||||
__version__ = "0.9.4"
|
||||
__version__ = "0.9.5"
|
||||
__maintainer__ = "Grzegorz Kowal"
|
||||
__email__ = "grzegorz@amuncode.org"
|
||||
|
@ -140,7 +140,7 @@ class Amun:
|
||||
Add additional attributes.
|
||||
"""
|
||||
if not 'toplev' in self.attributes:
|
||||
self.attributes['toplev'] = max([self.chunks[n]['levels'].max() for n in range(self.attributes['nchunks'])])
|
||||
self.attributes['toplev'] = max([max(chunk['levels']) if chunk['dblocks'] > 0 else 1 for chunk in self.chunks.values()])
|
||||
|
||||
if not 'xlen' in self.attributes:
|
||||
self.attributes['xlen'] = self.attributes['xmax'] - self.attributes['xmin']
|
||||
|
@ -117,10 +117,14 @@ class AmunH5(Amun):
|
||||
if os.path.exists(cname):
|
||||
with h5py.File(cname, 'r') as h5:
|
||||
self.chunks[n]['dblocks'] = h5['attributes'].attrs['dblocks'][0]
|
||||
|
||||
self.chunks[n]['levels'] = numpy.array(h5['coordinates']['levels'])
|
||||
self.chunks[n]['bounds'] = numpy.array(h5['coordinates']['bounds'])
|
||||
self.chunks[n]['coords'] = numpy.array(h5['coordinates']['coords'])
|
||||
if self.chunks[n]['dblocks'] > 0:
|
||||
self.chunks[n]['levels'] = numpy.array(h5['coordinates']['levels'])
|
||||
self.chunks[n]['bounds'] = numpy.array(h5['coordinates']['bounds'])
|
||||
self.chunks[n]['coords'] = numpy.array(h5['coordinates']['coords'])
|
||||
else:
|
||||
self.chunks[n]['levels'] = None
|
||||
self.chunks[n]['coords'] = None
|
||||
self.chunks[n]['bounds'] = None
|
||||
else:
|
||||
raise Exception("Snapshot's chunk '{}' not present!".format(cname))
|
||||
|
||||
@ -133,4 +137,8 @@ class AmunH5(Amun):
|
||||
|
||||
cname = os.path.join(self.dirname, self.chunks[chunk_number]['filename'])
|
||||
with h5py.File(cname, 'r') as h5:
|
||||
return numpy.array(h5['variables'][dataset_name])
|
||||
dset = numpy.array(h5['variables'][dataset_name])
|
||||
if self.attributes['ndims'] == 3:
|
||||
return dset
|
||||
else:
|
||||
return dset[0,:,:,:]
|
||||
|
@ -168,9 +168,9 @@ class AmunXML(Amun):
|
||||
|
||||
self.chunks[n]['bounds'] = numpy.array([bounds[:,:,ii[p]].T for p in range(self.chunks[n]['dblocks'])]).T
|
||||
else:
|
||||
self.chunks[n]['levels'] = numpy.zeros((1), dtype = numpy.int32)
|
||||
self.chunks[n]['coords'] = numpy.zeros((3,1), dtype = numpy.int32)
|
||||
self.chunks[n]['bounds'] = numpy.zeros((2,3,1), dtype = numpy.float64)
|
||||
self.chunks[n]['levels'] = None
|
||||
self.chunks[n]['coords'] = None
|
||||
self.chunks[n]['bounds'] = None
|
||||
|
||||
|
||||
def __read_binary_data__(self, dataset_name, chunk_number):
|
||||
|
Loading…
x
Reference in New Issue
Block a user