<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 16, 2016 at 4:38 PM, Andrew James Emerick <span dir="ltr"><<a href="mailto:emerick@astro.columbia.edu" target="_blank">emerick@astro.columbia.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I wasn't sure if this should go in the yt-users list or Enzo-dev, as I'm not sure where the solution lies.</div><div><br></div><div>I've defined some new fields in Enzo that have units of density that yt is reading as having dimensionless units.</div><div><br></div><div>Are the units for fields defined and outputted somewhere in Enzo (to be read by yt)? Or does yt assume units depending on the name of the field? </div></div></blockquote><div><br></div><div>The conversions to CGS for the fields are written out by Enzo, but not the dimensions of the units. Taking an example parameter file (IsolatedGalaxy from <a href="http://yt-project.org/data">yt-project.org/data</a>), you'll see the following lines in the parameter file:</div><div><br></div><div><div>DataLabel[0]              = Density</div><div>DataUnits[0]              = none</div><div>#DataCGSConversionFactor[0] = 2.76112e-30</div></div><div><br></div><div>From which yt is able to infer the conversion from code density units to CGS.  yt is *not* able to read in that Density has dimensions of code_mass/code_length**3, that is hard-coded into yt in the enzo frontend:</div><div><br></div><div><a href="https://bitbucket.org/yt_analysis/yt/src/ee29ca6d81c95d55073d4cf9db89e9486c40156d/yt/frontends/enzo/fields.py?at=yt&fileviewer=file-view-default#fields.py-75">https://bitbucket.org/yt_analysis/yt/src/ee29ca6d81c95d55073d4cf9db89e9486c40156d/yt/frontends/enzo/fields.py?at=yt&fileviewer=file-view-default#fields.py-75</a></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>If the former, where do I tell the code that my field has density units when its written to file? I see "DataUnits" throughout the code, but I'm not sure if this is relevant or how to use it.</div><div><br></div><div>If this is a yt-side thing, is there an easy way to just have yt read in my new fields with the correct units without me manually changing them once I've loaded a dataset?</div><span class=""><font color="#888888"><div><br></div></font></span></div></blockquote><div><br></div><div>I think the easiest way to accomplish this without modifying yt is to define new derived fields that apply the correct units to the fields you've added to Enzo. You could include these fields in a plugin file (<a href="http://yt-project.org/doc/reference/configuration.html#the-plugin-file">http://yt-project.org/doc/reference/configuration.html#the-plugin-file</a>) or just at the top of your analysis scripts. You'll need to strip the incorrect dimensionless units from the data read in by yt from the Enzo output files and "by hand" attach the correct units. I'll happily write up an example if you need a hand with this.</div><div><br></div><div>In addition, I think it's likely we would accept a pull request adding support for your new fields to yt's Enzo frontend - you'll need to modify the yt/frontends/enzo/fields.py file to include new entries for your fields in the known_other_fields list for mesh fields and known_particle_fields list for particle fields. The only reason why we wouldn't do so is if adding support for your fields would somehow inhibit adding support for fields in the public distribution of Enzo in the future, which I think is unlikely.</div><div><br></div><div>-Nathan</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><font color="#888888"><div></div><div><br></div><div><br></div><div>Andrew<br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div style="font-family:arial;font-size:small">Graduate Student </div><div style="font-family:arial;font-size:small">Columbia University</div><div style="font-family:arial;font-size:small">Department of Astronomy</div></div></div>
</div>
</font></span></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" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>