[Yt-svn] yt: Adding preliminary support for FLASH 2.5.

hg at spacepope.org hg at spacepope.org
Fri Nov 19 09:02:55 PST 2010


hg Repository: yt
details:   yt/rev/8042bfc63b87
changeset: 3541:8042bfc63b87
user:      Matthew Turk <matthewturk at gmail.com>
date:
Fri Nov 19 12:01:20 2010 -0500
description:
Adding preliminary support for FLASH 2.5.

diffstat:

 yt/frontends/flash/data_structures.py |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 29b42153c46a -r 8042bfc63b87 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py	Fri Nov 19 00:33:26 2010 -0500
+++ b/yt/frontends/flash/data_structures.py	Fri Nov 19 12:01:20 2010 -0500
@@ -237,12 +237,24 @@
         self.unique_identifier = \
             int(os.stat(self.parameter_filename)[stat.ST_CTIME])
         self._handle = h5py.File(self.parameter_filename, "r")
+        if "file format version" in self._handle:
+            self._flash_version = int(
+                self._handle["file format version"][:])
+        elif "sim info" in self._handle:
+            self._flash_version = int(
+                self._handle["sim info"][:]["file format version"])
+        else:
+            raise RuntimeError("Can't figure out FLASH file version.")
         self.domain_left_edge = na.array(
             [self._find_parameter("real", "%smin" % ax) for ax in 'xyz'])
         self.domain_right_edge = na.array(
             [self._find_parameter("real", "%smax" % ax) for ax in 'xyz'])
-        self.current_time = \
-            float(self._find_parameter("real", "time", scalar=True))
+        if self._flash_version == 7:
+            self.current_time = float(
+                self._handle["simulation parameters"][:]["time"])
+        else:
+            self.current_time = \
+                float(self._find_parameter("real", "time", scalar=True))
         self._handle.close()
 
     @classmethod



More information about the yt-svn mailing list