[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Jul 10 21:01:48 PDT 2017
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/7c0d75eebbaf/
Changeset: 7c0d75eebbaf
User: brittonsmith
Date: 2017-07-10 22:09:10+00:00
Summary: Use python3-safe hdf5 attribute reader in HaloCatalog frontend.
Affected #: 1 file
diff -r 0f517c77aa3560d5c4497e5508971294e3396dc7 -r 7c0d75eebbaf8d82e2ad06ac9ec486b028ac84b5 yt/frontends/halo_catalog/io.py
--- a/yt/frontends/halo_catalog/io.py
+++ b/yt/frontends/halo_catalog/io.py
@@ -18,7 +18,9 @@
import numpy as np
from yt.utilities.exceptions import YTDomainOverflow
-from yt.funcs import mylog
+from yt.funcs import \
+ mylog, \
+ parse_h5_attr
from yt.utilities.io_handler import \
BaseIOHandler
@@ -45,7 +47,7 @@
pn = "particle_position_%s"
for data_file in sorted(data_files):
with h5py.File(data_file.filename, "r") as f:
- units = f[pn % "x"].attrs["units"]
+ units = parse_h5_attr(f[pn % "x"], "units")
x, y, z = \
(self.ds.arr(f[pn % ax].value.astype("float64"), units)
for ax in "xyz")
@@ -65,7 +67,7 @@
for data_file in sorted(data_files):
with h5py.File(data_file.filename, "r") as f:
for ptype, field_list in sorted(ptf.items()):
- units = f[pn % "x"].attrs["units"]
+ units = parse_h5_attr(f[pn % "x"], "units")
x, y, z = \
(self.ds.arr(f[pn % ax].value.astype("float64"), units)
for ax in "xyz")
@@ -86,7 +88,7 @@
with h5py.File(data_file.filename, "r") as f:
if not f.keys(): return None
pos = np.empty((pcount, 3), dtype="float64")
- units = f["particle_position_x"].attrs["units"]
+ units = parse_h5_attr(f["particle_position_x"], "units")
dx = np.finfo(f['particle_position_x'].dtype).eps
dx = 2.0 * self.ds.quan(dx, units).to("code_length")
pos[:,0] = f["particle_position_x"].value
@@ -115,6 +117,7 @@
def _identify_fields(self, data_file):
with h5py.File(data_file.filename, "r") as f:
fields = [("halos", field) for field in f]
- units = dict([(("halos", field),
- f[field].attrs["units"]) for field in f])
+ units = dict([(("halos", field),
+ parse_h5_attr(f[field], "units"))
+ for field in f])
return fields, units
https://bitbucket.org/yt_analysis/yt/commits/0f2df3ccc41a/
Changeset: 0f2df3ccc41a
User: brittonsmith
Date: 2017-07-10 23:23:21+00:00
Summary: Use python3-safe hdf5 attr reader.
Affected #: 1 file
diff -r 7c0d75eebbaf8d82e2ad06ac9ec486b028ac84b5 -r 0f2df3ccc41ac09835c3dd71242d297a40fde7c7 yt/fields/xray_emission_fields.py
--- a/yt/fields/xray_emission_fields.py
+++ b/yt/fields/xray_emission_fields.py
@@ -20,7 +20,11 @@
from yt.config import ytcfg
from yt.fields.derived_field import DerivedField
-from yt.funcs import mylog, only_on_root, issue_deprecation_warning
+from yt.funcs import \
+ mylog, \
+ only_on_root, \
+ issue_deprecation_warning, \
+ parse_h5_attr
from yt.utilities.exceptions import YTFieldNotFound
from yt.utilities.exceptions import YTException
from yt.utilities.linear_interpolators import \
@@ -95,12 +99,12 @@
only_on_root(mylog.info, "Loading emissivity data from %s." % filename)
in_file = h5py.File(filename, "r")
if "info" in in_file.attrs:
- only_on_root(mylog.info, in_file.attrs["info"].decode('utf8'))
- if in_file.attrs["version"] != data_version[table_type]:
+ only_on_root(mylog.info, parse_h5_attr(in_file, "info"))
+ if parse_h5_attr(in_file, "version") != data_version[table_type]:
raise ObsoleteDataException(table_type)
else:
only_on_root(mylog.info, "X-ray '%s' emissivity data version: %s." % \
- (table_type, in_file.attrs["version"]))
+ (table_type, parse_h5_attr(in_file, "version")))
self.log_T = in_file["log_T"][:]
self.emissivity_primordial = in_file["emissivity_primordial"][:]
https://bitbucket.org/yt_analysis/yt/commits/d7bc05ca1605/
Changeset: d7bc05ca1605
User: ngoldbaum
Date: 2017-07-11 04:01:35+00:00
Summary: Merge pull request #1487 from brittonsmith/h5bug
[bugfix] Use python3-safe hdf5 attribute reader in HaloCatalog frontend.
Affected #: 2 files
diff -r 0f517c77aa3560d5c4497e5508971294e3396dc7 -r d7bc05ca16057f120acd5d043f90b6a8a32a2de5 yt/fields/xray_emission_fields.py
--- a/yt/fields/xray_emission_fields.py
+++ b/yt/fields/xray_emission_fields.py
@@ -20,7 +20,11 @@
from yt.config import ytcfg
from yt.fields.derived_field import DerivedField
-from yt.funcs import mylog, only_on_root, issue_deprecation_warning
+from yt.funcs import \
+ mylog, \
+ only_on_root, \
+ issue_deprecation_warning, \
+ parse_h5_attr
from yt.utilities.exceptions import YTFieldNotFound
from yt.utilities.exceptions import YTException
from yt.utilities.linear_interpolators import \
@@ -95,12 +99,12 @@
only_on_root(mylog.info, "Loading emissivity data from %s." % filename)
in_file = h5py.File(filename, "r")
if "info" in in_file.attrs:
- only_on_root(mylog.info, in_file.attrs["info"].decode('utf8'))
- if in_file.attrs["version"] != data_version[table_type]:
+ only_on_root(mylog.info, parse_h5_attr(in_file, "info"))
+ if parse_h5_attr(in_file, "version") != data_version[table_type]:
raise ObsoleteDataException(table_type)
else:
only_on_root(mylog.info, "X-ray '%s' emissivity data version: %s." % \
- (table_type, in_file.attrs["version"]))
+ (table_type, parse_h5_attr(in_file, "version")))
self.log_T = in_file["log_T"][:]
self.emissivity_primordial = in_file["emissivity_primordial"][:]
diff -r 0f517c77aa3560d5c4497e5508971294e3396dc7 -r d7bc05ca16057f120acd5d043f90b6a8a32a2de5 yt/frontends/halo_catalog/io.py
--- a/yt/frontends/halo_catalog/io.py
+++ b/yt/frontends/halo_catalog/io.py
@@ -18,7 +18,9 @@
import numpy as np
from yt.utilities.exceptions import YTDomainOverflow
-from yt.funcs import mylog
+from yt.funcs import \
+ mylog, \
+ parse_h5_attr
from yt.utilities.io_handler import \
BaseIOHandler
@@ -45,7 +47,7 @@
pn = "particle_position_%s"
for data_file in sorted(data_files):
with h5py.File(data_file.filename, "r") as f:
- units = f[pn % "x"].attrs["units"]
+ units = parse_h5_attr(f[pn % "x"], "units")
x, y, z = \
(self.ds.arr(f[pn % ax].value.astype("float64"), units)
for ax in "xyz")
@@ -65,7 +67,7 @@
for data_file in sorted(data_files):
with h5py.File(data_file.filename, "r") as f:
for ptype, field_list in sorted(ptf.items()):
- units = f[pn % "x"].attrs["units"]
+ units = parse_h5_attr(f[pn % "x"], "units")
x, y, z = \
(self.ds.arr(f[pn % ax].value.astype("float64"), units)
for ax in "xyz")
@@ -86,7 +88,7 @@
with h5py.File(data_file.filename, "r") as f:
if not f.keys(): return None
pos = np.empty((pcount, 3), dtype="float64")
- units = f["particle_position_x"].attrs["units"]
+ units = parse_h5_attr(f["particle_position_x"], "units")
dx = np.finfo(f['particle_position_x'].dtype).eps
dx = 2.0 * self.ds.quan(dx, units).to("code_length")
pos[:,0] = f["particle_position_x"].value
@@ -115,6 +117,7 @@
def _identify_fields(self, data_file):
with h5py.File(data_file.filename, "r") as f:
fields = [("halos", field) for field in f]
- units = dict([(("halos", field),
- f[field].attrs["units"]) for field in f])
+ units = dict([(("halos", field),
+ parse_h5_attr(f[field], "units"))
+ for field in f])
return fields, 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