diff --git a/src/Utility/Sflux_nc/readnc2.m b/src/Utility/Sflux_nc/readnc2.m index a8037037f..8ba053329 100644 --- a/src/Utility/Sflux_nc/readnc2.m +++ b/src/Utility/Sflux_nc/readnc2.m @@ -4,14 +4,19 @@ clear all; close all; scrsz = get(0,'ScreenSize'); %screen size +%4 parameters of position: left bottom_coord width height figure('Position',[1 scrsz(4)/2 scrsz(3)/2 scrsz(4)/2]); +fname='sflux.avi'; +delete(fname); +vidObj = VideoWriter(fname); +vidObj.FrameRate = 10; % Default 30; smaller ->slower +open(vidObj); + CB_bnd=load('CB_bnd.xy'); %load domain bnd %NARR files fill_in=1.e9; %junk value from nc files -delete('sflux.avi','f'); -avi_out = avifile('sflux.avi','FPS',5); for i=1:10 %stack # for nc files char=sprintf('%3.3d',i); filen=strcat('sflux_air_1.',char,'.nc'); @@ -91,11 +96,12 @@ % Stop here for testing % return; - frame = getframe(gcf); - avi_out=addframe(avi_out,frame); - clf; %clear figure + set(gcf,'nextplot','replacechildren'); + currFrame = getframe(gcf); + writeVideo(vidObj,currFrame); + clf; %clear figure to avoid overlay end %j clear base time_narr lon_narr lat_narr uwind_narr vwind_narr pres_narr airt_narr spfh_narr; end %for all nc files -avi_out=close(avi_out); +close(vidObj); diff --git a/src/Utility/Sflux_nc/readnc4.m b/src/Utility/Sflux_nc/readnc4.m index e87a93d74..e17a902ec 100644 --- a/src/Utility/Sflux_nc/readnc4.m +++ b/src/Utility/Sflux_nc/readnc4.m @@ -28,7 +28,6 @@ %Read dataset "1" fill_in=1.e9; %junk value from nc files -avi_out = avifile('out.avi'); for i=1:nfiles char=sprintf('%4.4d',i); filen=strcat(setnm1,char,'.nc'); @@ -121,10 +120,6 @@ % axis([xmin-0.1 xmax+0.1 ymin-0.1 ymax+0.1]); axis([-81 -72.6 33.32 40.45]); xlabel('Lon'); ylabel('Lat'); - - frame = getframe(gca); - avi_out=addframe(avi_out,frame); - clf; %clear figure end %plot end %j - time steps @@ -168,4 +163,3 @@ netcdf.putVar(ncid2,hid,spfh_out); netcdf.close(ncid2); end %for all nc files -avi_out=close(avi_out);