Contribution lab / Scientific data
Empty does not
mean shapeless.
A filter can return no values and still have a meaningful shape. Change the axes of this cube to see what the netCDF4 correction preserves.
30-second example / Pause anywhere to explore
01 / Start with three axes
105 values occupy a 3 × 5 × 7 source array. Orbit the cube or separate its X layers to see all three dimensions.
Try a selection
data[:, :, :]Expected output shape
(3, 5, 7)All three axes survive. Each selected X position combines with every selected Y and Z position.
X: 3 · Y: 5 · Z: 7
Cube positions follow the (3, 5, 7) example. Read the selected result’s dimensions in the shape above.
The failure this addresses
Zero values.
Still 100 columns.
The reported two-dimensional case starts with a (24, 100) variable. Selecting zero rows returned (0, 1); the merged correction retains (0, 100).
- Before / reported baseline
- (0, 1)
- Merged correction
- (0, 100)
An empty axis is retained with length zero. An integer index removes its axis. These are different operations, even when both lead to an empty output.
Merged in #1499 and included in the netCDF4 1.7.5 source release. This interactive model illustrates indexing; it does not execute the native library.
Inspect the implementation and regression tests ↗