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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Feb 24 14:07:33 PST 2017


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/3eca2ae80ab1/
Changeset:   3eca2ae80ab1
Branch:      yt
User:        ngoldbaum
Date:        2017-02-24 22:07:27+00:00
Summary:     Merged in atmyers/yt (pull request #2517)

Don't attempt to parse inputs or probins files for generic BoxLib data.

Approved-by: yt-fido
Approved-by: Nathan Goldbaum
Approved-by: Maximilian Katz
Approved-by: Kacper Kowalik
Affected #:  2 files

diff -r 25651334863bc48cb35ca88070de8aa8c5ffd855 -r 3eca2ae80ab14a48b643d3055d7d3c0933fa77ae yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -405,8 +405,8 @@
     periodicity = (True, True, True)
 
     def __init__(self, output_dir,
-                 cparam_filename="inputs",
-                 fparam_filename="probin",
+                 cparam_filename=None,
+                 fparam_filename=None,
                  dataset_type='boxlib_native',
                  storage_filename=None,
                  units_override=None,
@@ -459,6 +459,8 @@
             return False
         args = inspect.getcallargs(cls.__init__, args, kwargs)
         # This might need to be localized somehow
+        if args['cparam_filename'] is None:
+            return True  # Treat as generic boxlib data
         inputs_filename = os.path.join(
             os.path.dirname(os.path.abspath(output_dir)),
             args['cparam_filename'])
@@ -820,7 +822,7 @@
         if any(("castro." in line for line in lines)): return False
         if any(("nyx." in line for line in lines)): return False
         if any(("maestro" in line.lower() for line in lines)): return False
-        if any(("geometry.prob_lo" in line for line in lines)): return True
+        if any(("hyp." in line for line in lines)): return True
         return False
 
 
@@ -848,6 +850,22 @@
     _index_class = CastroHierarchy
     _field_info_class = CastroFieldInfo
 
+    def __init__(self, output_dir,
+                 cparam_filename='inputs',
+                 fparam_filename='probin',
+                 dataset_type='boxlib_native',
+                 storage_filename=None,
+                 units_override=None,
+                 unit_system="cgs"):
+
+        super(CastroDataset, self).__init__(output_dir,
+                                            cparam_filename,
+                                            fparam_filename,
+                                            dataset_type,
+                                            storage_filename,
+                                            units_override,
+                                            unit_system)
+
     @classmethod
     def _is_valid(cls, *args, **kwargs):
         # fill our args
@@ -916,6 +934,22 @@
 
     _field_info_class = MaestroFieldInfo
 
+    def __init__(self, output_dir,
+                 cparam_filename='inputs',
+                 fparam_filename='probin',
+                 dataset_type='boxlib_native',
+                 storage_filename=None,
+                 units_override=None,
+                 unit_system="cgs"):
+        
+        super(MaestroDataset, self).__init__(output_dir,
+                                             cparam_filename,
+                                             fparam_filename,
+                                             dataset_type,
+                                             storage_filename,
+                                             units_override,
+                                             unit_system)
+
     @classmethod
     def _is_valid(cls, *args, **kwargs):
         # fill our args
@@ -993,6 +1027,22 @@
     _index_class = NyxHierarchy
     _field_info_class = NyxFieldInfo
 
+    def __init__(self, output_dir,
+                 cparam_filename='inputs',
+                 fparam_filename='probin',
+                 dataset_type='boxlib_native',
+                 storage_filename=None,
+                 units_override=None,
+                 unit_system="cgs"):
+
+        super(NyxDataset, self).__init__(output_dir,
+                                         cparam_filename,
+                                         fparam_filename,
+                                         dataset_type,
+                                         storage_filename,
+                                         units_override,
+                                         unit_system)
+
     @classmethod
     def _is_valid(cls, *args, **kwargs):
         # fill our args

diff -r 25651334863bc48cb35ca88070de8aa8c5ffd855 -r 3eca2ae80ab14a48b643d3055d7d3c0933fa77ae yt/frontends/boxlib/io.py
--- a/yt/frontends/boxlib/io.py
+++ b/yt/frontends/boxlib/io.py
@@ -126,7 +126,11 @@
                 rdata = np.fromfile(f, pheader.real_type, pheader.num_real * npart)
                 x = np.asarray(rdata[0::pheader.num_real], dtype=np.float64)
                 y = np.asarray(rdata[1::pheader.num_real], dtype=np.float64)
-                z = np.asarray(rdata[2::pheader.num_real], dtype=np.float64)
+                if (grid.ds.dimensionality == 2):
+                    z = np.ones_like(y)
+                    z *= 0.5*(grid.LeftEdge[2] + grid.RightEdge[2])
+                else:
+                    z = np.asarray(rdata[2::pheader.num_real], dtype=np.float64)
                 mask = selector.select_points(x, y, z, 0.0)
 
                 if mask is None:
@@ -150,7 +154,11 @@
                 rdata = np.fromfile(f, pheader.real_type, pheader.num_real * npart)
                 x = np.asarray(rdata[0::pheader.num_real], dtype=np.float64)
                 y = np.asarray(rdata[1::pheader.num_real], dtype=np.float64)
-                z = np.asarray(rdata[2::pheader.num_real], dtype=np.float64)
+                if (grid.ds.dimensionality == 2):
+                    z = np.ones_like(y)
+                    z *= 0.5*(grid.LeftEdge[2] + grid.RightEdge[2])
+                else:
+                    z = np.asarray(rdata[2::pheader.num_real], dtype=np.float64)
                 mask = selector.select_points(x, y, z, 0.0)
 
                 if mask is None:

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