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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jul 20 18:22:36 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/1f83a250683e/
Changeset:   1f83a250683e
Branch:      yt
User:        atmyers
Date:        2016-07-21 01:22:09+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2296)

Iterate over all grids in the GDF writer
Affected #:  1 file

diff -r 33224f46382b503005b82309949b44b71b5c4130 -r 1f83a250683eb8980e246c964f616814364f68b2 yt/utilities/grid_data_format/writer.py
--- a/yt/utilities/grid_data_format/writer.py
+++ b/yt/utilities/grid_data_format/writer.py
@@ -176,34 +176,36 @@
     g = fhandle["data"]
     data_source = ds.all_data()
     citer = data_source.chunks([], "io", local_only=True)
-    for chunk in parallel_objects(citer):
+    for region in parallel_objects(citer):
         # is there a better way to the get the grids on each chunk?
-        for grid in list(ds.index._chunk_io(chunk))[0].objs:
-            for field_name in fields:
+        for chunk in ds.index._chunk_io(region):
+            for grid in chunk.objs:
+                for field_name in fields:
 
-                # sanitize and get the field info object
-                if isinstance(field_name, tuple):
-                    field_name = field_name[1]
-                fi = ds._get_field_info(field_name)
+                    # sanitize and get the field info object
+                    if isinstance(field_name, tuple):
+                        field_name = field_name[1]
+                    fi = ds._get_field_info(field_name)
 
-                # set field parameters, if specified
-                if field_parameters is not None:
-                    for k, v in field_parameters.items():
-                        grid.set_field_parameter(k, v)
+                    # set field parameters, if specified
+                    if field_parameters is not None:
+                        for k, v in field_parameters.items():
+                            grid.set_field_parameter(k, v)
 
-                grid_group = g["grid_%010i" % (grid.id - grid._id_offset)]
-                particles_group = grid_group["particles"]
-                pt_group = particles_group[particle_type_name]
-                # add the field data to the grid group
-                # Check if this is a real field or particle data.
-                grid.get_data(field_name)
-                units = fhandle["field_types"][field_name].attrs["field_units"]
-                if fi.particle_type:  # particle data
-                    dset = pt_group[field_name]
-                    dset[:] = grid[field_name].in_units(units)
-                else:  # a field
-                    dset = grid_group[field_name]
-                    dset[:] = grid[field_name].in_units(units)
+                    grid_group = g["grid_%010i" % (grid.id - grid._id_offset)]
+                    particles_group = grid_group["particles"]
+                    pt_group = particles_group[particle_type_name]
+                    # add the field data to the grid group
+                    # Check if this is a real field or particle data.
+                    grid.get_data(field_name)
+                    units = fhandle[
+                        "field_types"][field_name].attrs["field_units"]
+                    if fi.particle_type:  # particle data
+                        dset = pt_group[field_name]
+                        dset[:] = grid[field_name].in_units(units)
+                    else:  # a field
+                        dset = grid_group[field_name]
+                        dset[:] = grid[field_name].in_units(units)
 
 @contextmanager
 def _get_backup_file(ds):

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