[yt-dev] Issue #1280: ds.box() overrides units of YTArray inputs (yt_analysis/yt)
scott_feister
issues-reply at bitbucket.org
Tue Sep 20 16:25:20 PDT 2016
New issue 1280: ds.box() overrides units of YTArray inputs
https://bitbucket.org/yt_analysis/yt/issues/1280/dsbox-overrides-units-of-ytarray-inputs
scott_feister:
BUG SUMMARY: ds.box(left_edge, right_edge) ignores the YT Units of left_edge, right_edge
EXAMPLE OF BUG:
```
#!python
import yt
from yt import YTArray
ds = yt.load("Enzo_64/DD0043/data0043")
print("Domain info:")
print(ds.domain_width.in_units('Mpc'))
print(ds.domain_center.in_units('Mpc'))
print ('Defining two data objects that should be identical')
left_edge = YTArray([20, 20, 20], 'Mpc')
right_edge = YTArray([40, 40, 40], 'Mpc')
center = left_edge - right_edge
buggybox = ds.box(left_edge, right_edge) # Data object 1
happyregion = ds.region(center, left_edge, right_edge) # Data object 2
print("Data object made with ds.box(): left edge, left edge:")
print(buggybox.left_edge.in_units('Mpc'))
print(buggybox.left_edge.in_units('Mpc'))
print("Data object made with ds.region(): left edge, right edge:")
print(happyregion.left_edge.in_units('Mpc'))
print(buggybox.left_edge.in_units('Mpc'))
print("BUG SUMMARY: Calling ds.box(left_edge, right_edge) ignores the YT units of left_edge, right_edge. It incorrectly assumes 'code_length' units")
```
Cheers, Scott
More information about the yt-dev
mailing list