<div dir="ltr">Hi Jill,<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 20, 2014 at 6:27 PM, Jill Naiman <span dir="ltr"><<a href="mailto:jill.naiman@cfa.harvard.edu" target="_blank">jill.naiman@cfa.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi all,<br><br></div>As the title states, I am confused - specifically about units.  I want to create a derived field where parts of the field are different values, dependent upon some cutoff criteria like so:<br><br>def _dene2(field,data):<br>    tl = data['temperature']<br>    dl = data['density']<br>    print("TEMP")<br>    print(tl.in_cgs())<br>    aux = np.where(tl.in_cgs() > 5000.)<br>    np.putmask(dl,aux, 0.0)<br>    dene = dl<br>    return dene<br><br><br>ds.add_field("dene", units="g/cm**3", function = _dene2)<br><br><br></div>Not only does this produce a very worrisome error:  "RuntimeError: Something has gone terribly wrong, _function is NullFunc for ('flash', 'temp')"<br></div></div></div></div></blockquote><div><br></div><div>This happens when field detection fails badly.  I'm a bit surprised to see it referencing a "temp" field - have you defined a "temp" field somewhere?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><br></div>The print statement in there shows a bunch of values close to 1, which is why the "aux" mask never returns anything.But why is data a bunch of 1's in here?  How do I access/convert to the "real" units?</div></div></div></blockquote><div><br></div><div>yt's field detection algorithm will feed a field fake data that is close to 1 to see if there are errors in the field definition.  The values close to 1 you are seeing almost certainly come from field detection.  If the field validates correctly, real data will eventually be passed in.</div><div><br></div><div>Is there any chance you can reproduce this issue using one of the test datasets on <a href="http://yt-project.org/data">yt-project.org/data</a>?  If so, can you pastebin a script that causes the error you're seeing?  That should make it much easier to reproduce and figure out exactly what's going wrong.</div><div><br></div><div>-Nathan</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div>Any help is appreciated,<br></div>-Jill<br><div><div><div><div><br></div></div></div></div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>