% gpsfix

%set global variables
 % global lat lon emat trandist deltapos bottom xint yint
 global lat lon emat trandist deltapos bottom xint yint depthint mindepth maxdepth left step ic tflag mflag moc filename

newlat=lat;
newlon=lon;
cc=0;
for nn=(yint+1):yint:length(lat)
for nn=2:length(lat)
   
 mm=nn;qq=0;
 if nn>cc
 while (lat(mm)==lat(mm-1) & lon(mm)==lon(mm-1) & mm+yint < length(lat)), mm=mm+yint;qq=qq+1; end

 if qq==0
    newlat(nn:nn+-1)=lat(nn:nn+-1);
    newlon(nn:nn+-1)=lon(nn:nn+-1);
   else
    if mm+yint < length(lat) % this if statment put in on 24 
                             % Nov after having problems with gb25 bombing on 
                             % dlat at end of file.
      mm=mm+1;qq=qq+1;
      %nn
      end
    dlat=(lat(mm)-lat(nn-1))/(qq+1);
    dlon=(lon(mm)-lon(nn-1))/(qq+1);
    cc=nn+(qq);
    for rr=nn:qq+nn
      newlat(rr:rr+-1)=newlat(rr-1:rr-1)+dlat;
      newlon(rr:rr+-1)=newlon(rr-1:rr-1)+dlon;
    end
   end
 end
end
end
lat=newlat; clear newlat; 
lon=newlon; clear newlon;
%length(lat)
%length(lon)
%pause
clear mm nn qq cc rr dlat dlon

