clcl; 
fil = '/Volumes/nascratch/soeddy/data/processed/aviso_ssh_1993_1998.nc';
ssh=ncread(fil,'ETA'); I=find(ssh>500 | ssh<-500); ssh(I)=NaN; 
meannan(ssh(:))
drawSSh(ncread(fil,'NBLONGITUDES'),ncread(fil,'NBLATITUDES'),ssh)
print -dpdf ../ps/ssh_mean_aviso.pdf

clcl;
fil = '/Volumes/nascratch/soeddy/data/processed/ref_eta_1993_1998.nc';
ssh=ncread(fil,'eta_t').*100; I=find(ssh<-1e10); ssh(I)=NaN;
ssh=ssh+45
drawSSh(ncread(fil,'xt_ocean'),ncread(fil,'yt_ocean'),ssh)
print -dpdf ../ps/ssh_mean_reference.pdf


function drawSSh(x,y,ssh)
 xlims=[0 360]; ylims=[-80 65];
 in=[-200:10:200];% 180];
 [X,Y]=meshgrid(x,y);
    figure; drawnow;
          m_proj('Mercator','long',xlims,'lat', ylims);
          hold on
          [xxtt,yytt]=m_ll2xy(X,Y);
          flat_pcolor(xxtt,yytt,ssh'), shading flat;
          amcolormap(jet,in); amcaxis(in);
          [cc]=amcolorbar('horiz',in);
          get(cc,'position') 
          set(cc,'linewidth',2,'tickdir','out','fontweight','bold', ...
                  'xtick',in([1:4:end]),'xticklabel',in([1:4:end]),'position', ...
                  [0.130+0.05 0.1100+0.05 0.7750-0.1 0.0611/4], ...
                  'fontsize',10)
%          if exist('../data/processed/coasttmp.mat','file')~=2
%           m_gshhs_f('save','../data/processed/coasttmp')
%          end
%          m_usercoast('../data/processed/coasttmp.mat','patch',[0.7 0.7 0.7])
          m_coast('patch',[0.7 0.7 0.7]);
          m_grid('box','fancy','tickdir','in','linestyle','none', ...
                 'fontsize',10); 
          legend('off')
          brighten(0.5)
end
