/
wrfout2frame3d.m
48 lines (41 loc) · 1.42 KB
/
wrfout2frame3d.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% function wrfout2frame3d(file,steps)
disp('1. file=''wrfout file''')
disp('2. steps=[1:20] % time steps to display')
disp('3. wrfout2frame3d')
fxlong =ncread(file,'FXLONG');
fxlat =ncread(file,'FXLAT');
xlong =ncread(file,'XLONG');
xlat =ncread(file,'XLAT');
zsf =ncread(file,'ZSF');
fgrnhfx=ncread(file,'FGRNHFX');
uf =ncread(file,'UF');
vf =ncread(file,'VF');
u =ncread(file,'U');
v =ncread(file,'V');
w =ncread(file,'W');
ph =ncread(file,'PH');
phb =ncread(file,'PHB');
hgt =ncread(file,'HGT');
itimestep=ncread(file,'ITIMESTEP');
% note the variables are read here without the WRF permutation of dimensions
amin=[15,15,1]; % the atm grid part to show
amax=[30,30,2];
amin=[10,10,1]; % the atm grid part to show
amax=[30,30,1];
qstep=[20,20]; % quiver step for wind on the surface fire grid
astep=[2,2,1]; % quiver step for wind on the atmosphere grid
qs=1e-3; % scaling for quiver arrows
swind=0; % do not display surface wind
%-------------------------------------------------
a=avifile('fire.avi');
for k=steps,
frame3d(swind,amin,amax,astep,qstep,qs,...
fxlong(:,:,k),fxlat(:,:,k),xlong(:,:,k),xlat(:,:,k),...
zsf(:,:,k),fgrnhfx(:,:,k),uf(:,:,k),vf(:,:,k),...
u(:,:,:,k),v(:,:,:,k),w(:,:,:,k),...
ph(:,:,:,k),phb(:,:,:,k),hgt(:,:,k))
title(['Timestep ',num2str(itimestep(k))])
F=getframe(gcf);
a=addframe(a,F);
end
a=close(a);