Further fix to data dims inference, plus test.  Check data.ndim against variables, plus test.