correct interpretation of shape of dx keyword

doc fix for shape of dx keyword and simplification of relevant implementation by using numpy.ndarray.ndim