爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 9499|回复: 6

[作图] wrfout降水组图绘制???

[复制链接]
发表于 2019-3-18 17:00:25 | 显示全部楼层 |阅读模式

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

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

x
分别用EC和FNL初始场模拟出降水与真实的融水资料做对比画出组图,组图中不显示两个wrfout的降水,单独画两个wrfout降水也不行,求大神帮忙~~
以下是程序:
begin
nlat = 440
nlon = 700
ncrain = 308000
ntim = 25
r = new((/ntim,nlat,nlon/),"float")

;reading files         
     tim = (/ ... /)
lon = fspan(70.05,139.95,nlon)
lat = fspan(15.05,58.95,nlat)
lat!0 = "lat"
lat@long_name = "latitude"
lat@units = "degrees_north"
lon!0 = "lon"
lon@units = "degrees_east"
lon@long_name = "longitude"
do t = 0, ntim-1  
r(t,:,:) = fbindirread(tim(t),0,(/nlat,nlon/),"float")
end do
r!0 = "time"
r!1 = "lat"
r!2 = "lon"
r&time = ispan(1,25,1)
r&lat = lat
r&lon = lon
r@units = "mm/hour"
r@_FillValue = -999.00
res = True  
res@mpMinLatF  =  23.
res@mpMaxLatF  =  30.
res@mpMinLonF  =  104.
res@mpMaxLonF  =  120.

frain = dim_sum_n_Wrap(r,0)

;WRF    fnl
a = addfile("D:/HUANAN/summer/2010.05.31-06.02ok/fnl/wrfout_d01_2010-05-31_00_00_00","r")
   slp = wrf_user_getvar(a,"slp",-1)    ; slp
   wrf_smooth_2d( slp, 3 )            ; smooth slp
   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"
     times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
     ntimes = dimsizes(times)         ; number of times in the file

     do it = 2,ntimes-1,2             ; TIME LOOP - start at hour 6 as we are only interested in 6hourly tendencies
    print("Working on time: " + times(it) )
    res@TimeLabel = times(it)   ; Set Valid time to use on plots

    rain_exp_tend = rain_exp(it,:,:) - rain_exp(it-2,:,:)
    rain_con_tend = rain_con(it,:,:) - rain_con(it-2,:,:)
    rain_tot_tend = rain_tot(it,:,:) - rain_tot(it-2,:,:)
    rain_exp_tend@description = "Explicit Precipitation Tendency"
    rain_con_tend@description = "Param  Precipitation Tendency"
    rain_tot_tend@description = "Precipitation Tendency"

   ; Plotting options for Sea Level Pressure
     opts_psl = res         
     opts_psl@ContourParameters = (/ 900., 1100., 2. /)
     opts_psl@cnLineColor       = "Blue"
     opts_psl@cnInfoLabelOn     = False
     opts_psl@cnLineLabelFontHeightF = 0.01
     opts_psl@cnLineLabelPerimOn = False
     opts_psl@gsnContourLineThicknessesScale = 1.5
     
   
   end do

     pltres = True
  mpres = True
  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpNationalLineColor    = "Black"
  mpres@mpUSStateLineColor     = "Black"
  mpres@mpGridLineColor        = "Black"
  mpres@mpLimbLineColor        = "Black"
  mpres@mpPerimLineColor       = "Black"

;WRF EC
b = addfile("D:/HUANAN/summer/2010.05.31-06.02ok/EC/wrfout_d01_2010-05-31_00_00_00","r")
   slp1 = wrf_user_getvar(b,"slp",-1)    ; slp
   wrf_smooth_2d( slp1, 3 )            ; smooth slp
   rain_exp1 = wrf_user_getvar(b,"RAINNC",-1)
    rain_con1 = wrf_user_getvar(b,"RAINC",-1)
    rain_tot1 = rain_exp1 + rain_con1
    rain_tot1@description = "Total Precipitation"
     times1 = wrf_user_getvar(a,"times",-1)  ; get all times in the file
     ntimes1 = dimsizes(times)         ; number of times in the fille



