- 积分
- 986
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-8-8
- 最后登录
- 1970-1-1
|
发表于 2016-10-12 16:27:35
|
显示全部楼层
不知道楼主解决没 这个是我的部分脚本 沿着特定两点剖面图
http://www.ncl.ucar.edu/Applications/transect.shtml 这个是官网参考例子
f0=addfile(dir+"4.grib2","r")
lat =f0->lat_0
lat=-lat ; coordinates
lon =f0->lon_0
p =f0->lv_ISBL0
mm=dimsizes(lat)
nn=dimsizes(lon)
fenzu=dir2+"fenzu.txt"
nrowfenzu=numAsciiRow(fenzu)
datafenzu=asciiread(fenzu, -1, "string")
ngr=7
gr= new(ngr, "integer")
gr=stringtointeger(str_get_field(datafenzu,2, " "))
itime=1
wks = gsn_open_wks("ps","sub_ty_poor")
i=0
f=addfile(dir+gr(i)+".grib2","r") ;time,level,lat,lon
u=f->u_P1_L100_GLL0(itime,:,:,:)
v=f->v_P1_L100_GLL0(itime,:,:,:)
scale = 1.e05
vor = u ; retain coordinates
vor = uv2vrG_Wrap(u,v) * scale
mn=(/8,mm,nn/)
t=new(mn,"float")
t(:,:,:)=vor(:,360:0,:)
lat@units="degrees_north"
lon@units="degrees_east"
lon@units="level"
t!2="lon"
t!1="lat"
t!0="p"
t&lat=lat
t&lon=lon
t&p=p
t@long_name = "vorticity"
t@units = "1.e05"
;************************************************
;;;;;;;;开始沿着副中心到台风中心差值;;;;;;;;;;;;;;;;;;;;;;;;;;
;************************************
leftlat = 25.3
rightlat = 22.5
leftlon = 118
rightlon = 124
npts = 13 ; number of points in resulting transect
dist = gc_latlon(leftlat,leftlon,rightlat,rightlon,npts,2)
points = ispan(0,npts-1,1)*1.0
;********************************
; interpolate data to great circle
;********************************
trans = linint2_points(t&lon,t&lat,t,True,dist@gclon,dist@gclat,2)
copy_VarAtts(t,trans) ; copy attributes
trans!0 = "p" ; create named dimension and assign
trans&p = t&p
res = True
res@gsnDraw = False
res@gsnFrame = False ; plot mods desired
res@cnFillOn = True
res = True ; plot mods desired
res@tmXBMode = "Explicit" ; explicitly label x-axis
res@tmXBValues = (/points(0),points(npts-1)/) ; points to label
; label values
res@tmXBLabels = (/leftlat +", "+leftlon,rightlat+", "+rightlon/)
; turn on color ; use full range of color map
res@lbLabelAutoStride = True ; nice label bar labels
res@cnLinesOn = False ; no contour lines
res@mpMinLonF =118
res@mpMaxLonF = 124
res@gsnAddCyclic = False
res@mpGridAndLimbOn =True
;res@tmYLMode ="Explicit"
;res@tmYLTickSpacingF=2
res@gsnLeftString="forecast_time="+itime*6+gr(i)
res@gsnRightString="lon ="+lontc(itime)
; res@cnFillPalette
res@cnSmoothingOn =True
res@cnSmoothingDistanceF =0.0005
res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res@cnMinLevelValF = -30 ; set min contour level
res@cnMaxLevelValF = 30 ; set max contour level
res@cnLevelSpacingF = 5 ; set contour spacing
res@cnFillPalette = "GMT_polar"
plot =gsn_csm_pres_hgt(wks,trans,res)
draw(wks)
frame(wks)
delete([/f,u,v,ftc,lattc,lontc/])
end
|
|