Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coordinate type changing from string to object #1266

Closed
seth-p opened this issue Feb 13, 2017 · 3 comments
Closed

Coordinate type changing from string to object #1266

seth-p opened this issue Feb 13, 2017 · 3 comments

Comments

@seth-p
Copy link
Contributor

seth-p commented Feb 13, 2017

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'
@stale
Copy link

stale bot commented Jan 23, 2019

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here; otherwise it will be marked as closed automatically

@seth-p
Copy link
Contributor Author

seth-p commented Jun 9, 2019

I think this is still an issue.

@kmuehlbauer
Copy link
Contributor

Works with latest xarray 2024.10.0. Please reopen with updated examples if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants