[Yt-dev] gas energy, total energy and field aliases

david collins antpuncher at gmail.com
Thu Apr 2 11:21:43 PDT 2009


I think that your fix works for the cases we've identified.

Further generalization might be useful if you think that other codes,
like Orion, might benefit from generalization.  Otherwise, I wouldn't
bother with anything too fancy, since I think that in general the
trouble spots have been identified.

d.

On Wed, Apr 1, 2009 at 8:06 PM, Matthew Turk <matthewturk at gmail.com> wrote:
> I completely agree.
>
> In an ideal world, I would rather avoid regex's as opposed to explicit
> aliasing, but I'd take either one.  I tried to set up a
>
> _get_alias(self, field)
>
> function in the hierarchy.  The trouble came in that I couldn't get it
> to work properly with detecting the fields on instantiation.  Maybe if
> it got put into DataReadingFuncs, in the queue, it would work better
> -- but iterating over the set of aliases and then throwing the
> exception would be the best way to do it.
>
> I think we should look into this for yt-2.0.  For 1.5, does it look
> like my patch works okay?  I should note that this is a fix for this
> specific situation; this fix won't even work for fields that have more
> than two options.  We're going to ignore "Total\ Energy" for now, and
> if it needs to be used by one of us -- say, for a paper or something
> -- we'll just change the char* in the code.
>
> -Matt
>
> 2009/4/1 Britton Smith <brittonsmith at gmail.com>:
>> This has also driven me crazy.  As David points out, there is even this
>> additional instance popping up.  Maybe some sort of regular expression
>> matching would be more flexible.  For example, the Gas Energy field we know
>> has Gas and Energy with something or nothing in between.  We could have the
>> field that is to be gas energy check the available fields from one grid, do
>> a regex like /Grid[\s\_]*Energy/ to find out what it's being called in that
>> simulation, and then do the aliasing that way.  This might be better at
>> catching any additional deviations from the standard field names that may
>> come along in the future.
>>
>> Britton
>>
>> On Wed, Apr 1, 2009 at 8:46 PM, david collins <antpuncher at gmail.com> wrote:
>>>
>>> On Wed, Apr 1, 2009 at 7:26 PM, Matthew Turk <matthewturk at gmail.com>
>>> wrote:
>>> > Hi guys,
>>> >
>>> > I don't know if you guys have noticed, but there are lots of different
>>> > field names for Gas Energy and Total Energy, depending on both branch
>>> > of the code and test problem.  (LCA 1.5 even still has an underscore
>>> > in the rotating cylinder problem!)  This bit me today and I thought
>>> > about it, and I think the solution is -- in this two-choice case -- to
>>> > have aliases.
>>> >
>>>
>>>
>>> $#@@!$^^$%&
>>> I thought I caught all of them in lca1.5.
>>>
>>> I've been wrestling that glitch for years.  I make a point of removing
>>> all underscores in hdf5 field names I come across in the source code,
>>> I encourage all others to do the same.  I tried to get all of them in
>>> lca1.5 before it came out.
>>>
>>> > http://bitbucket.org/MatthewTurk/yt/changeset/9f624c382c1a/
>>>
>>> There's also a "Total\ Energy" (with an escaped space) that's kicking
>>> around in some versions of some tests.
>>>
>>> d.
>>>
>>> >
>>> > -Matt
>>> > _______________________________________________
>>> > 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
>



More information about the yt-dev mailing list