year=2001:2014;
lat=-89.5:1:89.5;
lon=-179.5:1:179.5;
load ~/Aerosol_Variaiton/IRUN/AOD/ncfile/AOD_MODIS.mat

AOD=mean(AOD_ANN,3);

AOD_LAT=zeros(180,1);
AOD_LAT(:)=mean(AOD,1);

AOD_LAT(isnan(AOD_LAT))=-999;


save('AOD_lat.mat','AOD_LAT')

nccreate('AOD_lat.nc','lat','Dimensions',{'lat',96},'Format','classic')
ncwrite('AOD_lat.nc','lat', lat)
ncwriteatt('AOD_lat.nc','lat','units','degrees_north')
ncwriteatt('AOD_lat.nc','lat','long_name','Latitude')
nccreate('AOD_lat.nc','lon','Dimensions',{'lon',144},'Format','classic')
ncwrite('AOD_lat.nc','lon', lon)
ncwriteatt('AOD_lat.nc','lon','units','degrees_east')
ncwriteatt('AOD_lat.nc','lon','long_name','Longitude')
nccreate('AOD_lat.nc','AOD_LAT','Dimensions',{'lat',96},'Format','classic')
ncwrite('AOD_lat.nc','AOD_LAT', AOD_LAT)
ncdisp('AOD_lat.nc')
