[yt-svn] commit/yt: ngoldbaum: Merged in yihaochen/yt (pull request #2153)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed May 4 11:04:17 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/dedf4c47220e/
Changeset:   dedf4c47220e
Branch:      yt
User:        ngoldbaum
Date:        2016-05-04 18:04:02+00:00
Summary:     Merged in yihaochen/yt (pull request #2153)

Try to guess and load particle file for FLASH dataset. Closes #1179
Affected #:  1 file

diff -r 236cd5cc2b6a0b7b96ebe64a9a223f14bc86728e -r dedf4c47220e9551cf8ce24f10c9259da92f4361 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -192,12 +192,26 @@
         self.particle_filename = particle_filename
 
         if self.particle_filename is None:
-            self._particle_handle = self._handle
+            # try to guess the particle filename
+            try:
+                self._particle_handle = HDF5FileHandler(filename.replace('plt_cnt', 'part'))
+                self.particle_filename = filename.replace('plt_cnt', 'part')
+                mylog.info('Particle file found: %s' % self.particle_filename.split('/')[-1])
+            except IOError:
+                self._particle_handle = self._handle
         else:
+            # particle_filename is specified by user
             try:
                 self._particle_handle = HDF5FileHandler(self.particle_filename)
             except:
                 raise IOError(self.particle_filename)
+        # Check if the particle file has the same time
+        if self._particle_handle != self._handle:
+            part_time = self._particle_handle.handle.get('real scalars')[0][1]
+            plot_time = self._handle.handle.get('real scalars')[0][1]
+            if not np.isclose(part_time, plot_time):
+                raise IOError('%s and  %s are not at the same time.' % (self.particle_filename, filename))
+
         # These should be explicitly obtained from the file, but for now that
         # will wait until a reorganization of the source tree and better
         # generalization.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160504/9d6a8709/attachment.html>


More information about the yt-svn mailing list