%testplot
close all;

%% study area
figure; 
hold on;
% scatter(temphawaii(:,3)-360,temphawaii(:,2),4,temphawaii(:,5))
plot([-182 -182 -167 -167 -182],[25 15 15 25 25],'w')
text(-180,22,'SAR Mode','Color',[1 1 1],'FontWeight','Bold')
text(-159,19.5,'Hawaii','Color',[1 1 1],'FontWeight','Bold')
% pobj = patch([-173 -173 -167.05 -167.05 -173],[24.95 15.05 15.05 24.95 24.95],'y');set(pobj,'Facealpha',0.4)
plot([-173 -173 -167.1 -167.1 -173],[24.9 15.1 15.1 24.9 24.9],'y')
plot_google_map('maptype','satellite') % Get the google map!
xlim([-184 -154]);ylim([10 30]);%caxis([-5 25]);
xlabel('Longitude [deg]');ylabel('Latitude [deg]');box on;


%%
clear AA

AA = load('DATA/geo.016.190.alt');
AA(:,3) = AA(:,3)-360;

figure;
scatter(AA(:,3),AA(:,2),4,AA(:,5),'filled')
title('RADS Height Anomaly after crossover-adjustment [m]')
caxis([-0.1 0.1]);
xlim([min(AA(:,3))-0.5 max(AA(:,3))+0.5]);ylim([min(AA(:,2))-0.5 max(AA(:,2))+0.5]);
% xlim([4 7]);ylim([39 42])
% set(gca,'Xtick',22:2:26,'YTick',38:1:42);xlabel('Lon [deg]');ylabel('Lat [deg]')
plot_google_map('maptype','satellite') % Get the google map!
h = colorbar;
title(h,' [m]')

%% plot gravity data
gradata = read_grid('DATA/geo.016.190.gra'); 

figure;
imagesc(flipud(gradata));caxis([-50 250])
title('Gravity Anomaly, full wavelength')
h = colorbar;
title(h,' [mGal]')

%% plot dg along ship track
XX = load('Pacific_Ship_track_dg.dat');
XX1 = load('DATA/dg_diff.dat');


figure('Name','dg difference [mGal]')
hold on;
plot(XX1(:,3),-XX1(:,5),'LineWidth',2)
plot([XX1(1,3) XX1(end,3)],[0 0],'k--')
title('(Alt-derived dg) minus (Ship dg)')

figure;
hold on;
plot(XX(:,3),XX(:,5),'LineWidth',2)
plot(XX1(:,3),-XX1(:,5)+XX(:,5),'r','LineWidth',2)
legend('Ship dg','Alt-derived dg')

figure;
hold on;
scatter(XX(1:10:end,3)-360,XX(1:10:end,2),3,XX(1:10:end,5),'filled');
caxis([-50 120]);
h = colorbar;
title(h,' [mGal]')
plot_google_map('maptype','satellite') % Get the google map!
xlim([-173 -164]);ylim([14 20]);%caxis([-5 25]);
xlabel('Longitude [deg]');ylabel('Latitude [deg]');box on;


