Convert scalar arguments to arrays, and check that lengths are equal
np.atleast_1d handles the conversion in one step.  It's doc reads:


  Scalar inputs are converted to 1-dimensional arrays, whilst
  higher-dimensional inputs are preserved.


In [217]: np.atleast_1d(1)
Out[217]: array([1])
In [218]: np.atleast_1d([1,2,3])
Out[218]: array([1, 2, 3])


So your code simplifies to:

lat = np.atleast_1d(lat)
lon = np.atleast_1d(lon)
if lat.shape != lon.shape:
    &lt;raise error&gt;


Look at the code for atleast_1d; it's instructive.  Bascially it does:

lat = np.array(lat)
if len(lat.shape)==0:
   lat = lat.reshape(1)


Check for yourself what np.array(1) produces.

I could simplify it further with just one call to atleast_1d, since it takes multiple inputs:

lat, lon = np.atleast_1d(lat, lon)