[yt-svn] commit/yt: MatthewTurk: This allows for KeyError to be thrown by ParticleIO and to then dump back to

Bitbucket commits-noreply at bitbucket.org
Mon Jan 7 14:12:24 PST 2013


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/f218705c9a85/
changeset:   f218705c9a85
branch:      yt
user:        MatthewTurk
date:        2013-01-07 23:00:00
summary:     This allows for KeyError to be thrown by ParticleIO and to then dump back to
reading from grids.
affected #:  1 file

diff -r 554d144d9d248c6f70d8c665a5963aa39b2d6bb3 -r f218705c9a85854d9d1dbd52c8f48fc13521be43 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -2595,10 +2595,14 @@
                self.pf.field_info[field].particle_type and \
                self.pf.h.io._particle_reader and \
                not isinstance(self, AMRBooleanRegionBase):
-                self.particles.get_data(field)
-                if field not in self.field_data:
-                    if self._generate_field(field): continue
-                continue
+                try:
+                    self.particles.get_data(field)
+                    if field not in self.field_data:
+                        self._generate_field(field)
+                    continue
+                except KeyError:
+                    # This happens for fields like ParticleRadiuskpc
+                    pass
             if field not in self.hierarchy.field_list and not in_grids:
                 if self._generate_field(field):
                     continue # True means we already assigned it

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