NCAS-CMS/cfdm

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

davidhassell opened this issue · 0 comments

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.