clear

fig_ps=[752 56 1537 1038];
cm=brewermap(64,'*Spectral'); 
figure(1)
set(gcf,'Position',fig_ps)

% AVISO SLA
nx=1440; ny=720;
dx=0.25;
lon=-179.8750:dx:180;
lat= -89.8750:dx:90;

fn2=dir('AVISO_SLA/25km_tide/AVISO_LLC_SLA_202*.mat');
fns=dir('AVISO_SLA/25km/AVISO_LLC_SLA_202*.mat');
ll=length(fns);
sst_MUR=zeros([nx ny ll],'single');
sst_LLC=zeros([nx ny ll],'single');
sst_LLC2=zeros([nx ny ll],'single');

for i=1:ll
	fn=[fns(i).folder filesep fns(i).name];
	disp(fn)
	load(fn)
	sst_MUR(:,:,i) = sla_aviso;
	sst_LLC(:,:,i) = sla_llc;
	clear sla_aviso sla_llc
	fn=[fn2(i).folder filesep fn2(i).name];
	disp(fn)
	load(fn)
	sst_LLC2(:,:,i) = sla_llc;
	clear sla_aviso sla_llc
end

%two lines below for subtract annual mean:
sst_mur=nanmean(sst_MUR,3);
sst_MUR=sst_MUR-repmat(sst_mur,[1 1 ll]);

for i=1:ll
	fn=[fns(i).folder filesep fns(i).name];
        dd=fn(end-4-7:end-4);
sst_mur = sst_MUR(:,:,i);
sst_llc2= sst_LLC2(:,:,i);
sst_llc = sst_LLC(:,:,i);
sst_dif =sst_llc -sst_mur;
sst_dif2=sst_llc2-sst_mur;

cx=subplot(221);
mypcolor(lon,lat,sst_llc2')
caxis([-1 1]*.5)
thincb(1);
%colormap(cm)
colormap(cx,bluewhitered)
title(['tide SLA'])
plotland0

cx=subplot(222);
mypcolor(lon,lat,sst_llc')
caxis([-1 1]*.5)
thincb(1);
colormap(cx,bluewhitered)
title(['detide SLA'])
plotland0

cx=subplot(223);
mypcolor(lon,lat,sst_dif2')
caxis([-1 1]*.5);thincb(1);
colormap(cx,bluewhitered)
title(['tide - AVISO SLA @' dd])
plotland0

cx=subplot(224);
mypcolor(lon,lat,sst_dif')
caxis([-1 1]*.5);thincb(1);
colormap(cx,bluewhitered)
title(['detide - AVISO SLA @' dd])
plotland0

print('-dpng',['fig_MUR_SST' myint2str(i,3)])
clf

end
