[yt-dev] gdf fields

Sam Skillman samskillman at gmail.com
Tue Jan 3 18:01:07 PST 2012


Hi all,

I'm running into an issue with translation dictionaries for the GDF
frontend.

On the tip, if I load up a gdf dataset, and do:

pf.h.find_max('Density')

I get:

http://paste.yt-project.org/show/2008/

If I instead do pf.h.find_max('density'), I get what looks like the same
error.

If I replace line 56 in yt/frontends/gdf/fields.py

 55 KnownGDFFields = FieldInfoContainer()
 56 add_gdf_field = KnownGDFFields.add_field

with

 57 add_gdf_field = GDFFieldInfo.add_field

It works fine.

Alternatively, if I replace

 96 for f,v in log_translation_dict.items():
 97     add_field(f, function=TranslationFunc(v), take_log=True)
 98
 99 for f,v in translation_dict.items():
100     add_field(f, function=TranslationFunc(v), take_log=False)

with

102 def _generate_translation(mine, theirs, take_log=False):
103     add_field(theirs, function=lambda a, b: b[mine], take_log=take_log)
104
105
106 for f,v in log_translation_dict.items():
107     if v not in GDFFieldInfo:
108         add_field(v, function=lambda a,b: None, take_log=True,
109                   validators = [ValidateDataField(v)])
110     #print "Setting up translator from %s to %s" % (v, f)
111     _generate_translation(v, f, take_log=True)
112
113
114 for f,v in translation_dict.items():
115     if v not in GDFFieldInfo:
116         add_field(v, function=lambda a,b: None, take_log=False,
117                   validators = [ValidateDataField(v)])
118     #print "Setting up translator from %s to %s" % (v, f)
119     _generate_translation(v, f, take_log=False)

as is done in the orion reader, it works fine.

Anyways, if someone sees what is going on here, let me know.  I'll also be
on IRC for a bit longer tonight and all tomorrow.

Thanks,
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20120103/e57df547/attachment.htm>


More information about the yt-dev mailing list