Closed
Description
Originally posted on https://groups.google.com/forum/#!topic/xarray/4k8ZAx998UU. I would expect [2]
, [3]
, and [4]
to produce identical results, with coordinate xyz
being of type |S1
(in general |Sn
where n is minimal to accommodate the coordinate values), not object
. This behavior is observed with xarray versions 0.8.2 and 0.9.1.
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from xarray import DataArray
In [2]: DataArray([1.], dims=('xyz',), coords={'xyz': ['a']}) + \
...: DataArray([5.], dims=('xyz',), coords={'xyz': ['a']})
Out[2]:
<xarray.DataArray (xyz: 1)>
array([ 6.])
Coordinates:
* xyz (xyz) |S1 'a'
In [3]: DataArray([1., 2.], dims=('xyz',), coords={'xyz': ['a', 'b']}) + \
...: DataArray([5.], dims=('xyz',), coords={'xyz': ['a']})
Out[3]:
<xarray.DataArray (xyz: 1)>
array([ 6.])
Coordinates:
* xyz (xyz) object 'a'
In [4]: DataArray([1.], dims=('xyz',), coords={'xyz': ['a']}) + \
...: DataArray([5., 6.], dims=('xyz',), coords={'xyz': ['a', 'b']})
Out[4]:
<xarray.DataArray (xyz: 1)>
array([ 6.])
Coordinates:
* xyz (xyz) object 'a'
Metadata
Metadata
Assignees
Labels
No labels