[yt-svn] commit/yt-3.0: MatthewTurk: Make Enzo somewhat more forgiving and flexible about particle field names.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jul 11 07:09:05 PDT 2013
1 new commit in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/d397b2e138de/
Changeset: d397b2e138de
Branch: yt-3.0
User: MatthewTurk
Date: 2013-07-11 16:08:49
Summary: Make Enzo somewhat more forgiving and flexible about particle field names.
Affected #: 1 file
diff -r bd8062a43ab5dca8087c78bace4fc5eb102ac0a8 -r d397b2e138de6eb61d0a5d1d21faae041558eb1c yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -36,7 +36,9 @@
import numpy as np
from yt.funcs import *
-_convert_mass = ("particle_mass",)
+_convert_mass = ("particle_mass","mass")
+
+_particle_position_names = {}
class IOHandlerPackedHDF5(BaseIOHandler):
@@ -56,7 +58,8 @@
ptypes = list(set([ftype for ftype, fname in fields]))
fields = list(set(fields))
if len(ptypes) > 1: raise NotImplementedError
- pfields = [(ptypes[0], "particle_position_%s" % ax) for ax in 'xyz']
+ pn = _particle_position_names.get(ptypes[0], r"particle_position_%s")
+ pfields = [(ptypes[0], pn % ax) for ax in 'xyz']
size = 0
for chunk in chunks:
data = self._read_chunk_data(chunk, pfields, 'active',
@@ -83,7 +86,7 @@
for field in set(fields):
ftype, fname = field
gdata = data[g.id].pop(fname)[mask]
- if fname == "particle_mass":
+ if fname in _convert_mass:
gdata *= g.dds.prod()
rv[field][ind:ind+gdata.size] = gdata
ind += gdata.size
@@ -134,7 +137,7 @@
for field in set(fields):
ftype, fname = field
gdata = data[g.id].pop(fname)[mask]
- if fname == "particle_mass":
+ if fname in _convert_mass:
gdata *= g.dds.prod()
rv[field][ind:ind+gdata.size] = gdata
ind += gdata.size
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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