爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5797|回复: 6

跪求ncl画wrfout中降雨,风速等的脚本

[复制链接]

新浪微博达人勋

发表于 2019-4-3 09:37:56 | 显示全部楼层 |阅读模式

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

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

x
昨天随便百度了一个脚本就用了 ,但是很奇怪为什么这个输出的降雨图里没有颜色。所以想求提取wrfout变量的ncl脚本!!!
wrf_total_rain.png

以下是我昨天下载的脚本:
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("/public/home/czhang/app/WRF/3.8.1/WRFV3-MPI/run/wrfout_d01_2019-02-19_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


听很多博主说官网上有脚本 但我也没有找到,跪求分享~!!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-4-3 09:42:42 | 显示全部楼层
contour_tot = wrf_contour(a,wks,rain_tot(0,:,:),res)  你觉得初始时刻会有降水吗
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-4-3 10:03:25 | 显示全部楼层
freekiller 发表于 2019-4-3 09:42
contour_tot = wrf_contour(a,wks,rain_tot(0,:,:),res)  你觉得初始时刻会有降水吗

谢谢大神回答,我是刚学习wrf和ncl的小白,不是很懂这里边每一个参数代表什么意思。
contour_tot这个是什么意思呢 是设置初始时间的吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-4-3 10:40:27 | 显示全部楼层
freekiller 发表于 2019-4-3 09:42
contour_tot = wrf_contour(a,wks,rain_tot(0,:,:),res)  你觉得初始时刻会有降水吗

; Make a list of all files we are interested in
  DATADir = "/public/home/czhang/app/WRF/3.8.1/WRFV3-MPI/run/"
  FILES = systemfunc (" ls -1 " + DATADir + "wrfout* ")
  numFILES = dimsizes(FILES)
  print("numFILES = " + numFILES)
  print(FILES)
  print (" ")


还有这部分的脚本我也不是很懂
运行以后他提示我:
fatal:ListSelect: Index out of range
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 89 in file /public/home/czhang/ZJY/WRF/wrf_rain/wrf_Precip_multi_files.ncl

这是为什么呀?求大神解释!!!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-4-19 10:07:46 | 显示全部楼层
用个循环,contour_tot = wrf_contour(a,wks,rain_tot(0,:,:),res),把0换成循环变量就好了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-4-19 10:12:27 | 显示全部楼层
用个循环,contour_tot = wrf_contour(a,wks,rain_tot(0,:,:),res),把0换成循环变量就好了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-4-25 13:18:59 | 显示全部楼层
能不能问下这个关于WRF例子网址在哪
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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