<div dir="ltr">Hi Alex,<div><br></div><div>Thanks for the report! I was able to reproduce the issue and I think I have a fix:</div><div><br></div><div><a href="https://bitbucket.org/yt_analysis/yt/pull-requests/2508">https://bitbucket.org/yt_analysis/yt/pull-requests/2508</a><br></div><div><br></div><div>If you could give that a test that would be great. No worries if you're not sure how to do that, just wanted an extra bit of confirmation :)</div><div><br></div><div>-Nathan</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 27, 2017 at 3:32 PM, Alex Hill <span dir="ltr"><<a href="mailto:ashill@haverford.edu" target="_blank">ashill@haverford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I’ve encountered a new error when specifying a box using units other than code units. This is a Flash 4 plot file in cgs units.<br>
<br>
Example:<br>
<br>
import yt<br>
yt.__version__<br>
<br>
‘3.3.3’<br>
<br>
d = yt.load('sn34_smd75_sub1_hdf5_<wbr>plt_cnt_0030')<br>
b = d.box([-500,-500,-20]*yt.<wbr>units.pc.in_cgs(),[500,500,20]<wbr>*yt.units.pc.in_cgs())<br>
fp = yt.PhasePlot(b,'n','pk',['<wbr>cell_volume'],weight_field=<wbr>None, fractional=True)<br>
<br>
I get the following error:<br>
<br>
UnitParseError: Code units have not been defined.<br>
Try creating the array or quantity using ds.arr or ds.quan instead.<br>
<br>
If I instead do<br>
<br>
b = d.box([-1.54e+21, -1.54e+21, -6.17e+19], [1.54e+21, 1.54e+21, 6.17e+19])<br>
<br>
or<br>
<br>
left = d.domain_left_edge<br>
right = d.domain_right_edge<br>
left[2] = -6.17e19<br>
right[2] = 6.17e19<br>
b = d.box(left, right)<br>
<br>
I do not get any error. If I specify <a href="http://yt.units.cm" rel="noreferrer" target="_blank">yt.units.cm</a>, I do get the error.<br>
<br>
This was not an issue on the same data file a few months ago. I think I have updated yt in the meantime, but I’m not sure what the version was.<br>
<br>
Is this a bug, or am I doing something wrong?<br>
<br>
Here is the unit registry for my data set:<br>
<br>
reg = d.unit_registry<br>
<br>
for un in reg.keys():<br>
        if un.startswith('code_'):<br>
                fmt_tup = (un, reg.lut[un][0], str(reg.lut[un][1]))<br>
                print ("Unit name:      {:<15}\nCGS conversion: {:<15}\nDimensions:     {:<15}\n".format(*fmt_tup))<br>
<br>
Unit name:      code_magnetic<br>
CGS conversion: 1.0<br>
Dimensions:     sqrt((mass))/(sqrt((length))*(<wbr>time))<br>
<br>
Unit name:      code_time<br>
CGS conversion: 1.0<br>
Dimensions:     (time)<br>
<br>
Unit name:      code_temperature<br>
CGS conversion: 1.0<br>
Dimensions:     (temperature)<br>
<br>
Unit name:      code_pressure<br>
CGS conversion: 1.0<br>
Dimensions:     (mass)/((length)*(time)**2)<br>
<br>
Unit name:      code_mass<br>
CGS conversion: 1.0<br>
Dimensions:     (mass)<br>
<br>
Unit name:      code_velocity<br>
CGS conversion: 1.0<br>
Dimensions:     (length)/(time)<br>
<br>
Unit name:      code_length<br>
CGS conversion: 1.0<br>
Dimensions:     (length)<br>
<br>
Unit name:      code_density<br>
CGS conversion: 1.0<br>
Dimensions:     (mass)/(length)**3<br>
<br>
Unit name:      code_metallicity<br>
CGS conversion: 1.0<br>
Dimensions:     1<br>
<br>
Cheers,<br>
 Alex<br>
______________________________<wbr>_________________<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/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
</blockquote></div><br></div>