[yt-users] Code units have not been defined in Flash dataset

Nathan Goldbaum nathan12343 at gmail.com
Sat Jan 28 16:32:15 PST 2017


I should say that as a workaround you can do something like:

left_edge = ds.arr([-500, -500,- 20], 'pc')
right_edge = ds.arr([500, 500, 20], 'pc')
b = ds.box(left_edge, right_edge)

I'm already planning to release yt 3.3.4 soon, I'll try to make sure that
this fix is part of that release.

Thanks again for the bug report!

-Nathan

On Fri, Jan 27, 2017 at 3:50 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> Hi Alex,
>
> Thanks for the report! I was able to reproduce the issue and I think I
> have a fix:
>
> https://bitbucket.org/yt_analysis/yt/pull-requests/2508
>
> 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 :)
>
> -Nathan
>
>
>
> On Fri, Jan 27, 2017 at 3:32 PM, Alex Hill <ashill at haverford.edu> wrote:
>
>> Hi,
>>
>> 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.
>>
>> Example:
>>
>> import yt
>> yt.__version__
>>
>> ‘3.3.3’
>>
>> d = yt.load('sn34_smd75_sub1_hdf5_plt_cnt_0030')
>> b = d.box([-500,-500,-20]*yt.units.pc.in_cgs(),[500,500,20]*yt.
>> units.pc.in_cgs())
>> fp = yt.PhasePlot(b,'n','pk',['cell_volume'],weight_field=None,
>> fractional=True)
>>
>> I get the following error:
>>
>> UnitParseError: Code units have not been defined.
>> Try creating the array or quantity using ds.arr or ds.quan instead.
>>
>> If I instead do
>>
>> b = d.box([-1.54e+21, -1.54e+21, -6.17e+19], [1.54e+21, 1.54e+21,
>> 6.17e+19])
>>
>> or
>>
>> left = d.domain_left_edge
>> right = d.domain_right_edge
>> left[2] = -6.17e19
>> right[2] = 6.17e19
>> b = d.box(left, right)
>>
>> I do not get any error. If I specify yt.units.cm, I do get the error.
>>
>> 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.
>>
>> Is this a bug, or am I doing something wrong?
>>
>> Here is the unit registry for my data set:
>>
>> reg = d.unit_registry
>>
>> for un in reg.keys():
>>         if un.startswith('code_'):
>>                 fmt_tup = (un, reg.lut[un][0], str(reg.lut[un][1]))
>>                 print ("Unit name:      {:<15}\nCGS conversion:
>> {:<15}\nDimensions:     {:<15}\n".format(*fmt_tup))
>>
>> Unit name:      code_magnetic
>> CGS conversion: 1.0
>> Dimensions:     sqrt((mass))/(sqrt((length))*(time))
>>
>> Unit name:      code_time
>> CGS conversion: 1.0
>> Dimensions:     (time)
>>
>> Unit name:      code_temperature
>> CGS conversion: 1.0
>> Dimensions:     (temperature)
>>
>> Unit name:      code_pressure
>> CGS conversion: 1.0
>> Dimensions:     (mass)/((length)*(time)**2)
>>
>> Unit name:      code_mass
>> CGS conversion: 1.0
>> Dimensions:     (mass)
>>
>> Unit name:      code_velocity
>> CGS conversion: 1.0
>> Dimensions:     (length)/(time)
>>
>> Unit name:      code_length
>> CGS conversion: 1.0
>> Dimensions:     (length)
>>
>> Unit name:      code_density
>> CGS conversion: 1.0
>> Dimensions:     (mass)/(length)**3
>>
>> Unit name:      code_metallicity
>> CGS conversion: 1.0
>> Dimensions:     1
>>
>> Cheers,
>>  Alex
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170128/9068e93f/attachment-0001.html>


More information about the yt-users mailing list