加载中…
个人资料
yangcan69
yangcan69
  • 博客等级:
  • 博客积分:0
  • 博客访问:10,372
  • 关注人气:114
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

ncl降水脚本(自)

(2014-02-08 15:03:42)
标签:

文化

分类: NCL
ncl for rain

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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;
;the WRF ARF input file
 
 a = addfile("./wrfout_d02_2012-07-22_00:00:00.nc","r")
 rainc=a->RAINC
 printVarSummary(rainc)
 rainnc=a->RAINNC
 printVarSummary(rainnc)
 nt1=dimsizes(rainc(:,0,0))
 nt2=dimsizes(rainnc(:,0,0))
 
;calculate the total precipitation
 rain_exp=wrf_user_getvar(a,"RAINNC",-1)
 rain_con=wrf_user_getvar(a,"RAINC",-1)
 rain_tot=(rain_exp+rain_con)
 rain_tot@description="Total Precipitation (mm)"

; create a window
 wks = gsn_open_wks("png","wrf_total_rain")

;define colormap
cmap = (/  (/255, 255,  255/), \
           (/  0,   0,    0/), \
           (/255, 255,  255/), \
           (/248, 248,  255/), \
           (/191, 239,  255/), \
           (/178, 223,  238/), \
           (/187, 255,  255/), \
           (/187, 255,  255/), \
           (/174, 238,  238/), \
           (/152, 245,  255/), \
           (/122, 197,  205/), \
           (/118,238,0/),\
           (/238,230,133/),\
           (/238, 154,   0/), \
           (/205, 133,   0/), \
           (/238,  92, 66/), \
           (/255,  69, 0/),\
           (/238,  64, 0/), \
           (/ 205, 55, 0/) /) / 255.


gsn_define_colormap(wks,cmap)
; gsn_define_colormap(wks,"Rainbow") 
;make some basic resources

 res = True
 res@gsnFrame = False
 res@MainTitle = "Total Rain"
 res@gsnDraw = False
 res@cnLevelSelectionMode = "ExplicitLevels"
 res@cnFillOn = True
 res@cnLinesOn = False
 res@lbLabelAutoStride = True
 res@cnFillDrawOrder = "PreDraw"
 res@cnInfoLabelOn = False
; res@cnLevels = (/0,30,60,90,120,150,180,210/)
; res@cnFillColors = (/"white","whitesmoke","turquoise1","turquoise2","turquoise3","greenyellow","green","green3","firebrick1","firebrick"/) 
;res@cnConstFlabelOn = False
 

 ;res@mpFillOn = True
 ;res@cnFillAreaSpecifiers = (/"Land"/)
 ;res@mpAreamaskingOn = True
 ;res@mpMaskAreaSpecifiers = "Water"
 
 contour_tot = wrf_contour(a,wks,rain_tot(0,:,:),res)
 
;draw administrative region

 mpres = True
 mpres@gsnFrame = False
 mpres@mpGridLineDashPattern  = 2                  ; lat/lon lines dashed
 mpres@mpGeophysicalLineColor = "Black"
 mpres@mpGeophysicalLineThicknessF = 2
 mpres@mpNationalLineColor    = "Black"
 mpres@mpNationalLineThicknessF    = 2
 mpres@mpGridLineColor        = "Black"
 mpres@mpGridLineThicknessF        = 2
 mpres@mpLimbLineColor        = "Black"
 mpres@mpLimbLineThicknessF        = 2
 mpres@mpPerimLineColor       = "Black"
 mpres@mpPerimLineThicknessF       = 2
 mpres@mpUSStateLineColor          = "Black"
 mpres@mpUSStateLineThicknessF     = 2
 mpres@mpDataBaseVersion           = "MediumRes"
 mpres@mpDataSetName               = "Earth..4"
 mpres@mpOutlineSpecifiers         = (/"China:states"/)
 
 pltres = True
 pltres@gsnFrame = False
 plot = wrf_map_overlays(a,wks,(/contour_tot/),pltres,mpres)
;before make text, you should remember make pltres@gsnFrame mpres@gsnFrame=False
 tres = True
 tres@gsnFrame = False
 tres@txFontHeightF = 0.01
 plat = (/39.9,40.0,39.10/)
 plon = (/116.3,115.0,117.10/)
 province = (/"BJ","HB","TJ"/)
 do i=0,2
 gsn_text(wks,plot,province(i),plon(i),plat(i),tres)
 end do
 frame(wks) 
 end



 ncl降水脚本(自)

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有