[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Mar 8 19:00:27 PST 2016


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/a4f91de4a167/
Changeset:   a4f91de4a167
Branch:      yt
User:        atmyers
Date:        2016-03-08 20:54:39+00:00
Summary:     All Chombo dataset is_valid checks should immediately return False if there is not a valid Chombo HDF5 File.
Affected #:  1 file

diff -r dd18d068b55ba5b36a3e62f1084d12d510173d8f -r a4f91de4a167df3f8c0a46b3c25c1c0b0d6eadc3 yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -43,6 +43,15 @@
     PlutoFieldInfo
 
 
+def is_chombo_hdf5(fn):
+    try:
+        with h5py.File(fn, 'r') as fileh:
+            valid = "Chombo_global" in fileh["/"]
+    except:
+        return False
+    return valid
+
+
 class ChomboGrid(AMRGridPatch):
     _id_offset = 0
     __slots__ = ["_level_id", "stop_index"]
@@ -351,6 +360,9 @@
     @classmethod
     def _is_valid(self, *args, **kwargs):
 
+        if not is_chombo_hdf5(args[0]):
+            return False
+
         pluto_ini_file_exists = False
         orion2_ini_file_exists = False
 
@@ -507,6 +519,9 @@
     @classmethod
     def _is_valid(self, *args, **kwargs):
 
+        if not is_chombo_hdf5(args[0]):
+            return False
+
         pluto_ini_file_exists = False
 
         if isinstance(args[0], six.string_types):
@@ -649,6 +664,9 @@
     @classmethod
     def _is_valid(self, *args, **kwargs):
 
+        if not is_chombo_hdf5(args[0]):
+            return False
+
         pluto_ini_file_exists = False
         orion2_ini_file_exists = False
 
@@ -703,6 +721,9 @@
     @classmethod
     def _is_valid(self, *args, **kwargs):
 
+        if not is_chombo_hdf5(args[0]):
+            return False
+
         pluto_ini_file_exists = False
         orion2_ini_file_exists = False
 


https://bitbucket.org/yt_analysis/yt/commits/9b293e64a977/
Changeset:   9b293e64a977
Branch:      yt
User:        atmyers
Date:        2016-03-08 21:08:05+00:00
Summary:     catch exceptions in is_chombo_hdf5
Affected #:  1 file

diff -r a4f91de4a167df3f8c0a46b3c25c1c0b0d6eadc3 -r 9b293e64a977ced5312ccc65184844642a4e404a yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -47,7 +47,7 @@
     try:
         with h5py.File(fn, 'r') as fileh:
             valid = "Chombo_global" in fileh["/"]
-    except:
+    except (KeyError, IOError):
         return False
     return valid
 


https://bitbucket.org/yt_analysis/yt/commits/874b330c7acc/
Changeset:   874b330c7acc
Branch:      yt
User:        atmyers
Date:        2016-03-08 21:26:30+00:00
Summary:     catch ImportError as well
Affected #:  1 file

diff -r 9b293e64a977ced5312ccc65184844642a4e404a -r 874b330c7acc67a67f7ab62d52ca80fa61f98bfb yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -47,7 +47,7 @@
     try:
         with h5py.File(fn, 'r') as fileh:
             valid = "Chombo_global" in fileh["/"]
-    except (KeyError, IOError):
+    except (KeyError, IOError, ImportError):
         return False
     return valid

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