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

Subspaces of constructs can currently have one or more size 0 axes #209

Closed
davidhassell opened this issue Aug 24, 2022 · 0 comments · Fixed by #210
Closed

Subspaces of constructs can currently have one or more size 0 axes #209

davidhassell opened this issue Aug 24, 2022 · 0 comments · Fixed by #210
Labels
bug Something isn't working
Milestone

Comments

@davidhassell
Copy link
Contributor

numpy (and similar data objects that share its API, such as dask, cfdm.Data) reasonably allow subspaces to have size 0 axes:

>>> import numpy as np
>>> a = np.arange(9)
>>> a[[False] * 9]
array([], dtype=int64)

At cfdm v1.10.0.0, cfdm constructs also allow this:

>>> import cfdm
>>> f = cfdm.example_field(0)
>>> f.shape
(5, 8)
>>> f[[False] * 5]
<Field: specific_humidity(latitude(0), longitude(8)) 1>

... but they shouldn't, because it is not allowed by the CF data model. I.e. in the above example, f[[False] * 5] should raise an exception.

PR to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant