在分析一些垂直環(huán)流形勢的時候經(jīng)常會需要分析剖面的環(huán)流情況,一般有兩種資料萎攒,一是wrfout這種曲面網(wǎng)格瓤帚,二是標準網(wǎng)格的再分析資料。兩種用到的差值函數(shù)不太一樣瓶珊,腳本過長,這里只記錄一些重要的步驟耸彪。
1. wrfout等曲面網(wǎng)格
原理是給定中心點及剖面的旋轉(zhuǎn)角度伞芹,然后將變量往這個面上插值。
?DATADir_ctrl=(/"/student/sunxiaoyun/wrfout_case/201901-ctrl/"/)
?a = addfile(DATADir_ctrl + "wrfout_d02_2019-01-08_02:00:00.nc", "r")
; 設(shè)置中心點和旋轉(zhuǎn)角度
?mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file
?nd = dimsizes(mdims)
?plane = new(2,float)
?plane = (/ mdims(nd-1)/2, mdims(nd-2)/2/)? ? ; pivot point is center of domain (x,y)??
?angle = 25.
;讀取需要分析的變量畫圖
? ? pm_ctrl? = wrf_user_getvar(a,"PM2_5_DRY",0) ;三維的
? ? pm_ctrl_plane = wrf_user_intrp3d(pm_ctrl,z,"v",plane,angle,False)
? ? pblh_ctrl = wrf_user_getvar(a, "PBLH",0) ;二維的
? ? pblh_plane_ctrl = wrf_user_intrp2d(pblh_ctrl,plane,angle,False)
;畫圖函數(shù)
contour_pm= wrf_contour(a,wks,pm_plane(0:zmax_pos,lat_min:lat_max),opts_cn)
contour_vc= wrf_vector(a, wks, v_plane(0:zmax_pos,lat_min:lat_max), w_plane(0:zmax_pos,lat_min:lat_max)*30, opts_vc)
plot = wrf_overlays(a,wks,(/contour_pm,contour_vc/),altres)? ?
2. 標準網(wǎng)格的再分析資料
原理是給出起始點經(jīng)緯度蝉娜,線性插值出這條線上的經(jīng)緯度唱较,然后再將再分析網(wǎng)格資料插值到這條線上的點里。
datadir = "/public/home/sunxiaoyun/datadir/ERA5/vars4CEC/"
? f_t = addfile(datadir+"T-type1.nc","r")?
? t? ?= short2flt(f_t->t(:,:,::-1,:)) ;注意后面插值函數(shù)需要經(jīng)緯度是線性增加的召川,我這兒原始資料的緯度是遞減的南缓,進行了倒置
? level = f_t->level
? xlat =? f_t->latitude(::-1)
? xlon =? f_t->longitude
; calculate great circle along transect
? leftlat? =? 27;45
? rightlat =? 34;30
? leftlon? =? 112;76
? rightlon =? 116;95
? npts? ? =? 30? ? ? ? ? ? ? ? ; number of points in resulting transect
? dist? ? = gc_latlon(leftlat,leftlon,rightlat,rightlon,npts,2)
? lat_new = dist@gclat
? lon_new = dist@gclon
? points? = ispan(0,npts-1,1)*1.0
; interpolate data to great circle
? t_cross? = linint2_points_Wrap(xlon,xlat,t_a,True,dist@gclon,dist@gclat,0)
? t_cross!0? ? = "level"
? t_cross&level = level? ? ? ?
;畫圖就是正常用gsn_csm系列函數(shù)畫圖
plot = gsn_csm_pres_hgt_vector(wks,t_cross,v_cross,w_cross,res)