[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Jun 16 06:36:24 PDT 2017


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/6c0f59e404bb/
Changeset:   6c0f59e404bb
User:        brittonsmith
Date:        2017-06-15 20:23:10+00:00
Summary:     Use python3-safe hdf5 attribute reading.
Affected #:  1 file

diff -r 31b5c84d3d288cadf419ba86429ba50f73877507 -r 6c0f59e404bb44119d8cc590d9e4d8851bd032ad yt/frontends/ytdata/io.py
--- a/yt/frontends/ytdata/io.py
+++ b/yt/frontends/ytdata/io.py
@@ -19,7 +19,8 @@
 from yt.extern.six import \
     u
 from yt.funcs import \
-    mylog
+    mylog, \
+    parse_h5_attr
 from yt.geometry.selection_routines import \
     GridSelector
 from yt.utilities.exceptions import \
@@ -143,7 +144,7 @@
                 if g.NumberOfParticles == 0:
                     continue
                 for ptype, field_list in sorted(ptf.items()):
-                    units = f[ptype][pn % "x"].attrs["units"]
+                    units = parse_h5_attr(f[ptype][pn % "x"], "units")
                     x, y, z = \
                       (self.ds.arr(f[ptype][pn % ax].value.astype("float64"), units)
                        for ax in "xyz")
@@ -165,7 +166,7 @@
                 if g.NumberOfParticles == 0:
                     continue
                 for ptype, field_list in sorted(ptf.items()):
-                    units = f[ptype][pn % "x"].attrs["units"]
+                    units = parse_h5_attrf([ptype][pn % "x"], "units")
                     x, y, z = \
                       (self.ds.arr(f[ptype][pn % ax].value.astype("float64"), units)
                        for ax in "xyz")
@@ -236,7 +237,7 @@
                 if ptype == "grid":
                     dx = f["grid"]["dx"].value.min()
                     dx = self.ds.quan(
-                        dx, f["grid"]["dx"].attrs["units"]).to("code_length")
+                        dx, parse_h5_attr(f["grid"]["dx"], "units")).to("code_length")
                 else:
                     dx = 2. * np.finfo(f[ptype]["particle_position_x"].dtype).eps
                     dx = self.ds.quan(dx, units).to("code_length")
@@ -272,7 +273,7 @@
             for ptype in f:
                 fields.extend([(ptype, str(field)) for field in f[ptype]])
                 units.update(dict([((ptype, str(field)), 
-                                    f[ptype][field].attrs["units"])
+                                    parse_h5_attr(f[ptype][field], "units"))
                                    for field in f[ptype]]))
         return fields, units
 
@@ -334,7 +335,7 @@
                 if ptype == "grid":
                     dx = f["grid"]["pdx"].value.min()
                     dx = self.ds.quan(
-                        dx, f["grid"]["pdx"].attrs["units"]).to("code_length")
+                        dx, parse_h5_attr(f["grid"]["pdx"], "units")).to("code_length")
                 else:
                     raise NotImplementedError
                 pos[:,0] = _get_position_array(ptype, f, "px")
@@ -371,4 +372,4 @@
         pos_name = ""
     else:
         pos_name = "particle_position_"
-    return f[ptype][pos_name + ax].attrs["units"]
+    return parse_h5_attr(f[ptype][pos_name + ax], "units")


https://bitbucket.org/yt_analysis/yt/commits/4e188d55f6cd/
Changeset:   4e188d55f6cd
User:        brittonsmith
Date:        2017-06-15 22:52:27+00:00
Summary:     Typo.
Affected #:  1 file

diff -r 6c0f59e404bb44119d8cc590d9e4d8851bd032ad -r 4e188d55f6cd1f8b52ab6b3add2dcddd42b8a65e yt/frontends/ytdata/io.py
--- a/yt/frontends/ytdata/io.py
+++ b/yt/frontends/ytdata/io.py
@@ -166,7 +166,7 @@
                 if g.NumberOfParticles == 0:
                     continue
                 for ptype, field_list in sorted(ptf.items()):
-                    units = parse_h5_attrf([ptype][pn % "x"], "units")
+                    units = parse_h5_attr(f[ptype][pn % "x"], "units")
                     x, y, z = \
                       (self.ds.arr(f[ptype][pn % ax].value.astype("float64"), units)
                        for ax in "xyz")


https://bitbucket.org/yt_analysis/yt/commits/0c844416fb68/
Changeset:   0c844416fb68
User:        ngoldbaum
Date:        2017-06-16 13:36:12+00:00
Summary:     Merge pull request #1453 from brittonsmith/h5attr

[bugfix] Use python3-safe hdf5 attribute reading.
Affected #:  1 file

diff -r 7db4296b0ebccbadbcad8e927a056c71dd39564b -r 0c844416fb68c75ea74aa75bcc321e06982748d7 yt/frontends/ytdata/io.py
--- a/yt/frontends/ytdata/io.py
+++ b/yt/frontends/ytdata/io.py
@@ -19,7 +19,8 @@
 from yt.extern.six import \
     u
 from yt.funcs import \
-    mylog
+    mylog, \
+    parse_h5_attr
 from yt.geometry.selection_routines import \
     GridSelector
 from yt.utilities.exceptions import \
@@ -143,7 +144,7 @@
                 if g.NumberOfParticles == 0:
                     continue
                 for ptype, field_list in sorted(ptf.items()):
-                    units = f[ptype][pn % "x"].attrs["units"]
+                    units = parse_h5_attr(f[ptype][pn % "x"], "units")
                     x, y, z = \
                       (self.ds.arr(f[ptype][pn % ax].value.astype("float64"), units)
                        for ax in "xyz")
@@ -165,7 +166,7 @@
                 if g.NumberOfParticles == 0:
                     continue
                 for ptype, field_list in sorted(ptf.items()):
-                    units = f[ptype][pn % "x"].attrs["units"]
+                    units = parse_h5_attr(f[ptype][pn % "x"], "units")
                     x, y, z = \
                       (self.ds.arr(f[ptype][pn % ax].value.astype("float64"), units)
                        for ax in "xyz")
@@ -236,7 +237,7 @@
                 if ptype == "grid":
                     dx = f["grid"]["dx"].value.min()
                     dx = self.ds.quan(
-                        dx, f["grid"]["dx"].attrs["units"]).to("code_length")
+                        dx, parse_h5_attr(f["grid"]["dx"], "units")).to("code_length")
                 else:
                     dx = 2. * np.finfo(f[ptype]["particle_position_x"].dtype).eps
                     dx = self.ds.quan(dx, units).to("code_length")
@@ -272,7 +273,7 @@
             for ptype in f:
                 fields.extend([(ptype, str(field)) for field in f[ptype]])
                 units.update(dict([((ptype, str(field)), 
-                                    f[ptype][field].attrs["units"])
+                                    parse_h5_attr(f[ptype][field], "units"))
                                    for field in f[ptype]]))
         return fields, units
 
@@ -334,7 +335,7 @@
                 if ptype == "grid":
                     dx = f["grid"]["pdx"].value.min()
                     dx = self.ds.quan(
-                        dx, f["grid"]["pdx"].attrs["units"]).to("code_length")
+                        dx, parse_h5_attr(f["grid"]["pdx"], "units")).to("code_length")
                 else:
                     raise NotImplementedError
                 pos[:,0] = _get_position_array(ptype, f, "px")
@@ -371,4 +372,4 @@
         pos_name = ""
     else:
         pos_name = "particle_position_"
-    return f[ptype][pos_name + ax].attrs["units"]
+    return parse_h5_attr(f[ptype][pos_name + ax], "units")

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