Fix quantity problem with recent Pint versions

Quantities are not cast to arrays if they are scalars. That also means that they
don't have a shape attribute. Accessing that fails spectacularly.