爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5611|回复: 0

[作图] 画图问题

[复制链接]
发表于 2016-8-22 21:12:28 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 1649518749 于 2016-8-24 16:36 编辑

楼主推荐http://bbs.06climate.com/forum.php?mod=viewthread&tid=47083


麻烦哪位大神帮我看看这脚本有没有问题,或者帮我测试一下也行。谢谢啦
按照这方法http://bbs.06climate.com/forum.php?mod=viewthread&tid=11797画出来的图叠加底图没效果。
ncl版本6.3.0

代码:
;   Example script to produce dbz plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.
;   November 2008

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"

begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/home/fc/datafile/wrfoutdata/wrfout_d01_2016-08-17_18:00:00","r")

  wks = gsn_open_wks("ps","dbz")
;  gsn_define_colormap(wks,colors)       ; Overwrite the standard color map

; Set some basic resources
  res = True
  res@MainTitle                   = "REAL-TIME WRF"
  pltres = True
  mpres = True

;;;;;;;;;;;;;;;;;set for map;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mpres@mpFillOn                = True
mpres@mpOutlineOn             = False  ; Use outlines from shapefile
res@cnFillDrawOrder           = "PreDraw"
mpres@mpDataBaseVersion       = "MediumRes"
mpres@mpDataSetName           = "Earth..4"
mpres@mpAreaMaskingOn         = True
mpres@mpMaskAreaSpecifiers    = (/"China:states","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
mpres@mpLandFillColor         = "white"
mpres@mpInlandWaterFillColor  = "white"
mpres@mpOceanFillColor        = "white"
mpres@mpOutlineBoundarySets   = "NoBoundaries"  ;NoBoundaries or National
mpres@mpNationalLineColor     = "Black"  
mpres@mpGeophysicalLineColor  = "Black"
mpres@mpNationalLineThicknessF    = 1.0
mpres@mpGeophysicalLineThicknessF = 1.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Which times and how many time steps are in the data set?
  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it = 1,ntimes-1              ; TIME LOOP

     print("Working on time: " + times(it))
     res@TimeLabel = times(it)   ; Set Valid time to use on plots


; First get the variables we will need        
; Both dbz and mdbz will be calculated using constant intercept parameters
; (as in early Reisner-2), with values of 8x10^6, 2x10^7, and 4x10^6 m^-4,
; for rain, snow, and graupel, respectively.

     mdbz = wrf_user_getvar(a,"mdbz",it)
     dbz = wrf_user_getvar(a,"dbz",it)

     opts = res                        
     opts@cnFillOn = True  
     opts@ContourParameters = (/ 5., 70., 5./)
     opts@cnFillColors = (/"white","white","cadetblue1","steelblue2","green","green4","yellow",\
                           "gold2", "orange","red","red3","red4","deeppink","magenta","gray0"/)
     contour = wrf_contour(a,wks,dbz(1,:,:),opts)     ; plot only lowest level
     plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)

     contour = wrf_contour(a,wks,mdbz,opts)
     plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
;>============================================================<
;                      add China map
;>------------------------------------------------------------<
cnres           = True
cnres@china     = True       ;draw china map or not
cnres@river     = True       ;draw changjiang&huanghe or not
cnres@province  = True       ;draw province boundary or not
cnres@nanhai    = True       ;draw nanhai or not
cnres@diqu      = False       ; draw diqujie or not

chinamap = add_china_map(wks,plot,cnres)

;>============================================================<
   end do        ; END OF TIME LOOP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end


dbz.png
mdbz.png
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表