ZP / ContributionsnetCDF4 PR #1499 ↗

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

00:00 / 00:30

105 values occupy a 3 × 5 × 7 source array. Orbit the cube or separate its X layers to see all three dimensions.

Source array 3 × 5 × 7105 values selected

Result shape (3, 5, 7)

Loading the 3D cube…

Selected valuesSource extent

Drag to orbit · scroll to zoom · select a cube to inspect its index.

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 proposed correction retains (0, 100).

Before / reported baseline
(0, 1)
Proposed 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.

Inspect the implementation and regression tests ↗