def findClosestAzel(az, el, azpts, elpts):
assert az.ndim == <NUM_LIT:2><EOL>assert az.shape == el.shape<EOL>azpts = np.atleast_1d(azpts)<EOL>elpts = np.atleast_1d(elpts)<EOL>assert azpts.shape == elpts.shape<EOL>az = np.ma.masked_invalid(az)<EOL>el = np.ma.masked_invalid(el)<EOL>az = np.radians(az)<EOL>el = np.radians(el)<EOL>azpts = np.radians(azpts)<EOL>elpts = np.radians(elpts)<EOL>if np.ma.is_masked(azpts):<EOL><INDENT>azpts = azpts.compressed()<EOL>elpts = elpts.compressed()<EOL><DEDENT>else:<EOL><INDENT>azpts = np.atleast_1d(azpts).ravel()<EOL>elpts = np.atleast_1d(elpts).ravel()<EOL><DEDENT>nearRow, nearCol = _findindex(az, el, azpts, elpts)<EOL>return nearRow, nearCol<EOL>
assumes that azpts, elpts are each list of 1-D arrays or 2-D arrays
az: 2-D Numpy array of azimuths in the image
el: 2-D Numpy array of elevations in the image
azpts: 1-D or 2-D Numpy array of azimuth points to see where nearest neighbor index is
elpts: 1-D or 2-D Numpy array of azimuth points to see where nearest neighbor index is