Skip to content

Commit

Permalink
update mlab scripts for newer version of mlab
Browse files Browse the repository at this point in the history
  • Loading branch information
josephzhang8 committed Oct 26, 2024
1 parent 2b1bfac commit d40008f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 12 additions & 6 deletions src/Utility/Sflux_nc/readnc2.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
6 changes: 0 additions & 6 deletions src/Utility/Sflux_nc/readnc4.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -168,4 +163,3 @@
netcdf.putVar(ncid2,hid,spfh_out);
netcdf.close(ncid2);
end %for all nc files
avi_out=close(avi_out);

0 comments on commit d40008f

Please sign in to comment.