It is not necessary that coordinates are 1D. Could be also that your lat/lon are 2D , but that the longitudes are all the same. In this case the routine would fail.