clear

%nsidc
% read northern data grid coordinates
nnx=304; nny=448;
nlat=readbin('psn25lats.dat',[nnx nny],1,'int32')/100000;
nlon=readbin('psn25lons.dat',[nnx nny],1,'int32')/100000;
ix=find(nlon>180);
nlon(ix)=nlon(ix)-360;
% read southern data grid coordinates
snx=316; sny=332;
slat=readbin('pss25lats.dat',[snx sny],1,'int32')/100000;
slon=readbin('pss25lons.dat',[snx sny],1,'int32')/100000;
ix=find(slon>180);
slon(ix)=slon(ix)-360;

% interpolate to NSIDC grid
slan = nan*nlon; slas = nan*slon;
nic_llc=zeros([size(nlon) 365],'single');
sic_llc=zeros([size(slon) 365],'single');
nic_nsidc=zeros([size(nlon) 365],'single');
sic_nsidc=zeros([size(slon) 365],'single');
%load mk_nsidc.mat
load mk_nsidc2.mat
n_llc2=nic_llc; s_llc2=sic_llc;
load mk_nsidc3.mat
n_llc3=nic_llc; s_llc3=sic_llc;

for i=1:10:365
nic2=n_llc2(:,:,i); sic2=s_llc2(:,:,i); 
nic3=n_llc3(:,:,i); sic3=s_llc3(:,:,i); 
figure(1)
subplot(121)
m_proj('stereo','lat',90,'lon',0,'rad',40)
m_pcolor(nlon,nlat,nic2-nic3*1)
caxis([-.1 .1])
shading flat,thincb(1);
m_grid('xtick',-180:30:180,'ytick',40:10:80)
subplot(122)
m_proj('stereo','lat',-90,'lon',0,'rad',40)
m_pcolor(slon,slat,sic2-sic3*1)
caxis([-.1 .1])
shading flat,thincb(1);
m_grid('xtick',-180:30:180,'ytick',-80:10:-40,'Xaxislocation','top','Yaxislocation','middle')
colormap(bluewhitered)
%colormap(jet)
title(i)
pause(.5)
end

for i=1:10:365
nic2=n_llc2(:,:,i); sic2=s_llc2(:,:,i); 
nic3=n_llc3(:,:,i); sic3=s_llc3(:,:,i); 
figure(1)
subplot(121)
m_proj('stereo','lat',90,'lon',0,'rad',40)
m_pcolor(nlon,nlat,nic2)
shading flat,thincb(1);
m_grid('xtick',-180:30:180,'ytick',40:10:80)
subplot(122)
m_proj('stereo','lat',90,'lon',0,'rad',40)
m_pcolor(nlon,nlat,nic3)
shading flat,thincb(1);
m_grid('xtick',-180:30:180,'ytick',40:10:80)
colormap(jet)
title(i)
pause(.5)
end

for i=1:10:365
nic2=n_llc2(:,:,i); sic2=s_llc2(:,:,i); 
nic3=n_llc3(:,:,i); sic3=s_llc3(:,:,i); 
figure(1)
subplot(121)
m_proj('stereo','lat',-90,'lon',0,'rad',40)
m_pcolor(slon,slat,sic2)
shading flat,thincb(1);
m_grid('xtick',-180:30:180,'ytick',-80:10:-40,'Xaxislocation','top','Yaxislocation','middle')
subplot(122)
m_proj('stereo','lat',-90,'lon',0,'rad',40)
m_pcolor(slon,slat,sic3)
shading flat,thincb(1);
m_grid('xtick',-180:30:180,'ytick',-80:10:-40,'Xaxislocation','top','Yaxislocation','middle')
colormap(jet)
title(i)
pause(.5)
end


