%make a movie of sea-ice thickness southern ocean

%define input
 idir='../dat/mod/daily/';
 fils = dir([idir '*1918*.nc']);

%plotting details
 xlims=[0 360];
 ylims=[-78.15 -20];
 in=[0:0.05:1 1.25:0.25:4];

%get grid once
 x=ncread([idir fils(1).name],'xt');
 y=ncread([idir fils(1).name],'yt');
 [X,Y]=meshgrid(x,y); 

%some ini
 n=0;
 ICOV = 0; 
 icov = 0; 

for i=1:length(fils)
 hi=ncread([idir fils(i).name],'HI'); 
 t=ncread([idir fils(i).name],'time');
 I=find(hi<=0); hi(I)=NaN; 
 hi=double(hi);
 for k=1:length(t)
    n=n+1;
    icov = squee(hi(:,:,k)); I=find(icov>0); icov(:)=0; icov(I)=1;
    ICOV=ICOV+icov;
 end
end

ICOV=ICOV./n.*12;

I=find(ICOV==0); ICOV(I)=-1.e34;
ncwrite('../dat/mod/processed/icecov1918.nc','ICOV',ICOV);
