爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5653|回复: 3

ncl画wrf转出来的数据只有一天的图

[复制链接]
发表于 2017-8-27 14:02:55 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 空城不空 于 2017-8-27 14:02 编辑

我所处理的数据是三天的,然后用官网上现成的脚本来画图( http://www2.mmm.ucar.edu/wrf/OnL ... ECIP/wrf_Precip.htm

画出来的图只有第一天的,我用这个脚本去画WRF官网转下来的数据也是只有一天的。
(0)        Working on time: 2017-07-12_00:00:00
(0)        Working on time: 2017-07-12_06:00:00
(0)        Working on time: 2017-07-12_12:00:00
我不太清楚哪里还需要更改。。。
下面这个是ncl脚本
  1. ;   Example script to produce plots for a WRF real-data run,
  2. ;   with the ARW coordinate dynamics option.

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

  5. begin
  6. ;
  7. ; The WRF ARW input file.  
  8. ; This needs to have a ".nc" appended, so just do it.
  9.   a = addfile("wrfout_d01_2017-07-12_00_00_00","r")


  10. ; We generate plots, but what kind do we prefer?
  11. ; type = "x11"
  12.   type = "pdf"
  13. ; type = "ps"
  14. ; type = "ncgm"
  15.   wks = gsn_open_wks(type,"plt_Precip")


  16. ; Set some basic resources
  17.   res = True
  18.   res@MainTitle = "Heavy Rainfall"

  19.   pltres = True
  20.   mpres = True
  21.   mpres@mpGeophysicalLineColor = "Black"
  22.   mpres@mpNationalLineColor    = "Black"
  23.   mpres@mpUSStateLineColor     = "Black"
  24.   mpres@mpGridLineColor        = "Black"
  25.   mpres@mpLimbLineColor        = "Black"
  26.   mpres@mpPerimLineColor       = "Black"

  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  29. ; What times and how many time steps are in the data set?
  30.   FirstTime = True
  31.   times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  32.   ntimes = dimsizes(times)         ; number of times in the file

  33. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  34.   do it = 0,ntimes-1,2             ; TIME LOOP

  35.     print("Working on time: " + times(it) )
  36.     if (FirstTime) then            ; Save some times for tracking tendencies
  37.       times_sav = times(it)
  38.     end if
  39.     res@TimeLabel = times(it)   ; Set Valid time to use on plots

  40. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  41. ; First get the variables we will need        

  42.     slp = wrf_user_getvar(a,"slp",it)  ; slp
  43.       wrf_smooth_2d( slp, 3 )            ; smooth slp

  44.   ; Get non-convective, convective and total precipitation
  45.   ; Calculate tendency values                              
  46.     rain_exp = wrf_user_getvar(a,"RAINNC",it)
  47.     rain_con = wrf_user_getvar(a,"RAINC",it)
  48.     rain_tot = rain_exp + rain_con
  49.     rain_tot@description = "Total Precipitation"

  50.     if( FirstTime ) then
  51.       if ( it .eq. 0 ) then
  52.         rain_exp_save = rain_exp
  53.         rain_con_save = rain_con
  54.         rain_tot_save = rain_tot
  55.       else
  56.         rain_exp_save = wrf_user_getvar(a,"RAINNC",it-1)
  57.         rain_con_save = wrf_user_getvar(a,"RAINC",it-1)
  58.         rain_tot_save = rain_exp_save + rain_con_save
  59.         FirstTime = False
  60.         times_sav = times(it-1)
  61.       end if
  62.     end if

  63.     rain_exp_tend = rain_exp - rain_exp_save
  64.     rain_con_tend = rain_con - rain_con_save
  65.     rain_tot_tend = rain_tot - rain_tot_save
  66.     rain_exp_tend@description = "Explicit Precipitation Tendency"
  67.     rain_con_tend@description = "Param  Precipitation Tendency"
  68.     rain_tot_tend@description = "Precipitation Tendency"

  69.   ; Bookkeeping, just to allow the tendency at the next time step
  70.     rain_exp_save = rain_exp
  71.     rain_con_save = rain_con
  72.     rain_tot_save = rain_tot

  73. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  74.     if( .not. FirstTime ) then     ; We will skip the first time

  75.       ; Plotting options for Sea Level Pressure
  76.         opts_psl = res         
  77.         opts_psl@ContourParameters = (/ 900., 1100., 2. /)
  78.         opts_psl@cnLineColor       = "Blue"
  79.         opts_psl@cnInfoLabelOn     = False
  80.         opts_psl@cnLineLabelFontHeightF = 0.01
  81.         opts_psl@cnLineLabelPerimOn = False
  82.         opts_psl@gsnContourLineThicknessesScale = 1.5
  83.         contour_psl = wrf_contour(a,wks,slp,opts_psl)
  84.         delete(opts_psl)
  85.    

  86.       ; Plotting options for Precipitation
  87.         opts_r = res                        
  88.         opts_r@UnitLabel            = "mm"
  89.         opts_r@cnLevelSelectionMode = "ExplicitLevels"
  90.         opts_r@cnLevels             = (/ .1, .2, .4, .8, 1.6, 3.2, 6.4, \
  91.                                         12.8, 25.6, 51.2, 102.4/)
  92.         opts_r@cnFillColors         = (/"White","White","DarkOliveGreen1", \
  93.                                         "DarkOliveGreen3","Chartreuse", \
  94.                                         "Chartreuse3","Green","ForestGreen", \
  95.                                         "Yellow","Orange","Red","Violet"/)
  96.         opts_r@cnInfoLabelOn        = False
  97.         opts_r@cnConstFLabelOn      = False
  98.         opts_r@cnFillOn             = True
  99.    

  100.       ; Total Precipitation (color fill)
  101.         contour_tot = wrf_contour(a,wks, rain_tot, opts_r)
  102.    
  103.       ; Precipitation Tendencies
  104.         opts_r@SubFieldTitle = "from " + times_sav + " to " + times(it)
  105.    
  106.         contour_tend = wrf_contour(a,wks, rain_tot_tend,opts_r) ; total (color)
  107.         contour_res = wrf_contour(a,wks,rain_exp_tend,opts_r)   ; exp (color)
  108.         opts_r@cnFillOn = False
  109.         opts_r@cnLineColor = "Red4"
  110.         contour_prm = wrf_contour(a,wks,rain_con_tend,opts_r)   ; con (red lines)
  111.         delete(opts_r)



  112.       ; MAKE PLOTS                                       

  113.         ; Total Precipitation
  114.           plot = wrf_map_overlays(a,wks,contour_tot,pltres,mpres)

  115.         ; Total Precipitation Tendency + SLP
  116.           plot = wrf_map_overlays(a,wks,(/contour_tend,contour_psl/),pltres,mpres)

  117.         ; Non-Convective and Convective Precipiation Tendencies
  118.           plot = wrf_map_overlays(a,wks,(/contour_res,contour_prm/),pltres,mpres)

  119.     end if    ; END IF FOR SKIPPING FIRST TIME

  120. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  121.     times_sav = times(it)
  122.     FirstTime = False
  123.   end do        ; END OF TIME LOOP

  124. end
复制代码



密码修改失败请联系微信:mofangbao
 楼主| 发表于 2017-8-27 14:03:19 | 显示全部楼层
有没有大神哇
密码修改失败请联系微信:mofangbao
发表于 2017-8-27 16:02:40 | 显示全部楼层
出图你先用x11看一下,是不是被覆盖了
密码修改失败请联系微信:mofangbao
发表于 2017-8-27 17:19:15 | 显示全部楼层
检查数据吧
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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