[yt-dev] gdf fields
Matthew Turk
matthewturk at gmail.com
Wed Jan 4 03:52:06 PST 2012
Hi Sam,
On Tue, Jan 3, 2012 at 9:01 PM, Sam Skillman <samskillman at gmail.com> wrote:
> 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.
Hm, this is the opposite of what I'd expect. "Known" is to indicate
that a field may exist in a file, whereas the standard is to indicate
it can be derived. By that logic, "Known" is where "density" should
go and standard is where "Density" should go, which in my version of
the code is how it is done.
Can you supply a small sample GDF dataset so I can dig in?
-Matt
>
> 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
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
More information about the yt-dev
mailing list