[yt-users] h5py error in plot call

Matthew Turk matthewturk at gmail.com
Mon Feb 15 08:16:39 PST 2010


Hi Jordan,

I have a couple followup questions; which field are you taking a slice
of?  Is it a field that is defined everywhere in the simulation, or
only in a few grids?

I've created a diagnostic script for you; if you could, could you run
this and tell me what it outputs?  You'll need to modify the location
of the data, on line 3.  If it runs successfully, without any
exceptions, then on line 20 you'll notice that I define the field to
slice as "Density."  Could you change that to the field you are
slicing through, and let me know if it runs to completion then?

You can get the script by either downloading it from
http://paste.enzotools.org/show/321 or executing this command:

yt_lodgeit.py --download=321

Thanks!

-Matt

On Sun, Feb 14, 2010 at 6:25 PM, Jordan Thomas Mirocha
<Jordan.Mirocha at colorado.edu> wrote:
> Hi again,
> I tried Matt's snippet of code and hit an error here:
>
> g = pf.h.grids[0]
> yt         INFO       2010-02-14 19:20:47,399 Getting the binary hierarchy
> yt         INFO       2010-02-14 19:20:47,403 Finished with binary hierarchy
> reading
> Warning: divide by zero encountered in divide
> Warning: invalid value encountered in sqrt
> Warning: invalid value encountered in divide
> Warning: invalid value encountered in divide
> Warning: invalid value encountered in sqrt
>
> The remaining steps still worked, ending with
>
> print rho.shape, rho.min(), rho.max()
> (32, 64, 64) 0.001 196.019
>
> Thanks for the help,
> Jordan
>
> On Feb 14, 2010, at 6:33 PM, Matthew Turk wrote:
>
>> Hi all,
>>
>> So one thing that is interesting is that, like Britton said, h5py is
>> throwing the error even though HDF5LightReader (the yt module) is
>> having the problems.  What h5py does, to my understanding, is
>> intercept all the HDF5 error calls, thus making it a bit more
>> difficult for us to get a proper error stack back from
>> HDF5LightReader.  What I'd recommend trying, in order to tie down the
>> error a bit more, is to use h5py to access the data and see what
>> errors it reports.  You can do this with:
>>
>> from yt.mods import *
>> import h5py
>> pf = load(path_to_your_data)
>> g = pf.h.grids[0]
>> h5_file = h5py.File(g.filename)
>> rho = h5_file["/Grid%08i/Density" % g.id][:]
>> print rho.shape, rho.min(), rho.max()
>>
>> and then if it has problems, that could lead us to the problem.
>>
>> Thanks,
>>
>> Matt
>>
>> On Sun, Feb 14, 2010 at 3:44 PM, Britton Smith <brittonsmith at gmail.com>
>> wrote:
>>>
>>> What's strange to me is that it's an h5py error coming from a call to the
>>> hdf5 light reader, which I didn't think used h5py.  Matt, do you have any
>>> ideas?
>>> Britton
>>>
>>> On Sun, Feb 14, 2010 at 4:38 PM, Jordan Thomas Mirocha
>>> <Jordan.Mirocha at colorado.edu> wrote:
>>>>
>>>> Hello,
>>>> The other day I updated to h5py 1.2, and am now getting the following
>>>> error message when I try to make projections or slices.
>>>>
>>>> yt         INFO       2010-02-14 16:25:07,976 Created plot collection
>>>> with
>>>> default plot-center = [0.5, 0.5, 0.5]
>>>> yt         INFO       2010-02-14 16:25:07,976 Adding plot for axis 2
>>>> yt         INFO       2010-02-14 16:25:07,981 Storing the binary
>>>> hierarchy
>>>> yt         INFO       2010-02-14 16:25:07,985 Gathering a field list
>>>> (this
>>>> may take a moment.)
>>>> Warning: divide by zero encountered in divide
>>>> Warning: invalid value encountered in sqrt
>>>> Warning: invalid value encountered in divide
>>>> Warning: invalid value encountered in divide
>>>> Warning: invalid value encountered in sqrt
>>>> Traceback (most recent call last):
>>>>  File "/Library/Frameworks/Python.framework/Versions/Current/bin/yt",
>>>> line
>>>> 8, in <module>
>>>>  load_entry_point('yt==1.6dev', 'console_scripts', 'yt')()
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/commands.py",
>>>> line 523, in run_main
>>>>  sys.exit(YT.main())
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/cmdln.py",
>>>> line 257, in main
>>>>  return self.cmd(args)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/cmdln.py",
>>>> line 280, in cmd
>>>>  retval = self.onecmd(argv)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/cmdln.py",
>>>> line 412, in onecmd
>>>>  return self._dispatch_cmd(handler, argv)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/cmdln.py",
>>>> line 1100, in _dispatch_cmd
>>>>  return handler(argv[0], opts, *args)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/commands.py",
>>>> line 205, in arg_iterate
>>>>  func(self, subcmd, opts, arg)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/commands.py",
>>>> line 334, in do_plot
>>>>  else: pc.add_slice(opts.field, ax, center=center)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/raven/PlotCollection.py",
>>>> line 182, in add_slice
>>>>  return self.__add_slice(PlotTypes.SlicePlot, *args, **kwargs)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/raven/PlotCollection.py",
>>>> line 206, in __add_slice
>>>>  data_source = self.pf.hierarchy.slice(axis, coord, field,
>>>> center=center,
>>>> **kwargs)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/lagos/BaseDataTypes.py",
>>>> line 700, in __init__
>>>>  self._refresh_data()
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/lagos/BaseDataTypes.py",
>>>> line 237, in _refresh_data
>>>>  self.get_data()
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/lagos/BaseDataTypes.py",
>>>> line 589, in get_data
>>>>  for grid in self._get_grids()]
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/lagos/BaseDataTypes.py",
>>>> line 43, in save_state
>>>>  tr = func(self, grid, field)
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/lagos/BaseDataTypes.py",
>>>> line 805, in _get_data_from_grid
>>>>  dv = self.hierarchy.io._read_data_slice(grid, field, self.axis,
>>>> wantedIndex) * conv_factor
>>>>  File
>>>>
>>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/yt-1.6dev-py2.5-macosx-10.3-i386.egg/yt/lagos/DataReadingFuncs.py",
>>>> line 239, in _read_data_slice
>>>>  (grid.id, field), axis, coord).transpose()
>>>> h5py._stub.ValueError: Invalid group number (Function arguments: Out of
>>>> range)
>>>>
>>>> Any ideas?
>>>> Thanks,
>>>> Jordan
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users at lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list