[yt-svn] commit/yt-3.0: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Sep 30 05:58:00 PDT 2013
2 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/b60c3058da89/
Changeset: b60c3058da89
Branch: yt-3.0
User: MatthewTurk
Date: 2013-09-29 22:50:41
Summary: Adding extra error handling to print out IOError filenames.
Affected #: 1 file
diff -r 4610fa758c9d1dc584eb1ce9f182ec0735773ffe -r b60c3058da8956ec9d19ef95a46d2352b55a9a39 yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -31,6 +31,18 @@
_vector_fields = ("Coordinates", "Velocity", "Velocities")
+def _get_h5_handle(fn):
+ try:
+ f = h5py.File(fn, "r")
+ except IOError as e:
+ print "ERROR OPENING %s" % (fn)
+ if os.path.exists(fn):
+ print "FILENAME EXISTS"
+ else:
+ print "FILENAME DOES NOT EXIST"
+ raise
+ return f
+
class IOHandlerOWLS(BaseIOHandler):
_data_style = "OWLS"
@@ -55,7 +67,7 @@
for obj in chunk.objs:
data_files.update(obj.data_files)
for data_file in data_files:
- f = h5py.File(data_file.filename, "r")
+ f = _get_h5_handle(data_file.filename)
# This double-reads
for ptype, field_list in sorted(ptf.items()):
coords = f["/%s/Coordinates" % ptype][:].astype("float64")
@@ -74,7 +86,7 @@
rv[field] = np.empty(shape, dtype="float64")
ind[field] = 0
for data_file in data_files:
- f = h5py.File(data_file.filename, "r")
+ f = _get_h5_handle(data_file.filename)
for ptype, field_list in sorted(ptf.items()):
g = f["/%s" % ptype]
coords = g["Coordinates"][:].astype("float64")
@@ -93,7 +105,7 @@
return rv
def _initialize_index(self, data_file, regions):
- f = h5py.File(data_file.filename, "r")
+ f = _get_h5_handle(data_file.filename)
pcount = f["/Header"].attrs["NumPart_ThisFile"][:].sum()
morton = np.empty(pcount, dtype='uint64')
ind = 0
@@ -114,14 +126,14 @@
return morton
def _count_particles(self, data_file):
- f = h5py.File(data_file.filename, "r")
+ f = _get_h5_handle(data_file.filename)
pcount = f["/Header"].attrs["NumPart_ThisFile"][:]
f.close()
npart = dict(("PartType%s" % (i), v) for i, v in enumerate(pcount))
return npart
def _identify_fields(self, data_file):
- f = h5py.File(data_file.filename, "r")
+ f = _get_h5_handle(data_file.filename)
fields = []
for key in f.keys():
if not key.startswith("PartType"): continue
https://bitbucket.org/yt_analysis/yt-3.0/commits/ace052c7aae2/
Changeset: ace052c7aae2
Branch: yt-3.0
User: MatthewTurk
Date: 2013-09-30 14:57:14
Summary: Minor optimization for Enzo particle data.
Affected #: 1 file
diff -r b60c3058da8956ec9d19ef95a46d2352b55a9a39 -r ace052c7aae2ef2c5b4ac0d92aaa4d5d3d61a1a7 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -107,9 +107,10 @@
data = self._read_chunk_data(chunk, pfields, 'any')
for g in chunk.objs:
if g.NumberOfParticles == 0: continue
- x, y, z = (data[g.id].pop("particle_position_%s" % ax)
- for ax in 'xyz')
- x, y, z = (np.array(arr, dtype='float64') for arr in (x, y, z))
+ x, y, z = (
+ np.asarray(data[g.id].pop("particle_position_%s" % ax),
+ dtype="float64")
+ for ax in 'xyz')
size += g.count_particles(selector, x, y, z)
read_fields = fields[:]
for field in fields:
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