[yt-users] problem with slice after upgrade

Nathan Goldbaum nathan12343 at gmail.com
Tue Jan 24 16:23:37 PST 2017


Hi Jonathan,

I just tried this using WDMerger_hdf5_chk_1000 (see yt-project.org/data),
which is a FLASH dataset from a simulation done in cylindrical coordinates,
but it seems to work for me ok using that dataset:

    $ yt load WDMerger_hdf5_chk_1000/WDMerger_hdf5_chk_1000.hdf5

    In [1]: slc = ds.slice(2, 0.)

    In [2]: slc['dr'].min()
    Out[2]: 25600000.0 code_length

Somehow something is getting set to a NaN, my guess is gobj.LeftEdge[i]. In
this context gobj is a grid object, so for some reason grid.LeftEdge is NaN
along one of your axes for at least one of your grids. You can navigate the
grid hierarchy by looking at the grid array: ds.index.grids[0] should be a
reference to the root grid. You can also just iterate over ds.index.grids
to look at all the grids in your dataset.

Is there any chance you can share the dataset that's causing this issue? We
have the yt curldrop (https://docs.hub.yt/services.html#curldrop) available
for sharing data publicly. If it's not ok to share the dataset publicly we
can try sharing it off-list.

-Nathan

On Tue, Jan 24, 2017 at 11:43 AM, Slavin, Jonathan <jslavin at cfa.harvard.edu>
wrote:

> Hi all,
>
> After upgrading yt to 3.3.3 I'm having trouble with slices.  Specifically
> I'm doing:
> ds = yt.load(file)
> slc = ds.slice(2,0.)
> dx = slc['dr'].min()
>
> This is for FLASH data from a run in cylindrical (r,z) symmetry.  What I
> get is:
>
> ValueError                                Traceback (most recent call last)
> /export/slavin/FLASH/mmsnr/plot_image.py in <module>()
>     101     slc = ds.slice(2,0.)
>     102     if first:
> --> 103         dx = slc['dr'].min()
>     104         xgl = ds.index.grids[0].LeftEdge[0]
>     105         xgr = ds.index.grids[-1].RightEdge[0]
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/data_objects/data_containers.pyc in __getitem__(self, key)
>     270                 return self.field_data[f]
>     271             else:
> --> 272                 self.get_data(f)
>     273         # fi.units is the unit expression string. We depend on the
> registry
>     274         # hanging off the dataset to define this unit object.
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/data_objects/data_containers.pyc in get_data(self, fields)
>    1119     def get_data(self, fields=None):
>    1120         if self._current_chunk is None:
> -> 1121             self.index._identify_base_chunk(self)
>    1122         if fields is None: return
>    1123         nfields = []
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/geometry/grid_geometry_handler.pyc in
> _identify_base_chunk(self, dobj)
>     302         #    fast_index = self._get_grid_tree()
>     303         if getattr(dobj, "size", None) is None:
> --> 304             dobj.size = self._count_selection(dobj, fast_index =
> fast_index)
>     305         if getattr(dobj, "shape", None) is None:
>     306             dobj.shape = (dobj.size,)
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/geometry/grid_geometry_handler.pyc in _count_selection(self,
> dobj, grids, fast_index)
>     312             return fast_index.count(dobj.selector)
>     313         if grids is None: grids = dobj._chunk_info
> --> 314         count = sum((g.count(dobj.selector) for g in grids))
>     315         return count
>     316
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/geometry/grid_geometry_handler.pyc in <genexpr>((g,))
>     312             return fast_index.count(dobj.selector)
>     313         if grids is None: grids = dobj._chunk_info
> --> 314         count = sum((g.count(dobj.selector) for g in grids))
>     315         return count
>     316
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/data_objects/grid_patch.pyc in count(self, selector)
>     381
>     382     def count(self, selector):
> --> 383         mask = self._get_selector_mask(selector)
>     384         if mask is None: return 0
>     385         return self._last_count
>
> /export/slavin/python/anaconda/lib/python2.7/site-
> packages/yt/data_objects/grid_patch.pyc in _get_selector_mask(self,
> selector)
>     363             mask = self._last_mask
>     364         else:
> --> 365             mask = selector.fill_mask(self)
>     366             if self._cache_mask:
>     367                 self._last_mask = mask
>
> /export/slavin/python/anaconda/lib/python2.7/site-packages/yt/geometry/selection_routines.pyx
> in yt.geometry.selection_routines.SliceSelector.fill_mask
> (yt/geometry/selection_routines.c:21029)()
>    1235                 if i == self.axis:
>    1236                     ind[i][0] = \
> -> 1237                         <int> ((self.coord -
> (gobj.LeftEdge[i]).to_ndarray()) /
>    1238                                gobj.dds[i])
>    1239                     ind[i][1] = ind[i][0] + 1
>
> ValueError: cannot convert float NaN to integer
>
> ​Anyone have any ideas on why this is happening?
>
> Jon​
>
> --
> ________________________________________________________
> Jonathan D. Slavin                 Harvard-Smithsonian CfA
> jslavin at cfa.harvard.edu       60 Garden Street, MS 83
> phone: (617) 496-7981       Cambridge, MA 02138-1516
> cell: (781) 363-0035             USA
> ________________________________________________________
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170124/4ece57c8/attachment.html>


More information about the yt-users mailing list