爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
楼主: 风之牧语

ncl 去除边界

[复制链接]

新浪微博达人勋

 楼主| 发表于 2014-7-30 16:27:54 | 显示全部楼层
longlivehj 发表于 2014-7-30 15:28
http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml
参考Example 2改一下,看 ...

也没有搞定啊!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 16:33:12 来自手机 | 显示全部楼层
风之牧语 发表于 2014-7-30 16:27
也没有搞定啊!

脚本改成什么样子了,能发上来看看么?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 16:40:15 | 显示全部楼层
风之牧语 发表于 2014-7-30 15:10
我的意思是我的数据就是兰伯特投影了,我只是用这个数据来画图,但是我想设置经纬度范围,应该怎么弄啊?

1.jpg
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 16:51:01 来自手机 | 显示全部楼层
andrewsoong 发表于 2014-7-30 16:40

我刚用wrf出来的数据试了下,也可以自由切换区域,嘿嘿!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 16:53:43 | 显示全部楼层
longlivehj 发表于 2014-7-30 16:51
我刚用wrf出来的数据试了下,也可以自由切换区域,嘿嘿!

是的~~~还是你这个方法好~~~多谢~~~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 16:54:02 来自手机 | 显示全部楼层
风之牧语 发表于 2014-7-30 16:27
也没有搞定啊!

实在不行就不用wrf的绘图、叠加函数了,用gsn_csm_*!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 16:56:42 | 显示全部楼层

我搞定了,你把你的脚本贴上来吧~~~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-7-30 17:25:26 | 显示全部楼层
andrewsoong 发表于 2014-7-30 16:56
我搞定了,你把你的脚本贴上来吧~~~

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/cnmap/cnmap.ncl"

begin

   files=systemfunc("ls -1 wrfout_d01_2013-08*")
   f=addfiles(files,"r")
   ListSetType(f,"cat")
   rainc=wrf_user_getvar(f[:],"RAINC",-1)
   rainnc=wrf_user_getvar(f[:],"RAINNC",-1)
   i_rainc=wrf_user_getvar(f[:],"I_RAINC",-1)
   i_rainnc=wrf_user_getvar(f[:],"I_RAINNC",-1)
   ;xlat=wrf_user_getvar(f[:],"XLONG",-1)
  ; print(xlat(0,0,:))
   times=wrf_user_getvar(f[:],"times",-1) ; get all times in the file
   ntimes = dimsizes(times)         ; number of times in the file
   rain=rainc+100.0*i_rainc+rainnc+10*i_rainnc
   ;result_rain=rain(1,:,:)-rain(0,:,:)
   ;t_rain=dim_avg_n_Wrap(rain,0)
   result_rain1 = dim_avg_n_Wrap(rain(1 : , :, :) - rain(0 : ntimes - 2, :, :), 0)
   result_rain=result_rain1*4
   ;result_rain=dim_sum_n_Wrap(rain,0)
   ;wrf_smooth_2d( result_rain, 3 )       
   wks = gsn_open_wks("png","wrfout_avg_rain_August")
   colors = (/"white","black", "Snow"    \
               ,"PaleTurquoise","PaleGreen","SeaGreen3" ,"Yellow"  \
              ,"Orange","HotPink","Red","Violet", "Purple", "Brown"/)
       ;gsn_define_colormap(wks,"wh-bl-gr-ye-re")

   gsn_define_colormap(wks, colors);rain,dir,maxdir,spd,vis
   ; Set some basic resources
   res = True
   res@MainTitle                   = "REAL-TIME WRF"
   pltres = True
   mpres = True                     
   res@cnFillOn=True
   res@cnLineColor = "Blue"
   ;res@gsnDraw  = False               ; Don't draw plots
   ;res@gsnFrame = False               ; Don't advance frames
   ;res@cnFillColors = 2       ; 起始于color index 14
   res@cnLinesOn            = False  ; 关闭等值线线条                  
   res@FieldTitle = "RAIN(mm) in August"
   res@cnLevelSelectionMode = "ExplicitLevels"
   ;res@cnLevels             = (/20,40,60,80,100,120,140,160,180,200,220/) ; rain
   res@cnLevels             = (/0.4,4,8,12,16,20,30,40,60,80/) ; rain
   ;contour_rain = wrf_contour(f[0],wks,result_rain,res)
   contour_rain=wrf_contour(f[0],wks,result_rain,res)
   pltres@LatLonOverlay = True
   ;mpres@gsnFrame      = False
   ;mpres@gsnDraw       = False
   mpres@mpGeophysicalLineColor      = "Black"
   mpres@mpNationalLineColor         = "Black"
   mpres@mpUSStateLineColor          = "Black"
   mpres@mpGridLineColor             = "White"
   mpres@mpLimbLineColor             = "White"
   mpres@mpPerimLineColor            = "Black"
   ;mpres@mpGeophysicalLineThicknessF = 2.0
   ;mpres@mpGridLineThicknessF        = 2.0
   mpres@mpLimbLineThicknessF        = 2.0
   mpres@mpNationalLineThicknessF    = 2.0
   mpres@mpUSStateLineThicknessF     = 2.0
   mpres@mpDataBaseVersion="MediumRes"
   mpres@mpDataSetName="Earth..4"
   mpres@mpOutlineOn          = True
   mpres@mpFillOn=True
   mpres@mpOutlineSpecifiers=(/"China:states","Taiwan"/)
   mpres@mpOutlineBoundarySets ="NoBoundaries"
   mpres@mpDataBaseVersion="MediumRes"
   mpres@mpDataSetName="Earth..4"
   mpres@mpOutlineSpecifiers=(/"China:states","Taiwan"/)
   mpres@mpAreaMaskingOn         = True
   mpres@mpMaskAreaSpecifiers    = (/"China","Taiwan"/)   ;China:state
;   mpres@mpFillDrawOrder         = "PreDraw"
   mpres@mpOceanFillColor="White"
   mpres@mpLandFillColor="White"
   mpres@mpInlandWaterFillColor="White"
   plot= wrf_map_overlays(f[0],wks,(/contour_rain/),pltres,mpres)
; 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)
;>============================================================<

;draw(plot)
;frame(wks)
end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-7-30 17:27:09 | 显示全部楼层
longlivehj 发表于 2014-7-30 16:54
实在不行就不用wrf的绘图、叠加函数了,用gsn_csm_*!

gsn_csm我尝试过,不过画出来的图也是错位
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 17:31:03 | 显示全部楼层
风之牧语 发表于 2014-7-30 17:25
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/c ...

@longlivehj  你看看~
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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