Error on loading generic AMR grid data and plotting a slice: AttributeError: 'StreamGrid' object has no attribute 'dds'
I have some AMR output data (from AMRClaw, for which there is not a yt front end) and I'm following instructions here: http://yt-project.org/docs/3.0/examining/loading_data.html#generic-amr-data My script is here: https://gist.github.com/30d8bdf41422dc20bb95 The yt.load_amr_grids() command seems to complete successfully. But when I try to generate a slice plot, I get the following: AttributeError Traceback (most recent call last) <ipython-input-30-384f3d2d8b79> in <module>() ----> 1 yt.SlicePlot(ds, 0, "density") /Users/ketch/anaconda/lib/python2.7/site-packages/yt/visualization/plot_window.pyc in SlicePlot(ds, normal, fields, axis, *args, **kwargs) 1840 del kwargs['north_vector'] 1841 -> 1842 return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs) /Users/ketch/anaconda/lib/python2.7/site-packages/yt/visualization/plot_window.pyc in __init__(self, ds, axis, fields, center, width, axes_unit, origin, fontsize, field_parameters, window_size, aspect) 1012 slc = ds.slice(axis, center[axis], 1013 field_parameters = field_parameters, center=center) -> 1014 slc.get_data(fields) 1015 PWViewerMPL.__init__(self, slc, bounds, origin=origin, 1016 fontsize=fontsize, fields=fields, /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc in get_data(self, fields) 600 def get_data(self, fields=None): 601 if self._current_chunk is None: --> 602 self.index._identify_base_chunk(self) 603 if fields is None: return 604 nfields = [] /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc in index(self) 127 if self._index is not None: 128 return self._index --> 129 self._index = self.ds.index 130 return self._index 131 /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/static_output.pyc in index(self) 272 raise RuntimeError("You should not instantiate Dataset.") 273 self._instantiated_index = self._index_class( --> 274 self, dataset_type=self.dataset_type) 275 # Now we do things that we need an instantiated index for 276 # ...first off, we create our field_info now. /Users/ketch/anaconda/lib/python2.7/site-packages/yt/frontends/stream/data_structures.pyc in __init__(self, ds, dataset_type) 167 self.float_type = "float64" 168 self.directory = os.getcwd() --> 169 GridIndex.__init__(self, ds, dataset_type) 170 171 def _count_grids(self): /Users/ketch/anaconda/lib/python2.7/site-packages/yt/geometry/geometry_handler.pyc in __init__(self, ds, dataset_type) 55 56 mylog.debug("Setting up domain geometry.") ---> 57 self._setup_geometry() 58 59 mylog.debug("Initializing data grid data IO") /Users/ketch/anaconda/lib/python2.7/site-packages/yt/geometry/grid_geometry_handler.pyc in _setup_geometry(self) 56 57 mylog.debug("Constructing grid objects.") ---> 58 self._populate_grid_objects() 59 60 mylog.debug("Re-examining index") /Users/ketch/anaconda/lib/python2.7/site-packages/yt/frontends/stream/data_structures.pyc in _populate_grid_objects(self) 242 def _populate_grid_objects(self): 243 for g in self.grids: --> 244 g._setup_dx() 245 self.max_level = self.grid_levels.max() 246 /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/grid_patch.pyc in _setup_dx(self) 136 id = self.id - self._id_offset 137 if self.Parent is not None: --> 138 self.dds = self.Parent.dds.ndarray_view() / self.ds.refine_by 139 else: 140 LE, RE = self.index.grid_left_edge[id,:], \ AttributeError: 'StreamGrid' object has no attribute 'dds' I would greatly appreciate any help.
Hi David, Can you try modifying your script slightly, to see if this addresses the problem? This will ensure that the grids are added in a particular order, from low level to high level. I am not certain it will fix it, but it might, and if it does, I will adjust the code to make sure this does not happen again. for state in sorted(sol.states, key = lambda a: a.patch.level): On Mon Nov 10 2014 at 9:43:08 AM David Ketcheson <dketch@gmail.com> wrote:
I have some AMR output data (from AMRClaw, for which there is not a yt front end) and I'm following instructions here:
http://yt-project.org/docs/3.0/examining/loading_data.html#generic-amr-data
My script is here:
https://gist.github.com/30d8bdf41422dc20bb95
The yt.load_amr_grids() command seems to complete successfully.
But when I try to generate a slice plot, I get the following:
AttributeError Traceback (most recent call last) <ipython-input-30-384f3d2d8b79> in <module>() ----> 1 yt.SlicePlot(ds, 0, "density")
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/visualization/plot_window.pyc in SlicePlot(ds, normal, fields, axis, *args, **kwargs) 1840 del kwargs['north_vector'] 1841 -> 1842 return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs)
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/visualization/plot_window.pyc in __init__(self, ds, axis, fields, center, width, axes_unit, origin, fontsize, field_parameters, window_size, aspect) 1012 slc = ds.slice(axis, center[axis], 1013 field_parameters = field_parameters, center=center) -> 1014 slc.get_data(fields) 1015 PWViewerMPL.__init__(self, slc, bounds, origin=origin, 1016 fontsize=fontsize, fields=fields,
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc in get_data(self, fields) 600 def get_data(self, fields=None): 601 if self._current_chunk is None: --> 602 self.index._identify_base_chunk(self) 603 if fields is None: return 604 nfields = []
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc in index(self) 127 if self._index is not None: 128 return self._index --> 129 self._index = self.ds.index 130 return self._index 131
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/static_output.pyc in index(self) 272 raise RuntimeError("You should not instantiate Dataset.") 273 self._instantiated_index = self._index_class( --> 274 self, dataset_type=self.dataset_type) 275 # Now we do things that we need an instantiated index for 276 # ...first off, we create our field_info now.
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/frontends/stream/data_structures.pyc in __init__(self, ds, dataset_type) 167 self.float_type = "float64" 168 self.directory = os.getcwd() --> 169 GridIndex.__init__(self, ds, dataset_type) 170 171 def _count_grids(self):
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/geometry/geometry_handler.pyc in __init__(self, ds, dataset_type) 55 56 mylog.debug("Setting up domain geometry.") ---> 57 self._setup_geometry() 58 59 mylog.debug("Initializing data grid data IO")
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/geometry/grid_geometry_handler.pyc in _setup_geometry(self) 56 57 mylog.debug("Constructing grid objects.") ---> 58 self._populate_grid_objects() 59 60 mylog.debug("Re-examining index")
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/frontends/stream/data_structures.pyc in _populate_grid_objects(self) 242 def _populate_grid_objects(self): 243 for g in self.grids: --> 244 g._setup_dx() 245 self.max_level = self.grid_levels.max() 246
/Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/grid_patch.pyc in _setup_dx(self) 136 id = self.id - self._id_offset 137 if self.Parent is not None: --> 138 self.dds = self.Parent.dds.ndarray_view() / self.ds.refine_by 139 else: 140 LE, RE = self.index.grid_left_edge[id,:], \
AttributeError: 'StreamGrid' object has no attribute 'dds'
I would greatly appreciate any help. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
David Ketcheson -
Matthew Turk