- 积分
- 1502
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2015-8-21 08:33:00
|
显示全部楼层
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("/public/home/huanglei/wrfdata/wrfout_d03_2015-05-01_12:00:00.nc","r")
ij = wrf_user_ll_to_ij(a, 108.58,34.26,True)
print("lon location is: " +ij(0))
print("lat location is: " + ij(1))
; First get the variables we will need
t3=new((/31,24/),float,"No_FillValue")
rain2=new((/31,24/),float,"No_FillValue")
u_2=new((/31,24/),float,"No_FillValue")
v_2=new((/31,24/),float,"No_FillValue")
u10_2=new((/31,24/),float,"No_FillValue")
v10_2=new((/31,24/),float,"No_FillValue")
rh2=new((/31,24/),float,"No_FillValue")
times2=new((/31,24/),string,"No_FillValue")
;rain_tot=new(24,float,"No_FillValue")
filename1=systemfunc("ls /public/home/huanglei/wrfdata/wrfout_d03_2015-05*.nc")
fin1=addfiles(filename1,"r")
do i=0,30
t2=fin1->T2(0:23,ij(0), ij(1))
rain_exp=fin1->RAINNC(0:23,ij(0), ij(1))
rain_con=fin1->RAINC(0:23,ij(0), ij(1))
rh0= wrf_user_getvar(fin1,"rh",-1)
u_1=fin1->U(0:23,0,ij(0), ij(1))
v_1=fin1->V(0:23,0,ij(0), ij(1))
u10_1=fin1->U10(0:23,ij(0), ij(1))
v10_1=fin1->V10(0:23,ij(0), ij(1))
times = wrf_user_getvar(fin1,"times",-1)
tt2= t2-273.15
tt2@units = "c"
rain_tot= rain_exp + rain_con
rh1=rh0(0:23,0,ij(0), ij(1))
times1=times(0:23)
; printVarSummary(times1)
;print(fin1[1]->T2(0:23,ij(0), ij(1)))
; exit
t3 (i,:)= tt2
rain2(i,:)= rain_tot
u_2 (i,:)= u_1
v_2(i,:)= v_1
u10_2 (i,:)= u10_1
v10_2 (i,:)= v10_1
rh2 (i,:)= rh1
times2(i,:)= times1
end do
; print(time)
t=ndtooned(t3)
rain=ndtooned(rain2)
u=ndtooned(u_2)
v=ndtooned(v_2)
u10=ndtooned(u10_2)
v10=ndtooned(v10_2)
rh=ndtooned(rh2)
time=ndtooned(times2)
t_d=t(0:724)
rain_d=rain(0:724)
u_d=u(0:724)
v_d=v(0:724)
u10_d=u10(0:724)
v10_d=v10(0:724)
rh_d=rh(0:724)
time_d=time(0:724)
; print(t(0:47))
;printVarSummary(rh)
;printVarSummary(u)
;printVarSummary(v)
; printVarSummary(u10)
;printVarSummary(v10)
;printVarSummary(time)
;printVarSummary(rain)
; print(time)
; print(time)
; exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; We generate plots, but what kind do we prefer?
type = "pdf"
wks = gsn_open_wks(type,"plt_temp_xy")
; Set some basic resources
res = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ascii_filename = "/public/home/huanglei/data/ob.txt"
seismic = asciiread(ascii_filename,(/725,6/),"float")
time_o= seismic(:,1) ; Column 1 of file contains X values.
p_o = seismic(:,2) ; Column 2 of file contains Y values.
t2_o= seismic(:,3) ; Column 3 of file contains Z values.
;rh_o= seismic(:,4)
wdir_1= seismic(:,4)
wspd_1 = seismic(:,5)
;wdir10= seismic(:,7)
; wspd10= seismic(:,8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
t2_oo=t2_o*0.1
p_oo=p_o *0.1
wspd=wspd_1*0.1
rad = 4.0*atan(1.0)/180.
u_o = -wspd*sin(rad*wdir_1)
v_o = -wspd*cos(rad*wdir_1)
; u10_o = -wspd10*sin(rad*wdir)
; v10_o = -wspd10*cos(rad*wdir)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
data=new((/2,725/),float)
data(0,:)=t2_oo(:)
data(1,:)=t_d(:)
print(data)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res@xyLineThicknesses = (/2.0,2.0/) ; make 2nd lines thicker
res@gsnYRefLine = (/-2.0,2.0/)
res@gsnYRefLineThicknesses=(/1.0,1.0/)
;res@xyLineColors = (/"black","black"/) ; change line color
res@pmLegendDisplayMode = "always" ; turn on legend
res@pmLegendSide = "Top" ; Change location of
res@pmLegendParallelPosF = .75 ; move units right
res@pmLegendOrthogonalPosF = -0.25 ; more neg = down
res@gsnLeftString ="(a)Temprature"
res@pmLegendWidthF = 0.10 ; Change width and
res@pmLegendHeightF = 0.10 ; height of legend.
res@lgLabelFontHeightF = 0.02 ; change font height
res@lgPerimOn = False
res@xyExplicitLegendLabels = (/"UB","UF"/)
;res@lgOrientation ="horizontal"
; res@trXMinF =1979
; res@trXMaxF =2011
res@gsnDraw =False
res@gsnFrame = False
plot = gsn_csm_xy(wks,time,data,res)
end
|
|