While we're at it, the linked code also goes on to validate the units of all the grid coordinates to ensure they are compatible with the cartopy CRS transformations. You could do with that too.