function [latArray,lonArray]=interpLatLon(latArray,lonArray,box)
% This function increases lat,lon array by 5 to match number of pixels
% (Extracted from plotSingleImage.m)
% optional box argument to limit output array to a selected box region
% Kevin Baggett
% Fri Aug 24 18:40:04 UTC 2001
[row,col]=size(latArray);

w=waitbar(0,'Interpolating Latitude Array');
pause(1);
[X,Y] = meshgrid([1:5:5*col],[1:5:5*row]);
XI = [1:5*col];
YI = [1:5*row]';

latArray = interp2(X,Y,latArray,XI,YI);
waitbar(0.5,w,'Interpolating Longitude Array');
lonArray = interp2(X,Y,lonArray,XI,YI);
waitbar(1,w);
close(w);

%lat/lon need to be one column shorter to match mimage
latArray=latArray(:,1:5*col-1);
lonArray=lonArray(:,1:5*col-1);

%limit output to a box
if nargin==3 
    latArray=latArray(floor(box(1)):floor(box(1))+floor(box(3))-1,floor(box(2)):floor(box(2))+floor(box(4))-1);
    lonArray=lonArray(floor(box(1)):floor(box(1))+floor(box(3))-1,floor(box(2)):floor(box(2))+floor(box(4))-1);
end
