[yt-users] Confused about units in derived fields
Jill Naiman
jill.naiman at cfa.harvard.edu
Thu Nov 20 18:27:09 PST 2014
Hi all,
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:
def _dene2(field,data):
tl = data['temperature']
dl = data['density']
print("TEMP")
print(tl.in_cgs())
aux = np.where(tl.in_cgs() > 5000.)
np.putmask(dl,aux, 0.0)
dene = dl
return dene
ds.add_field("dene", units="g/cm**3", function = _dene2)
Not only does this produce a very worrisome error: "RuntimeError:
Something has gone terribly wrong, _function is NullFunc for ('flash',
'temp')"
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?
Any help is appreciated,
-Jill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20141120/0c005e87/attachment.htm>
More information about the yt-users
mailing list