[yt-svn] commit/yt: ngoldbaum: Merged in xarthisius/yt (pull request #2421)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Oct 25 12:59:25 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/fa5a73a7a64f/
Changeset: fa5a73a7a64f
Branch: yt
User: ngoldbaum
Date: 2016-10-25 19:58:58+00:00
Summary: Merged in xarthisius/yt (pull request #2421)
[flash] Access a vlen dataset only by the name of its components.
Affected #: 2 files
diff -r 0f30249e590736a2068d6786c64f4fe453f49687 -r fa5a73a7a64f8780a534fa6fb7511faeab08cbc6 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -80,7 +80,11 @@
self.num_grids = self.dataset._find_parameter(
"integer", "globalnumblocks", True)
except KeyError:
- self.num_grids = self._handle["/simulation parameters"][0][0]
+ try:
+ self.num_grids = \
+ self._handle['simulation parameters']['total blocks'][0]
+ except KeyError:
+ self.num_grids = self._handle["/simulation parameters"][0][0]
def _parse_index(self):
f = self._handle # shortcut
@@ -317,11 +321,14 @@
if hn not in self._handle:
continue
if hn is 'simulation parameters':
- zipover = zip(self._handle[hn].dtype.names,self._handle[hn][0])
+ zipover = ((name, self._handle[hn][name][0])
+ for name in self._handle[hn].dtype.names)
else:
zipover = zip(self._handle[hn][:,'name'],self._handle[hn][:,'value'])
for varname, val in zipover:
vn = varname.strip()
+ if hasattr(vn, 'decode'):
+ vn = vn.decode("ascii", "ignore")
if hn.startswith("string"):
pval = val.strip()
else:
@@ -331,7 +338,7 @@
"scalar of the same name".format(hn[:-1],vn))
if hasattr(pval, 'decode'):
pval = pval.decode("ascii", "ignore")
- self.parameters[vn.decode("ascii", "ignore")] = pval
+ self.parameters[vn] = pval
# Determine block size
try:
diff -r 0f30249e590736a2068d6786c64f4fe453f49687 -r fa5a73a7a64f8780a534fa6fb7511faeab08cbc6 yt/frontends/flash/tests/test_outputs.py
--- a/yt/frontends/flash/tests/test_outputs.py
+++ b/yt/frontends/flash/tests/test_outputs.py
@@ -13,6 +13,7 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import numpy as np
from yt.testing import \
assert_equal, \
requires_file, \
@@ -75,6 +76,21 @@
def test_FLASHParticleDataset():
assert isinstance(data_dir_load(fid_1to3_b1), FLASHParticleDataset)
+
+dens_turb_mag = 'DensTurbMag/DensTurbMag_hdf5_plt_cnt_0015'
+ at requires_file(dens_turb_mag)
+def test_FLASH25_dataset():
+ ds = data_dir_load(dens_turb_mag)
+ assert_equal(ds.parameters['time'], 751000000000.0)
+ assert_equal(ds.domain_dimensions, np.array([8, 8, 8]))
+ assert_equal(ds.domain_left_edge,
+ ds.arr([-2e18, -2e18, -2e18], 'code_length'))
+
+ assert_equal(ds.index.num_grids, 73)
+ dd = ds.all_data()
+ dd['density']
+
+
@requires_ds(fid_1to3_b1, big_data=True)
def test_fid_1to3_b1():
ds = data_dir_load(fid_1to3_b1)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list