adding drawfire
[wrf-fire-matlab.git] / perimeter_new / read_ros_from_wrfout.m
blob79d60a61611a487a3f32eb6ccda9119ef799f8ac
1 function ros=read_ros_from_wrfout(wrfout,frame)
3 % for witch its 3100 2600
5 format long
7 fprintf('read_ros_from_wrfout %s frame %i\n',wrfout,frame);
8 datafile=sprintf('data_ros_%s_%i',wrfout,frame);
9 global saved_data  % 0 = read from original files and store in matlab files, 1=read saved data
11 if saved_data
12     disp(['loading from ',datafile])
13     w=load(datafile);
14     p=w.p;
15 else
16     p=nc2struct(wrfout,{'ITIMESTEP','F_ROS11','F_ROS12','F_ROS13','F_ROS21','F_ROS23','F_ROS31','F_ROS32','F_ROS33','Times'},{'DT'},frame);
17     disp(['storing to ',datafile])
18     save(datafile,'p')
19 end
21 fprintf('%s %gs from simulation start\n',char(p.times),p.dt*p.itimestep)
23 ros=zeros(size(p.f_ros11,1),size(p.f_ros11,2),3,3);
25 ros(:,:,1,1)=p.f_ros11;
27 ros(:,:,1,2)=p.f_ros12;
29 ros(:,:,1,3)=p.f_ros13;
31 ros(:,:,3,1)=p.f_ros31;
33 ros(:,:,3,2)=p.f_ros32;
35 ros(:,:,3,3)=p.f_ros33;
37 ros(:,:,2,1)=p.f_ros21;
39 ros(:,:,2,3)=p.f_ros23;
40 end
42 %function ros=read_all_data_from_wrfout(wrfout,time)
44 %format long
46 %f_ros11=ncread(wrfout,'F_ROS11');
48 %f_ros12=ncread(wrfout,'F_ROS12');
50 %f_ros13=ncread(wrfout,'F_ROS13');
52 %f_ros21=ncread(wrfout,'F_ROS21');
54 %f_ros23=ncread(wrfout,'F_ROS23');
56 %f_ros31=ncread(wrfout,'F_ROS31');
58 %f_ros32=ncread(wrfout,'F_ROS32');
60 %f_ros33=ncread(wrfout,'F_ROS33');
62 %ros=zeros(size(f_ros11,1),size(f_ros11,2),3,3,time);
63 %ros(:,:,1,1,:)=f_ros11(:,:,1:time);
65 %ros(:,:,1,2,:)=f_ros12(:,:,1:time);
67 %ros(:,:,1,3,:)=f_ros13(:,:,1:time);
69 %ros(:,:,3,1,:)=f_ros31(:,:,1:time);
71 %ros(:,:,3,2,:)=f_ros32(:,:,1:time);
73 %ros(:,:,3,3,:)=f_ros33(:,:,1:time);
75 %ros(:,:,2,1,:)=f_ros21(:,:,1:time);
77 %ros(:,:,2,3,:)=f_ros23(:,:,1:time);
78 %end