! cp -f in.nc out.nc 
FNAME='out.nc';

% read input
sst=ncread(FNAME,'SST');
sic=ncread(FNAME,'ICEFRAC'); 

% extrapolate over land
sic(sst==0)=nan;
sst(sst==0)=nan;
nrec=size(sst,3);
for rec=1:nrec
  sst(:,:,rec)=extrap(sst(:,:,rec))-273.15; % convert to degC 
  sic(:,:,rec)=extrap(sic(:,:,rec));  
end 

% adjust fields 
sstpseudo=mon2pseudo(sst,1,true);
sicpseudo=mon2pseudo(sic,1,true);

% write adjusted fields
ncwrite(FNAME,'SST',sstpseudo);
ncwrite(FNAME,'ICEFRAC',sicpseudo); 

% add time information
add_timeinfo('out.nc',1850,2000,1,2000,12); 
