clear

fig_ps=[752 56 1537 1038];
cm=brewermap(64,'*Spectral'); 

% CNR_SSS
nx=1440; ny=720;
dx=0.25;
lon=dx/2:dx:360;
lat=-90+dx/2:dx:90;
[LAT LON]=meshgrid(lat,lon);

fns=dir('CNR_SSS/25km/CNR_LLC_SSS_202*.mat');
ll=length(fns);
sst_MUR=zeros([nx ny ll],'single');
sst_LLC=zeros([nx ny ll],'single');

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

sst_mur=nanmean(sst_MUR,3);
sst_llc=nanmean(sst_LLC,3);
sst_DIF=sst_LLC-sst_MUR;

sst_dif=nanmean(sst_DIF,3);
sst_rms=sqrt(nanmean(sst_DIF.^2,3));


figure(1)
set(gcf,'Position',fig_ps)
ix=find(isnan(sst_dif));

subplot(221);
mypcolor(lon,lat,sst_mur')
caxis([32 38])
thincb(1);
colormap(cm)
title(['CNR SSS'])
hold on
plot(LON(ix),LAT(ix),'.','Color',[1 1 1]*.6,'MarkerSize',1e-4)

subplot(222)
mypcolor(lon,lat,sst_llc')
caxis([32 38])
thincb(1);
colormap(cm)
title(['LLC2160 SSS'])
hold on
plot(LON(ix),LAT(ix),'.','Color',[1 1 1]*.6,'MarkerSize',1e-4)

cx=subplot(223);
mypcolor(lon,lat,sst_dif')
caxis([-1 1]*2);thincb(1);
colormap(cx,bluewhitered)
title(['mean LLC2160 - CNR SSS'])
hold on
plot(LON(ix),LAT(ix),'.','Color',[1 1 1]*.6,'MarkerSize',1e-4)

cx=subplot(224);
mypcolor(lon,lat,sst_rms')
caxis([0 2]);thincb(1);
colormap(cx,jet)
title(['rms LLC2160 - CNR SSS'])
hold on
plot(LON(ix),LAT(ix),'.','Color',[1 1 1]*.6,'MarkerSize',1e-4)

%print('-dpng',['fig_CNR_SSS'])

