[yt-svn] commit/yt: atmyers: handling the case where an Orion particle file exists, but no particles have been created yet
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Oct 14 18:05:31 PDT 2014
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/1504f1c3ccb6/
Changeset: 1504f1c3ccb6
Branch: yt
User: atmyers
Date: 2014-10-14 23:33:16+00:00
Summary: handling the case where an Orion particle file exists, but no particles have been created yet
Affected #: 2 files
diff -r bcd4895dd0021a121432cf8b50a4df7306064eba -r 1504f1c3ccb64c005743134c59213fc0d561ada8 yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -156,7 +156,7 @@
for key, val in self._handle.attrs.items():
if key.startswith("particle"):
particle_fields.append(val)
- self.field_list.extend([("io", c) for c in particle_fields])
+ self.field_list.extend([("io", c) for c in particle_fields])
def _count_grids(self):
self.num_grids = 0
@@ -534,7 +534,8 @@
# look for particle fields
self.particle_filename = self.index_filename[:-4] + 'sink'
- if not os.path.exists(self.particle_filename): return
+ if not os.path.exists(self.particle_filename):
+ return
pfield_list = [("io", c) for c in self.io.particle_field_index.keys()]
self.field_list.extend(pfield_list)
diff -r bcd4895dd0021a121432cf8b50a4df7306064eba -r 1504f1c3ccb64c005743134c59213fc0d561ada8 yt/frontends/chombo/io.py
--- a/yt/frontends/chombo/io.py
+++ b/yt/frontends/chombo/io.py
@@ -223,7 +223,14 @@
# Figure out the format of the particle file
with open(fn, 'r') as f:
lines = f.readlines()
- line = lines[1]
+
+ try:
+ line = lines[1]
+ except IndexError:
+ # a particle file exists, but there is only one line,
+ # so no sinks have been created yet.
+ index = {}
+ return index
# The basic fields that all sink particles have
index = {'particle_mass': 0,
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