def _findindex(az0, el0, az, el):
assert az0.size == el0.size  <EOL>assert az.ndim == el.ndim == <NUM_LIT:1>, '<STR_LIT>'<EOL>ic = np.empty(az.size, dtype=int)<EOL>for i, (a, e) in enumerate(zip(az, el)):<EOL><INDENT>ic[i] = haver.anglesep_meeus(az0, el0, a, e, deg=False).argmin()<EOL><DEDENT>"""<STR_LIT>"""<EOL>r, c = np.unravel_index(ic, az0.shape, order='<STR_LIT:C>')<EOL>mask = (c == <NUM_LIT:0>) | (c == az0.shape[<NUM_LIT:1>] - <NUM_LIT:1>) | (r == <NUM_LIT:0>) | (r == az0.shape[<NUM_LIT:0>] - <NUM_LIT:1>)<EOL>r = np.ma.masked_where(mask, r)<EOL>c = np.ma.masked_where(mask, c)<EOL>return r, c<EOL>
inputs:
------
az0, el0: N-D array of azimuth, elevation. May be masked arrays
az, el: 1-D vectors of azimuth, elevation points from other camera to find closest angle for joint FOV.

output:
row, col:  index of camera 0 closest to camera 1 FOV for each unmasked pixel

I think with some minor tweaks this could be numba.jit if too slow.