docs: def ndim(self) -> int:
          """Get number of dimensions."""
          try:
              assert self._ndim is not None
          except (AssertionError, AttributeError):
              if len(self.variables) == 0:
                  self._ndim = 0
              else:
                  self._ndim = self.variables[0].ndim
          finally:
              return self._ndim