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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Aug 9 14:13:29 PDT 2017


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/3b025d8ce8a9/
Changeset:   3b025d8ce8a9
User:        atmyers
Date:        2017-08-08 23:07:26+00:00
Summary:     handle raw fields for WarpX datasets with mesh refinement.
Affected #:  2 files

diff -r c72d9bee3e75791d6882a9763119016b88c22ff8 -r 3b025d8ce8a9b7276152e5707ed89ec5b6b44224 yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -1353,32 +1353,44 @@
 
 
 def _read_header(raw_file, field):
-    header_file = raw_file + field + "_H"
-    with open(header_file, "r") as f:
+    level_files = glob.glob(raw_file + 'Level_*')
+    level_files.sort()
+
+    all_boxes = []
+    all_file_names = []
+    all_offsets = []
+
+    for level_file in level_files:
+        header_file = level_file + "/" + field + "_H"
+        with open(header_file, "r") as f:
         
-        # skip the first five lines
-        for _ in range(5):
-            f.readline()
+            # skip the first five lines
+            for _ in range(5):
+                f.readline()
 
-        # read boxes
-        boxes = []
-        for line in f:
-            clean_line = line.strip().split()
-            if clean_line == [')']:
-                break
-            lo_corner, hi_corner, node_type = _line_to_numpy_arrays(clean_line)
-            boxes.append((lo_corner, hi_corner, node_type))
+            # read boxes
+            boxes = []
+            for line in f:
+                clean_line = line.strip().split()
+                if clean_line == [')']:
+                    break
+                lo_corner, hi_corner, node_type = _line_to_numpy_arrays(clean_line)
+                boxes.append((lo_corner, hi_corner, node_type))
 
-        # read the file and offset position for the corresponding box
-        file_names = []
-        offsets = []
-        for line in f:
-            if line.startswith("FabOnDisk:"):
-                clean_line = line.strip().split()
-                file_names.append(clean_line[1])
-                offsets.append(int(clean_line[2]))
+            # read the file and offset position for the corresponding box
+            file_names = []
+            offsets = []
+            for line in f:
+                if line.startswith("FabOnDisk:"):
+                    clean_line = line.strip().split()
+                    file_names.append(clean_line[1])
+                    offsets.append(int(clean_line[2]))
 
-    return boxes, file_names, offsets
+            all_boxes += boxes
+            all_file_names += file_names
+            all_offsets += offsets
+
+    return all_boxes, all_file_names, all_offsets
 
 
 class WarpXHeader(object):
@@ -1448,9 +1460,9 @@
         super(WarpXHierarchy, self)._detect_output_fields()
 
         # now detect the optional, non-cell-centered fields
-        self.raw_file = self.ds.output_dir + "/raw_fields/Level_0/"
+        self.raw_file = self.ds.output_dir + "/raw_fields/"
         self.ds.fluid_types += ("raw",)
-        self.raw_fields = _read_raw_field_names(self.raw_file)
+        self.raw_fields = _read_raw_field_names(self.raw_file + 'Level_0/')
         self.field_list += [('raw', f) for f in self.raw_fields]
         self.raw_field_map = {}
         self.ds.nodal_flags = {}

diff -r c72d9bee3e75791d6882a9763119016b88c22ff8 -r 3b025d8ce8a9b7276152e5707ed89ec5b6b44224 yt/frontends/boxlib/io.py
--- a/yt/frontends/boxlib/io.py
+++ b/yt/frontends/boxlib/io.py
@@ -76,7 +76,8 @@
         fn_list = self.ds.index.raw_field_map[field_name][1]
         offset_list = self.ds.index.raw_field_map[field_name][2]
 
-        filename = base_dir + fn_list[grid.id]
+        lev = grid.Level        
+        filename = base_dir + "Level_%d/" % lev + fn_list[grid.id]
         offset = offset_list[grid.id]
         box = box_list[grid.id]
         


