%function make_mat(var)
var = 'shf'

direc = '/data/mgoes/OAFLUX/TROPFLUX/www.incois.gov.in/tropflux_datasets/data/monthly/';
suffix = [var,'/',var,'_tropflux_1m_'];

yvec=1979:2015;
nt = length(yvec);
varf = upper(var);
TIME=[];
eval([varf,'=[];']);
count = 0;
for ii=1:nt
    count = count +1
    %ii
    filename = sprintf('%s%s%i%s',direc,suffix,yvec(ii),'.nc');
    ncload(filename);
   % func = [varf,'(end+1:end+12,:,:)=',var,';'];ii
    func = [varf,'(count:count+11,:,:)=',var,';'];
    TIME(count:count+11,:,:)=time;
    %TIME(end+1:end+12) = time;
    eval(func);
    count = count+12;
end
%lon = longitude;lat=latitude;
longitude(longitude>180) = longitude(longitude>180)-360;
ilat = find(latitude>-30 & latitude<-5);
ilon = find(longitude>-50 & longitude<20);
lon = longitude(ilon);lat=latitude(ilat);

eval([varf,'=',varf,'(:,ilat,ilon);'])
eval([varf,'(',varf,'>1e10)=nan;']);
  
save([varf,'.mat'],varf,'TIME','lon','lat')