res@gsnDraw             = False
res@gsnFrame            = False
res@gsnMaximize         = False
res@gsnSpreadColors     = True
res@mpAreaMaskingOn     = True

plot = new(3,graphic)
wks = gsn_open_wks("png","201001")
res@mpProjection        = "CylindricalEquidistant"
res@mpDataBaseVersion      = "Ncarg4_1"   ; 地图采用中等分辨率  
res@mpDataSetName = "Earth..4"

res@mpMaskAreaSpecifiers   = (/"China"/)
res@mpOutlineSpecifiers    = (/"China"/)     

res@mpLandFillColor = "white"

res@cnFillOn      = True
res@cnLinesOn     = False
res@cnInfoLabelOn = False
res@cnFillDrawOrder = "Predraw"

res@tmXTOn  = False
res@tmYROn  = False
res@gsnMajorLonSpacing = 10
res@tmXBOn =  True
res@tmXBMajorThicknessF  = 2.0         ;default 2
res@tmXBMajorLengthF  = 0.01         ;default 0.02  
res@tmYLOn =  True
res@tmYLMajorThicknessF  = 2.0         ;default 2
res@tmYLMajorLengthF  = 0.01         ;default 0.02
res@tmYLMinorOn = True
res@tmYLMinorThicknessF  = 1.0
res@tmYLMinorLengthF   =  0.005     ;default 0.01
res@tmYLMinorPerMajor = 4
res@gsnAddCyclic = False
res@gsnLeftString   = " "
res@gsnRightString  = " "


res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels             = (/ 50, 80, 110, 140, 170, 200, 250/)
res@cnFillColors = (/"White","DarkOliveGreen1", \
                                    "DarkOliveGreen3", \
                                    "Green","ForestGreen", \
                                    "Yellow","Orange","Red"/)
res@lbLabelBarOn = True
     opts_r = res                        
     opts_r@UnitLabel            = "mm"
     opts_r@cnInfoLabelOn        = False
     opts_r@cnConstFLabelOn      = False
     opts_r@cnFillOn             = True


contour_tot = wrf_contour(a,wks, rain_tot(2,:,:), opts_r)
contour_tot1 = wrf_contour(b,wks, rain_tot1(2,:,:), opts_r)

plot(0) = wrf_map_overlays(a,wks,(/contour_tot/),pltres,mpres)
plot(1) = wrf_map_overlays(b,wks,(/contour_tot1/),pltres,mpres)
plot(2) = gsn_csm_contour_map(wks,frain,res)
pres = True
pres@txString = "2016.6.14 00-15 00(fnl,EC,REAL)"

gsn_panel(wks,(/plot/),(/2,2/),pres

end



密码修改失败请联系微信:mofangbao
发表于 2019-3-19 08:39:31 | 显示全部楼层
plot = new(3,graphic)是不是要加这个
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2019-3-19 19:40:24 | 显示全部楼层
男紫汗 发表于 2019-3-19 08:39
plot = new(3,graphic)是不是要加这个

谢谢啦~但是之前加过也不行,不知道为啥
密码修改失败请联系微信:mofangbao
发表于 2022-3-12 13:26:29 | 显示全部楼层
请问楼主解决了吗~
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-3-12 21:16:11 | 显示全部楼层
解决啦,我先把wrfout都做了插值,和观测一个分辨率然后一起画的,不知道是不是因为wrfout本身数据的特殊性
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2022-4-3 09:20:51 | 显示全部楼层
     pltres=True
     pltres@PanelPlot = True
     。。。。。
     plot(i)=wrf_map_overlays(b, wks, (/contour/), pltres, mpres)
     gsn_panel(wks, plot, (/2,4/), pres)
  
     可以用这个试试
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2022-7-20 20:47:41 | 显示全部楼层
fafagnde 发表于 2022-4-3 09:20
pltres=True
     pltres@PanelPlot = True
     。。。。。

真的可!!!谢谢您。困扰我一天了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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