%find all cases where Perseverance moved less than 2kn/hour
clear all
close all
load('/Volumes/Boss_SSD/Perseverance/prod/Perseverance_InLine_TSG_20260120_20260226_Product_v20260228.mat');
lat=tsg.lat;
lon=tsg.lon;
I=find(lon<0);
lon(I)=360+lon(I);
lat=lat*pi/180;
lon=lon*pi/180;

time=tsg.dt(1:end-1);
v=2*3959*asin(sqrt(sin(diff(lat)).^2+cos(lat(1:end-1)).*cos(lat(2:end)).*sin(diff(lon)).^2))*60;
I=find(v>15);
v(I)=NaN;
hist(v,100);

II=find(v<2);
plot(time(II),'.')
AA=table(time(II),lat(II)*180/pi,lon(II)*180/pi,v(II));
filename='times_locations_with_low_velocity.csv';
writetable(AA,filename)


