[yt-svn] commit/yt: jzuhone: Older FLASH3 files do not contain the integer scalar "dimensionality". yt was checking for this and using the values of nxb, nyb, nzb to determine the dimensionality as a fallback. However, in the same code block it was checking for nxb, nyb, nzb in the "simulation parameters" dataset, which only exists in FLASH2 files. The fix is to separate these two try blocks.

Bitbucket commits-noreply at bitbucket.org
Wed Feb 15 13:46:11 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/306640bd4e4a/
changeset:   306640bd4e4a
branch:      yt
user:        jzuhone
date:        2012-02-15 22:40:56
summary:     Older FLASH3 files do not contain the integer scalar "dimensionality". yt was checking for this and using the values of nxb,nyb,nzb to determine the dimensionality as a fallback. However, in the same code block it was checking for nxb,nyb,nzb in the "simulation parameters" dataset, which only exists in FLASH2 files. The fix is to separate these two try blocks.
affected #:  1 file

diff -r 48ac4d17195b660c6a422477c2124d789d0052da -r 306640bd4e4a37f9756d8c4a3e5b3ba7e1087bb9 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -317,16 +317,19 @@
             nxb = self._find_parameter("integer", "nxb", scalar = True)
             nyb = self._find_parameter("integer", "nyb", scalar = True)
             nzb = self._find_parameter("integer", "nzb", scalar = True)
-            dimensionality = self._find_parameter("integer", "dimensionality",
-                                    scalar = True)
         except KeyError:
             nxb, nyb, nzb = [int(self._handle["/simulation parameters"]['n%sb' % ax])
-                              for ax in 'xyz']
+                              for ax in 'xyz'] # FLASH2 only!
+        try:
+            dimensionality = self._find_parameter("integer", "dimensionality",
+                                                  scalar = True)
+        except KeyError:
             dimensionality = 3
             if nzb == 1: dimensionality = 2
             if nyb == 1: dimensionality = 1
             if dimensionality < 3:
                 mylog.warning("Guessing dimensionality as %s", dimensionality)
+
         nblockx = self._find_parameter("integer", "nblockx")
         nblocky = self._find_parameter("integer", "nblocky")
         nblockz = self._find_parameter("integer", "nblockz")

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