%load 2006_2007.mat
%load cencalLL.mat
startAt = 2807;
div = 200;
figure;quiveralt(codar_lat, codar_lon, codar_u(:,startAt)/div,codar_v(:,startAt)/div,0);axis tight
xl = xlim; yl=ylim; 
hold on; fill([LON;90],[LAT;0],[0.8 0.8 0.8]); xlim(xl); ylim(yl);hold off;
title 'Averaging Speeds'
avg_speed1 = nanmean(sqrt(codar_u(:,startAt).^2+codar_v(:,startAt).^2));
avg_speed120 = nanmean(nanmean(sqrt(codar_u(:,startAt:startAt+119).^2+codar_v(:,startAt:startAt+119).^2)));
text(-122.14, 37.018, ['Average speed (1 hour): ' num2str(avg_speed1) ' cm/s']);
text(-122.14, 36.993, ['Average speed (5 days): ' num2str(avg_speed120) ' cm/s']);
clat = codar_lat;
clon = codar_lon;
clat(find(isnan(codar_u(:,startAt)))) = NaN;
clon(find(isnan(codar_u(:,startAt)))) = NaN;
figure;quiveralt(nanmean(clat), nanmean(clon), nanmean(codar_u(:,startAt)/div),nanmean(codar_v(:,startAt)/div),0);
hold on; fill([LON;90],[LAT;0],[0.8 0.8 0.8]); xlim(xl); ylim(yl);hold off;
title 'Averaging Current Components'
speed_avg1 = sqrt(nanmean(codar_u(:,startAt)).^2+nanmean(codar_v(:,startAt)).^2);
speed_avg120 = sqrt(nanmean(nanmean(codar_u(:,startAt:startAt+119))).^2+nanmean(nanmean(codar_v(:,startAt:startAt+119))).^2);
text(-122.14, 37.018, ['Average current (1 hour): ' num2str(speed_avg1) ' cm/s']);
text(-122.14, 36.993, ['Average current (5 days): ' num2str(speed_avg120) ' cm/s']);
