<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Thanks, Nathan.  In the end, I grabbed the conversion factor from
    the Enzo data file, then effectively did:<br>
    <br>
    ray[xFieldName] = ray[xFieldName] / conversionFactorFromEnzoDataFile<br>
    <br>
    James<br>
    <br>
    <div class="moz-cite-prefix">On 15-07-04 12:53 AM, Nathan Goldbaum
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJXewO=Hqx=b76rFtKYNqDsYVkt-f2QReDKpED_Ybi76Sk2rGQ@mail.gmail.com"
      type="cite"><br>
      <br>
      On Friday, July 3, 2015, James Larrue-Baulch <<a
        moz-do-not-send="true" href="mailto:james.larrue@diopolis.com">james.larrue@diopolis.com</a>>
      wrote:<br>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
        <br>
        I have been working on a system with YT 2.7-dev (changeset
        1b93a1840f38) and trying to graph field values in code units,
        specifically the density, but I cannot figure out how to convert
        to code units in YT 2.  My data is from an Enzo cosmology
        simulation (i.e. expansion ON).<br>
        <br>
        If I were using YT 3, I believe the following would work to
        convert to any units desired:<br>
        <br>
        dataSet = load(inputDataFileName);<br>
        hierarchy = dataSet.index;<br>
        maxValue = hierarchy.find_max(dataFieldName)<br>
        ray = hierarchy.ortho_ray(0, (maxValue[1][1], maxValue[1][2]));<br>
        ray[xFieldName].convert_to_units(xAxisUnit);<br>
        // use "code_mass", "code_length", "code_time", etc. to get code
        units.<br>
        <br>
        With YT 2, I am trying:<br>
        <br>
        dataSet = load(inputDataFileName);<br>
        hierarchy = dataSet.hierarchy;<br>
        maxValue = hierarchy.find_max(dataFieldName)<br>
        ray = hierarchy.ortho_ray(0, (maxValue[1][1], maxValue[1][2]));<br>
        ray[xFieldName] = ray[xFieldName] * dataSet.units[xAxisUnit];<br>
        <br>
        This works fine, if my "xAxisUnit" is a length unit, but no
        other units seem to be recognized.  While testing density, I
        tried to convert from cgs to mks:<br>
        <br>
        KeyError: 'kg/m^3'<br>
        <br>
        I listed the values in dataSet.units and they look to be only
        length units.<br>
        <br>
        Should I just give up on YT 2 and move to a machine that has YT
        3, or is it possible to convert density units with YT 2?<br>
        <br>
      </blockquote>
      <div><br>
      </div>
      <div>Specifically for Enzo this is really awkward in yt 2.7. Since
        Enzo field named are used everywhere internally, and we expect
        them to be CGS, getting the Enzo data in code units is actually
        really awkward.</div>
      <div><br>
      </div>
      <div>There a way to do it by hard-coding the CGS conversion
        factors to unity (sorry I don't remember the precise syntax
        offhand, I think Dave Collins asked about something similar a
        year or two ago), but honestly it would likely be easier to just
        move to update your yt installation.</div>
      <div><br>
      </div>
      <div>Usually these days the first thing I do on a cluster is set
        up a bare-bones Python environment in my home folder using
        miniconda. I then install yt's dependencies, and then yt itself.
        Everything is in my home folder, so I don't need root
        privileges. Since conda packages are binaries, this process is
        also a lot faster than running the install script. If you
        need to run the development<span></span> version of yt, you can
        install mercurial, clone the yt repository and install it using
        "setup.py develop" for easy in-place hacking.</div>
      <div><br>
      </div>
      <div>Hope that helps,</div>
      <div><br>
      </div>
      <div>Nathan</div>
      <div><br>
      </div>
      <div> </div>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">
        Regards,<br>
        <br>
        James<br>
        <br>
        PS The full script I am using is:<br>
        <br>
        <a moz-do-not-send="true"
href="https://bitbucket.org/james_larrue/enzo-3.0-experimental/src/f425b7d5a10bf0da7cfd2fc146a464305f83d256/src/python/enzo-dataExporter.py?at=enzo-dev"
          target="_blank">https://bitbucket.org/james_larrue/enzo-3.0-experimental/src/f425b7d5a10bf0da7cfd2fc146a464305f83d256/src/python/enzo-dataExporter.py?at=enzo-dev</a><br>
        <br>
        but it contains much more code than my immediate goal.<br>
        _______________________________________________<br>
        yt-users mailing list<br>
        <a moz-do-not-send="true">yt-users@lists.spacepope.org</a><br>
        <a moz-do-not-send="true"
          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>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
yt-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>
<a class="moz-txt-link-freetext" href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>