[Yt-svn] commit/yt: MatthewTurk: Fixing more h5py-1.4 incompatibilities.
Bitbucket
commits-noreply at bitbucket.org
Tue Jun 7 21:13:56 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/057ee8cc5c6c/
changeset: 057ee8cc5c6c
branch: yt
user: MatthewTurk
date: 2011-06-08 06:13:46
summary: Fixing more h5py-1.4 incompatibilities.
affected #: 5 files (70 bytes)
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py Tue Jun 07 21:02:57 2011 -0700
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py Tue Jun 07 21:13:46 2011 -0700
@@ -566,7 +566,7 @@
antialias=False)
dataset_name = "%s_%s" % (hp['field'], hp['weight_field'])
if save_cube:
- if dataset_name in output.listnames(): del output[dataset_name]
+ if dataset_name in output: del output[dataset_name]
output.create_dataset(dataset_name, data=frb[hp['field']])
if save_images:
filename = "%s/Halo_%04d_%s_%s.png" % (my_output_dir, halo['id'],
--- a/yt/analysis_modules/light_cone/light_cone.py Tue Jun 07 21:02:57 2011 -0700
+++ b/yt/analysis_modules/light_cone/light_cone.py Tue Jun 07 21:13:46 2011 -0700
@@ -520,7 +520,7 @@
output = h5py.File(filename, "a")
- node_exists = field_node in output.listnames()
+ node_exists = field_node in output
if node_exists:
if over_write:
--- a/yt/frontends/castro/data_structures.py Tue Jun 07 21:02:57 2011 -0700
+++ b/yt/frontends/castro/data_structures.py Tue Jun 07 21:13:46 2011 -0700
@@ -352,8 +352,8 @@
g._particle_offset = pg[2]
self.grid_particle_count[:,0] = self.pgrid_info[:,1]
del self.pgrid_info
- self.grid_levels = na.concatenate([level.ngrids*[level.level] for level in self.levels])
- self.grid_levels = self.grid_levels.reshape((self.num_grids,1))
+ gls = na.concatenate([level.ngrids*[level.level] for level in self.levels])
+ self.grid_levels[:] = gls.reshape((self.num_grids,1))
grid_dcs = na.concatenate([level.ngrids*[self.dx[level.level]] for level in self.levels], axis=0)
self.grid_dxs = grid_dcs[:,0].reshape((self.num_grids,1))
self.grid_dys = grid_dcs[:,1].reshape((self.num_grids,1))
--- a/yt/frontends/chombo/data_structures.py Tue Jun 07 21:02:57 2011 -0700
+++ b/yt/frontends/chombo/data_structures.py Tue Jun 07 21:13:46 2011 -0700
@@ -102,7 +102,7 @@
self._fhandle = h5py.File(self.hierarchy_filename)
self.float_type = self._fhandle['/level_0']['data:datatype=0'].dtype.name
- self._levels = self._fhandle.listnames()[1:]
+ self._levels = [fn for fn in self._fhandle if fn != "Chombo_global"]
AMRHierarchy.__init__(self,pf,data_style)
self._fhandle.close()
@@ -129,7 +129,7 @@
# this relies on the first Group in the H5 file being
# 'Chombo_global'
- levels = f.listnames()[1:]
+ levels = [fn for fn in f if fn != "Chombo_global"]
self.grids = []
i = 0
for lev in levels:
@@ -301,8 +301,7 @@
def _is_valid(self, *args, **kwargs):
try:
fileh = h5py.File(args[0],'r')
- if (fileh.listnames())[0] == 'Chombo_global':
- return True
+ return "Chombo_global" in fileh["/"]
except:
pass
return False
--- a/yt/visualization/volume_rendering/grid_partitioner.py Tue Jun 07 21:02:57 2011 -0700
+++ b/yt/visualization/volume_rendering/grid_partitioner.py Tue Jun 07 21:13:46 2011 -0700
@@ -403,7 +403,7 @@
def import_partitioned_grids(fn, int_type=na.int64, float_type=na.float64):
f = h5py.File(fn, "r")
- n_groups = len(f.listnames())
+ n_groups = len(f)
grid_list = []
dims = f["/PGrids/Dims"][:].astype(int_type)
left_edges = f["/PGrids/LeftEdges"][:].astype(float_type)
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