[yt-users] hierarchy.io.pop, projection

david collins antpuncher at gmail.com
Mon Oct 25 15:20:10 PDT 2010


Hi, Everybody!

In order to ensure all my units are being done correctly, I have a
field 'TE' that forces 'TotalEnergy' to be read off disk, like this:

def _TE(field,data):
    return data.hierarchy.io.pop(data, 'TotalEnergy')

lagos.add_field("TE", function=_TE,
               validators=[lagos.ValidateGridType()])

This lets me circumvent the assumptions that yt makes on a field by
that name, specifically unit conversion.  However, I can't seem to
project it.  I get the error, below.  Does anyone have any ideas of
either different ways to do this, or ways around the projection error?

Thanks,
d.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tmp.py", line 9, in <module>
    mp.plot()
  File "/home/dccollin/yt/uber.py", line 398, in plot
    fig = self.add_plots(field,axis,FirstOne)
  File "/home/dccollin/yt/uber.py", line 676, in add_plots
    **extra_args)
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/raven/plot_collection.py",
line 719, in add_projection
    **field_parameters)
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
line 1205, in __init__
    self._refresh_data()
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
line 237, in _refresh_data
    self.get_data()
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
line 1380, in get_data
    self._get_dependencies(fields), self.hierarchy.io)
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/ParallelTools.py",
line 1438, in _get_dependencies
    deps += ensure_list(fi[field].get_dependencies(pf=self.pf).requested)
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/field_info_container.py",
line 297, in get_dependencies
    self(e)
  File "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/field_info_container.py",
line 318, in __call__
    dd = self._function(self, data)
  File "xtra_fields.py", line 161, in _TE
    dataset = data.hierarchy.io.pop(data, 'TotalEnergy')
AttributeError: 'fake_io' object has no attribute 'pop'


-- 
Sent from my Stone Tablet and carried by my Pterodactyl.



More information about the yt-users mailing list