FpOutput: calculate_grid_area_eff.m

File calculate_grid_area_eff.m, 1.0 KB (added by sureshraja1, 8 years ago)
Line 
1function [ar, vo] = calculate_grid_area_eff(header)
2
3% calculates volumn and area for FLEXPART OUTGRID adapted from outgrid_init.f
4% June 07 Sabine Eckhardt
5%
6
7r_earth=6.371e6;
8pi180=pi/180;
9ar=zeros(header.numygrid,header.numxgrid);
10vo=zeros(header.numygrid,header.numxgrid,header.numzgrid);
11
12hzone=zeros(length(header.latp),1);
13ylatp=header.latp+.5*header.dyout;
14ylatm=header.latp-.5*header.dyout;
15ind=find(ylatm<0 & ylatp>0);
16hzone(ind)=header.dyout*r_earth*pi180;
17cosfactp=cos(ylatp*pi180)*r_earth;
18cosfactm=cos(ylatm*pi180)*r_earth;
19ind=find(cosfactp<cosfactm);
20
21hzone(ind)=(r_earth.^2-cosfactp(ind).^2).^.5-(r_earth.^2-cosfactm(ind).^2).^.5;
22ind=find(cosfactp>=cosfactm);
23hzone(ind)=(r_earth.^2-cosfactm(ind).^2).^.5-(r_earth.^2-cosfactp(ind).^2).^.5;
24gridarea=2.*pi*r_earth*hzone*header.dxout/360;
25
26for ix=1:header.numxgrid
27    ar(:,ix)=gridarea;
28end
29
30vo(:,:,1)=ar*header.outheight(1);     
31for kz=2:header.numzgrid
32   vo(:,:,kz)=ar*(header.outheight(kz)-header.outheight(kz-1));
33end  %kz
34
35ar=ar';
hosted by ZAMG