https://bitbucket.org/yt_analysis/yt/commits/00f7ca8d4411/
Changeset:   00f7ca8d4411
User:        ngoldbaum
Date:        2017-08-09 21:13:17+00:00
Summary:     Merge pull request #1531 from atmyers/master

Handle raw fields for WarpX datasets with mesh refinement.
Affected #:  2 files

diff -r 68d50c94be9a88927df18b72b202167dd4a3696d -r 00f7ca8d4411a53c9b98afa929adf6040666bbfe yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -1353,32 +1353,44 @@
 
 
 def _read_header(raw_file, field):
-    header_file = raw_file + field + "_H"
-    with open(header_file, "r") as f:
+    level_files = glob.glob(raw_file + 'Level_*')
+    level_files.sort()
+
+    all_boxes = []
+    all_file_names = []
+    all_offsets = []
+
+    for level_file in level_files:
+        header_file = level_file + "/" + field + "_H"
+        with open(header_file, "r") as f:
         
-        # skip the first five lines
-        for _ in range(5):
-            f.readline()
+            # skip the first five lines
+            for _ in range(5):
+                f.readline()
 
-        # read boxes
-        boxes = []
-        for line in f:
-            clean_line = line.strip().split()
-            if clean_line == [')']:
-                break
-            lo_corner, hi_corner, node_type = _line_to_numpy_arrays(clean_line)
-            boxes.append((lo_corner, hi_corner, node_type))
+            # read boxes
+            boxes = []
+            for line in f:
+                clean_line = line.strip().split()
+                if clean_line == [')']:
+                    break
+                lo_corner, hi_corner, node_type = _line_to_numpy_arrays(clean_line)
+                boxes.append((lo_corner, hi_corner, node_type))
 
-        # read the file and offset position for the corresponding box
-        file_names = []
-        offsets = []
-        for line in f:
-            if line.startswith("FabOnDisk:"):
-                clean_line = line.strip().split()
-                file_names.append(clean_line[1])
-                offsets.append(int(clean_line[2]))
+            # read the file and offset position for the corresponding box
+            file_names = []
+            offsets = []
+            for line in f:
+                if line.startswith("FabOnDisk:"):
+                    clean_line = line.strip().split()
+                    file_names.append(clean_line[1])
+                    offsets.append(int(clean_line[2]))
 
-    return boxes, file_names, offsets
+            all_boxes += boxes
+            all_file_names += file_names
+            all_offsets += offsets
+
+    return all_boxes, all_file_names, all_offsets
 
 
 class WarpXHeader(object):
@@ -1448,9 +1460,9 @@
         super(WarpXHierarchy, self)._detect_output_fields()
 
         # now detect the optional, non-cell-centered fields
-        self.raw_file = self.ds.output_dir + "/raw_fields/Level_0/"
+        self.raw_file = self.ds.output_dir + "/raw_fields/"
         self.ds.fluid_types += ("raw",)
-        self.raw_fields = _read_raw_field_names(self.raw_file)
+        self.raw_fields = _read_raw_field_names(self.raw_file + 'Level_0/')
         self.field_list += [('raw', f) for f in self.raw_fields]
         self.raw_field_map = {}
         self.ds.nodal_flags = {}

diff -r 68d50c94be9a88927df18b72b202167dd4a3696d -r 00f7ca8d4411a53c9b98afa929adf6040666bbfe yt/frontends/boxlib/io.py
--- a/yt/frontends/boxlib/io.py
+++ b/yt/frontends/boxlib/io.py
@@ -76,7 +76,8 @@
         fn_list = self.ds.index.raw_field_map[field_name][1]
         offset_list = self.ds.index.raw_field_map[field_name][2]
 
-        filename = base_dir + fn_list[grid.id]
+        lev = grid.Level        
+        filename = base_dir + "Level_%d/" % lev + fn_list[grid.id]
         offset = offset_list[grid.id]
         box = box_list[grid.id]

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