function [index] = searchAirsElement(lat, lon, p_lat, p_lon)
min_lat = min(min(lat));
max_lat = max(max(lat));
min_lon = min(min(lon));
max_lon = max(max(lon));

if p_lat < min_lat || p_lat > max_lat || p_lon < min_lon || p_lon > max_lon
  index = -1;
else
  [m,n] = size(lat);
  dist = zeros(m,n);
  dist = compass(lat, lon, p_lat, p_lon);
  tmp = reshape(dist, [m * n, 1]);
  [min_val, index] = min(tmp);
end
