[yt-svn] commit/yt: MatthewTurk: Merged in hegan/yt (pull request #1248)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Nov 10 13:00:00 PST 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/feba284df7fe/
Changeset:   feba284df7fe
Branch:      yt
User:        MatthewTurk
Date:        2014-11-10 20:59:45+00:00
Summary:     Merged in hegan/yt (pull request #1248)

[Minor Enhancement] Allowing enzo frontend to read in active particles that have array attributes
Affected #:  2 files

diff -r 9153a5a32dce19164cc66f8073a26d460aa74cbe -r feba284df7fea6ac46d0329b9ed2a0bfde6487a2 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -83,6 +83,9 @@
                             r"particle_position_%s")
                     x, y, z = (np.asarray(pds.get(pn % ax).value, dtype="=f8")
                                for ax in 'xyz')
+                    for field in field_list:
+                        if np.asarray(pds[field]).ndim > 1:
+                            self._array_fields[field] = pds[field].shape
                     yield ptype, (x, y, z)
             if f: f.close()
 

diff -r 9153a5a32dce19164cc66f8073a26d460aa74cbe -r feba284df7fea6ac46d0329b9ed2a0bfde6487a2 yt/utilities/io_handler.py
--- a/yt/utilities/io_handler.py
+++ b/yt/utilities/io_handler.py
@@ -43,6 +43,7 @@
         self.ds = ds
         self._last_selector_id = None
         self._last_selector_counts = None
+        self._array_fields = {}
 
     # We need a function for reading a list of sets
     # and a function for *popping* from a queue all the appropriate sets
@@ -160,6 +161,8 @@
         for field in fields:
             if field[1] in self._vector_fields:
                 shape = (fsize[field], 3)
+            elif field[1] in self._array_fields:
+                shape = (fsize[field],)+self._array_fields[field[1]]
             else:
                 shape = (fsize[field], )
             rv[field] = np.empty(shape, dtype="float64")

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