[yt-dev] gdf fields

Sam Skillman samskillman at gmail.com
Wed Jan 4 08:27:00 PST 2012


Thanks Matt, works great!

Sam

On Wed, Jan 4, 2012 at 9:12 AM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Sam,
>
> Thanks for the data.  I got it working by removing the (empty)
> overriding of _setup_unknown_fields in the gdf frontend.  What this
> function is supposed to do is populate field_info with either Known
> fields or new fields.  It was not doing either, since it was
> overridden.  The fix is in f8ef14cd6da8 in my repo.
>
> -Matt
>
> On Wed, Jan 4, 2012 at 10:55 AM, Sam Skillman <samskillman at gmail.com>
> wrote:
> > Hi Matt,
> >
> > That didn't seem to help.  With that change I still get the same errors.
> >
> > I have put a 64MB dataset here:
> >
> http://corvette.colorado.edu/~skillman/simulations/kh_3d_mhd_hlld_128_beta5000_sub_tanhd.0030.gdf
> >
> > which can be loaded with
> > yt load kh_3d_mhd_hlld_128_beta5000_sub_tanhd.0030.gdf
> >
> > I have had to make some changes to other parts of the gdf frontend, so
> you
> > should probably work off the yt-gdf fork tip:
> > https://bitbucket.org/samskillman/yt-gdf/changeset/57483ef32927
> >
> > I'm around on IRC now as well.
> >
> > Thanks,
> > Sam
> >
> >
> > On Wed, Jan 4, 2012 at 4:57 AM, Matthew Turk <matthewturk at gmail.com>
> wrote:
> >>
> >> Hi Sam,
> >>
> >> On Wed, Jan 4, 2012 at 6:52 AM, Matthew Turk <matthewturk at gmail.com>
> >> wrote:
> >> > 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.
> >>
> >> One quick thought.  Can you try with the validators for 'density'
> >> removed, using the standard code as it is in the tip of the main repo?
> >>  i.e., change
> >>
> >> add_gdf_field("density", function=NullFunc, take_log=True,
> >>          validators = [ValidateDataField("density")],
> >>          units=r"\rm{g}/\rm{cm}^3",
> >>          projected_units =r"\rm{g}/\rm{cm}^2")
> >>
> >> to
> >>
> >> add_gdf_field("density", function=NullFunc, take_log=True,
> >>          units=r"\rm{g}/\rm{cm}^3",
> >>          projected_units =r"\rm{g}/\rm{cm}^2")
> >>
> >> -Matt
> >>
> >> >
> >> > 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
> >> >>
> >> _______________________________________________
> >> yt-dev mailing list
> >> yt-dev at lists.spacepope.org
> >> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
> >
> >
> >
> > _______________________________________________
> > yt-dev mailing list
> > yt-dev at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
> >
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20120104/1e99b9eb/attachment.htm>


More information about the yt-dev mailing list