Friday, March 7, 2014

Make the movie matlab

Making movie in matlab is not hard. The following script was used to create the movie...

plotTEST = 1

if plotTEST

   
    for kk = 1:365
   
    %For plots
latlim =([35 46]);
lonlim =([-85 -69]);
   
%     fig_title = sprintf('MODIS AOD %i-%i-%i',file_mm,file_dd,file_yy);
    h1 = figure(1)
%     orient landscape;
    ax = worldmap(latlim, lonlim);
    states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
    geoshow(ax, states, 'FaceColor', [1 1 1]);
    surfacem(box_lat,box_lon,saveAODboxIDW(:,:,kk));
    h1=gca;
    set(h1,'CLimMode','Manual','CLim',[0, 1]);
    h2=colorbar('vert','FontSize',12);
    title(['2006 Day: ', num2str(kk)],'FontSize',14);
   
   
    M(kk) = getframe(h1);
   
   
     h2 = figure(2)
%     orient landscape;
    ax = worldmap(latlim, lonlim);
    states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
    geoshow(ax, states, 'FaceColor', [1 1 1]);
    surfacem(box_lat,box_lon,saveAODday(:,:,kk));
    h1=gca;
    set(h1,'CLimMode','Manual','CLim',[0, 1]);
    h2=colorbar('vert','FontSize',12);
    title(['2006 Day: ', num2str(kk)],'FontSize',14);
   
   
    MM(kk) = getframe(h2);
   
   
   
%     load lons
%     load lats
%     geoshow(lats,lons,'DisplayType','Line', 'Color', [0 0 0])
    end
 
    % Output the movie as an avi file
movie2avi(M,'AOD_IDWMovie07.avi', 'compression','None', 'fps',2);

movie2avi(MM,'AOD_Movie07.avi', 'compression','None', 'fps',2);


   
end

No comments: