Skip to content

Consistent use of abbreviations: attrs, dims, coords #190

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
shoyer opened this issue Jul 27, 2014 · 3 comments · Fixed by #194
Closed

Consistent use of abbreviations: attrs, dims, coords #190

shoyer opened this issue Jul 27, 2014 · 3 comments · Fixed by #194
Milestone

Comments

@shoyer
Copy link
Member

shoyer commented Jul 27, 2014

Right now, we use ds.attrs but the keyword argument is still attributes. We should resolve this inconsistency.

We also use dimensions and coordinates instead of the natural abbreviations dims and coords (although dims is used in the Variable constructor). Should we switch to the abbreviated versions for consistency with attrs?

Note that I switched to attrs in part because of its use in other packages (h5py, pytables and blz). There is not as clear precedent for what to call dimensions and coordinates.

@shoyer
Copy link
Member Author

shoyer commented Jul 31, 2014

There is at least one major advantage to using abbreviations: less typing and shorter lines of code!

e.g., compare:

x = xray.Coord('x', np.arange(10))
y = xray.Coord('y', ['a', 'b', 'c'])
arr = xray.DataArray(data, dims=['x', 'y'], coords=[x, y])
'x' in arr.dims

and

x = xray.Coordinate('x', np.arange(10))
y = xray.Coordinate('y', ['a', 'b', 'c'])
arr = xray.DataArray(data, dimensions=['x', 'y'], coordinates=[x, y])
'x' in arr.dimensions

h5py does use dims instead of dimensions: http://docs.h5py.org/en/2.3/high/dims.html and Iris also uses the abbreviations "dim" and "coord".

These are pretty common/obvious abbreviations and they are fundamental enough that I would not worry about imposing them on our users.

Right now, I am leaning toward switching to always using dim/dims and coord/coords/Coord before the 0.2 release. But I don't want to be too hasty about this -- any opinions out there? The counter argument would be that I should stop wasting my time bike-shedding (especially after I've already released this stuff out in the wild).

shoyer added a commit to shoyer/xarray that referenced this issue Aug 13, 2014
@shoyer
Copy link
Member Author

shoyer commented Aug 13, 2014

I've decided that we do want to switch to using coords and dims.

I have not renamed noncoordinates to noncoords. I'm going to deprecate that property instead (#211).

Also I haven't renamed xray.Coordinate yet -- that will probably become xray.CoordIndex eventually (#197) but for now is OK.

@shoyer shoyer removed the question label Aug 13, 2014
@shoyer shoyer mentioned this issue Aug 13, 2014
16 tasks
@shoyer
Copy link
Member Author

shoyer commented Aug 14, 2014

Actually, I am going to go ahead and rename noncoordinates to noncoords. Deprecating/removing that property will have to wait.

Otherwise everything was done in #194.

@shoyer shoyer closed this as completed Aug 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant