Fix counting of dimensions in ncdump
Fix counting of dimensions in ncdump

re: issue https://github.com/Unidata/netcdf-c/issues/2002

It turns out that ncdump has an error where it assumes that the set of all dimension ids has no holes. That is that (maxid+1) = ndims. This is incorrect for a variety of reasons for netcdf-4.

So instead of counting total number of dimensions in a dataset, it is necessary to look for the maximum dimension id and use that when allocating a table of all dimensions.

Unidata/netcdf-c,Unidata/netcdf-c,Unidata/netcdf-c,Unidata/netcdf-c