- 积分
- 2634
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-6-6
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2018-1-26 22:55:53
|
显示全部楼层
begin
2
3 pf=addfile("/home/hlq/NCL/data/qingzang/pres.mon.mean.nc","r")
4 af=addfile("/home/hlq/NCL/data/qingzang/air.mon.mean.nc","r")
5 of=addfile("/home/hlq/NCL/data/qingzang/omega.mon.mean.nc","r")
6 uf=addfile("/home/hlq/NCL/data/qingzang/uwnd.mon.mean.nc","r")
7 vf=addfile("/home/hlq/NCL/data/qingzang/vwnd.mon.mean.nc","r")
8
9 pres =pf->pres
10 air =af->air
11 omega=of->omega
12 u =uf->uwnd
13 v =vf->vwnd
14 ;time =pf->time
15 ;date =cd_calendar(time,1)
16 level =af->level
17 ;level=of->level
18 ;print(level)
19 demo=air(0:199,:,:,:)
20
21 ;potem=new((/840,17,73,144/),float)
22 ;potem=0
23
24
25 print(level)
26
27 ;select the lowest level
28 ppres=new(dimsizes(pres),typeof(pres))
29 ip=new((/200,73,144/),integer)
30 do tt=0,199
31 do j=0,72
32 do i=0,143
33 l=0
34 do while(pres(tt,j,i).le.level(l))
35 l=l+1
36 end do
37 ppres(tt,j,i)=level(l)
38 ip(tt,j,i)=l
39 end do
40 end do
41 end do
42 ;
43 ;;print(ppres(0,:,:))
44 ;
45 ;compute potential temperature
46 potem=new(dimsizes(demo),typeof(demo))
47 do tt=0,199
48 do l=0,16
49 do j=0,72
50 do i=0,143
51 potem(tt,l,j,i)=air(tt,l,j,i)*((level(l)/1000)^0.286)
52 end do
53 end do
54 end do
55 end do
56
57 ;compute temperature advection
58 a=6371000
59 pi=3.41592
60 dy=278000
61 dlamda=278000
begin
2
3 pf=addfile("/home/hlq/NCL/data/qingzang/pres.mon.mean.nc","r")
4 af=addfile("/home/hlq/NCL/data/qingzang/air.mon.mean.nc","r")
5 of=addfile("/home/hlq/NCL/data/qingzang/omega.mon.mean.nc","r")
6 uf=addfile("/home/hlq/NCL/data/qingzang/uwnd.mon.mean.nc","r")
7 vf=addfile("/home/hlq/NCL/data/qingzang/vwnd.mon.mean.nc","r")
8
9 pres =pf->pres
10 air =af->air
11 omega=of->omega
12 u =uf->uwnd
13 v =vf->vwnd
14 ;time =pf->time
15 ;date =cd_calendar(time,1)
16 level =af->level
17 ;level=of->level
18 ;print(level)
19 demo=air(0:199,:,:,:)
20
21 ;potem=new((/840,17,73,144/),float)
22 ;potem=0
23
24
25 print(level)
26
27 ;select the lowest level
28 ppres=new(dimsizes(pres),typeof(pres))
29 ip=new((/200,73,144/),integer)
30 do tt=0,199
31 do j=0,72
32 do i=0,143
33 l=0
34 do while(pres(tt,j,i).le.level(l))
35 l=l+1
36 end do
37 ppres(tt,j,i)=level(l)
38 ip(tt,j,i)=l
39 end do
40 end do
41 end do
42 ;
43 ;;print(ppres(0,:,:))
44 ;
45 ;compute potential temperature
46 potem=new(dimsizes(demo),typeof(demo))
47 do tt=0,199
48 do l=0,16
49 do j=0,72
50 do i=0,143
51 potem(tt,l,j,i)=air(tt,l,j,i)*((level(l)/1000)^0.286)
52 end do
53 end do
54 end do
55 end do
56
57 ;compute temperature advection
58 a=6371000
59 pi=3.41592
60 dy=278000
61 dlamda=278000
phi=new((/73/),float)
63 dx=new((/73/),float)
64 do j=0,72
65 phi(j)=(-90+2.5*j)/180*pi
66 dx(j)=dlamda*cos(phi(j))
67 end do
68
69 temadv=new(dimsizes(demo),typeof(demo))
70 ;temadv=new((/200,17,73,144/),float)
71 do tt=0,199
72 do j=0,72
73 do i=0,143
74 ipp=ip(tt,j,i)
75 do l=ipp,16
76 if (j.eq.0) then
77 if (i.eq.0) then
78 temadv(tt,l,j,i)=u(tt,l,j,i)*(air(tt,l,j,1)-air(tt,l,j,142))/2/dx(j)+v(tt,l,j,i)*(air(tt,l,j+1,i)-air(tt,l,j,i))/dy-u(tt,l,j,i)/a*tan(phi(j))
79 else if(i.eq.143) then
80 temadv(tt,l,j,i)=temadv(tt,l,j,0)
81 else
82 temadv(tt,l,j,i)=u(tt,l,j,i)*(air(tt,l,j,i+1)-air(tt,l,j,i-1))/2/dx(j)+v(tt,l,j,i)*(air(tt,l,j+1,i)-air(tt,l,j,i))/dy-u(tt,l,j,i)/a*tan(phi(j))
83 end if
84 end if
85
86 else if(j.eq.72) then
87 if(i.eq.0) then
88 temadv(tt,l,j,i)=u(tt,l,j,i)*(air(tt,l,j,1)-air(tt,l,j,142))/dx(j)/2+v(tt,l,j,i)*(air(tt,l,j,i)-air(tt,l,j-1,i))/dy-u(tt,l,j,i)/a*tan(phi(j))
89 else if(i.eq.143) then
90 temadv(tt,l,j,i)=temadv(tt,l,j,0)
91 else
92 temadv(tt,l,j,i)=u(tt,l,j,i)*(air(tt,l,j,i+1)-air(tt,l,j,i-1))/2/dx(j)+v(tt,l,j,i)*(air(tt,l,j,i)-air(tt,l,j-1,i))/dy-u(tt,l,j,i)/a*tan(phi(j))
93 end if
94 end if
95
96 else
97 if(i.eq.0) then
98 temadv(tt,l,j,i)=u(tt,l,j,i)*(air(tt,l,j,i+1)-air(tt,l,j,142))/2/dx(j)+v(tt,l,j,i)*(air(tt,l,j+1,i)-air(tt,l,j-1,i))/2/dy-u(tt,l,j,i)/a*tan(phi(j))
99 else if(i.eq.143) then
100 temadv(tt,l,j,i)=temadv(tt,l,j,0)
101 else
102 temadv(tt,l,j,i)=u(tt,l,j,i)*(air(tt,l,j,i+1)-air(tt,l,j,i-1))/2/dx(j)+v(tt,l,j,i)*(air(tt,l,j+1,i)-air(tt,l,j-1,i))/2/dy-u(tt,l,j,i)/a*tan(phi(j))
103 end if
104 end if
105
106 end if
107 end if
108 end do
109 end do
110 end do
111 end do
112 end
|
|