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

createVariable does not accept Dimension objects as dimension specifications #1145

Closed
zerothi opened this issue Jan 7, 2022 · 3 comments
Closed

Comments

@zerothi
Copy link
Contributor

zerothi commented Jan 7, 2022

It would be nice if the following could be done, for completeness sake:

import netCDF4 as nc

out = nc.Dataset("hello.nc", 'w')
dim = out.createDimension("size", 2)
foo = out.createVariable("foo", 'f4', ('size',))
bar = out.createVariable("bar", 'f4', (dim,))

The documentation is coherent with the implementation, but I think the above should be allowed.

@jswhit
Copy link
Collaborator

jswhit commented Jan 8, 2022

Not obvious to me that this is necessary, but if someone's willing to implement this I'll entertain a PR.

@jswhit
Copy link
Collaborator

jswhit commented Jan 15, 2022

This actually turned out to be pretty straightforward as well, so I went ahead and created a PR #1147

jswhit added a commit that referenced this issue Jan 18, 2022
allow createDimension to accept Dimension instances (issue #1145)
@jswhit
Copy link
Collaborator

jswhit commented Jan 18, 2022

PR #1147 merged, closing now...

@jswhit jswhit closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants