Add grid_shape pre/postcondition checks.

This PR is not ready. It simply adds the checks we want on `grid_shape`. But the code does not conform to these. In particular: `all(gs <= s for (s, gs) in zip(shape, grid_shape) if s > 0)`. 

Once this condition is satisfied and this is merged this will close issue #406