Skip to content

Coordinates get transformed to variables #1680

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

Closed
olgabot opened this issue Nov 1, 2017 · 7 comments
Closed

Coordinates get transformed to variables #1680

olgabot opened this issue Nov 1, 2017 · 7 comments

Comments

@olgabot
Copy link

olgabot commented Nov 1, 2017

Code Sample, a copy-pastable example if possible

To get the data to reproduce the example: aws s3 sync s3://olgabot-maca/xarray-coordinates-to-variables/ . or download this .tar.gz file.

gist with code

Problem description

When I create a dataset, I set a bunch of metadata as coordinates, not variables:

screen shot 2017-11-01 at 12 45 39 pm

But when I reload that exact same dataset with xr.open_dataset, the coordinates have be moved into variables!!

screen shot 2017-11-01 at 12 45 54 pm

Interestingly, I think this is happening upon dataset creation because ds.variables already has the erroneous metadata:

screen shot 2017-11-01 at 12 47 20 pm

Expected Output

I expected the coordinates and variables to be consistent between opening and closing the file

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-97-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

xarray: 0.10.0rc1-2-gf83361c
pandas: 0.20.3
numpy: 1.13.3
scipy: 0.19.1
netCDF4: None
h5netcdf: None
Nio: None
bottleneck: None
cyordereddict: None
dask: None
matplotlib: None
cartopy: None
seaborn: None
setuptools: 36.5.0.post20170921
pip: 9.0.1
conda: None
pytest: None
IPython: 6.1.0
sphinx: None

@shoyer
Copy link
Member

shoyer commented Nov 2, 2017

@olgabot when I try to download your data file, I get the following error:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>789A57CAD523F9C5</RequestId>
<HostId>
nC1x+xpJ3bqNZ2MwSYl4vnhMdIT9FHxmr5que9X6htROEla3mFvgIWYhxLK5DmfoPe282rNHzds=
</HostId>
</Error>

@olgabot
Copy link
Author

olgabot commented Nov 2, 2017

Sorry about that, try again now. Damn permissions!

@shoyer
Copy link
Member

shoyer commented Nov 2, 2017

@olgabot the CSV files in your tar file all seem to be aliases when I unzip them... maybe try uploading one of them directly?

screen shot 2017-11-01 at 8 03 57 pm

@olgabot
Copy link
Author

olgabot commented Nov 2, 2017

Ah sorry about that. Just re-tar'd and uploaded the dereferenced files. All of the files are in the bucket itself which can be viewed with aws s3 ls s3://olgabot-maca/xarray-coordinates-to-variables/

@shoyer
Copy link
Member

shoyer commented Nov 3, 2017

@olgabot thanks for the report. The problem is spaces in your variable names -- if you replace them with underscores, everything works fine. See #1689 for a discussion of our options for fixing this in xarray.

@olgabot
Copy link
Author

olgabot commented Nov 7, 2017

Thank you! Replacing with underscores works just fine, I'll do that for my data for now.

@shoyer
Copy link
Member

shoyer commented Nov 8, 2017

Since we've figured this one out, I'm going to close it in favor of #1689.

@shoyer shoyer closed this as completed Nov 8, 2017
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

2 participants