nd2t: small improvement

The previous version of ndarray_to_table, under certain special
circumstances, would produce a puzzling error message if its setting
for the `outer` parameter was wrong.

This version tests for dimension consistency earlier, which can detect
an incorrect setting for the `outer` parameter, and thereby make the
puzzling error message above less likely to occur.  (Unfortunately, it
is still possible for the dimension consistency check to pass even in
cases in which the `outer` parameter is wrong, so this is only an
"improvement" rather than a fix.)
collapse_: remove left-over test code