[yt-dev] Issue #874: YTArray multiplication is not associative with respect to code units (yt_analysis/yt)
John ZuHone
issues-reply at bitbucket.org
Thu Jul 31 22:15:45 PDT 2014
New issue 874: YTArray multiplication is not associative with respect to code units
https://bitbucket.org/yt_analysis/yt/issue/874/ytarray-multiplication-is-not-associative
John ZuHone:
Test case, on a FLASH dataset:
```
#!python
>>> a = yt.YTArray([1,2,3], "cm")
>>> b = ds.arr([1,2,3], "code_length")
>>> a*b
YTArray([ 1., 4., 9.]) cm*code_length
>>> b*a
YTArray([ 1., 4., 9.]) cm*code_length
>>> (b*a).in_units("code_length**2")
YTArray([ 1., 4., 9.]) code_length**2
>>> (a*b).in_units("code_length**2")
UnitParseError: Could not find unit symbol 'code_length' in the provided symbols.
```
Presumably this is because the final ``YTArray`` takes the unit registry from the first of the two in the binary operation. This is a simple and irrelevant example, but it illustrates the problem. Not sure how important this is.
Responsible: ngoldbaum
More information about the yt-dev
mailing list