爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6436|回复: 3

[作图] 求问关于编写24h累积降水量的画图脚本的问题

[复制链接]

新浪微博达人勋

发表于 2017-4-10 10:12:13 | 显示全部楼层 |阅读模式

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

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

x
求助各位路过的大神,最近再用模式模拟一次暴雨过程,结果出来后,去ncl官网下了画降水的脚本,但是图出来以后都是2小时一次的降水,还有降水倾向等三种图。刚刚接触ncl,各位前辈指导一下,怎么修改,可以输出24h的降水?下面是官网的脚本,我模式结果日期是2016.6.17中午12点开始,到20号中午12点,每12h出一次累计降水图。谢谢了

;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.
;   In this example we first get the entire field over time, which will
;   make it easier to calculate tendencies
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/gpfswhome/wrfout4/wrfout_d03_2016-06-17_12:00:00.nc","r")

; We generate plots, but what kind do we prefer?
; type = "x11"
type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_Precip2")

; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"
  pltres = True
  mpres = True
  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpNationalLineColor    = "Black"
  mpres@mpUSStateLineColor     = "Black"
  mpres@mpGridLineColor        = "Black"
  mpres@mpLimbLineColor        = "Black"
  mpres@mpPerimLineColor       = "Black"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        
    slp = wrf_user_getvar(a,"slp",-1)    ; slp
      wrf_smooth_2d( slp, 3 )            ; smooth slp
  ; Get non-convective, convective
  ; Calculate 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"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What 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 = 2,ntimes-1,12             ; 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
     contour_psl = wrf_contour(a,wks,slp(it,:,:),opts_psl)
     delete(opts_psl)
   
   ; Plotting options for Precipitation
     opts_r = res                        
     opts_r@UnitLabel            = "mm"
     opts_r@cnLevelSelectionMode = "ExplicitLevels"
     opts_r@cnLevels             = (/ .1, .2, .4, .8, 1.6, 3.2, 6.4, \
                                     12.8, 25.6, 51.2, 102.4/)
     opts_r@cnFillColors         = (/"White","White","DarkOliveGreen1", \
                                     "DarkOliveGreen3","Chartreuse", \
                                     "Chartreuse3","Green","ForestGreen", \
                                     "Yellow","Orange","Red","Violet"/)
     opts_r@cnInfoLabelOn        = False
     opts_r@cnConstFLabelOn      = False
     opts_r@cnFillOn             = True

   ; Total Precipitation (color fill)
     contour_tot = wrf_contour(a,wks, rain_tot(it,:,:), opts_r)

   ; Precipitation Tendencies
     opts_r@SubFieldTitle = "from " + times(it-2) + " to " + times(it)

     contour_tend = wrf_contour(a,wks, rain_tot_tend,opts_r) ; total (color)
     contour_res = wrf_contour(a,wks,rain_exp_tend,opts_r)   ; exp (color)
     opts_r@cnFillOn = False
     opts_r@cnLineColor = "Red4"
     contour_prm = wrf_contour(a,wks,rain_con_tend,opts_r)   ; con (red lines)
     delete(opts_r)

   ; MAKE PLOTS                                       
     ; Total Precipitation
       plot = wrf_map_overlays(a,wks,contour_tot,pltres,mpres)
     ; Total Precipitation Tendency + SLP
       plot = wrf_map_overlays(a,wks,(/contour_tend,contour_psl/),pltres,mpres)
     ; Non-Convective and Convective Precipiation Tendencies
       plot = wrf_map_overlays(a,wks,(/contour_res,contour_prm/),pltres,mpres)

  end do        ; END OF TIME LOOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-9-26 09:19:47 | 显示全部楼层
楼主问题解决了吗
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-3-15 08:46:02 | 显示全部楼层
同求
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2018-3-16 16:04:16 | 显示全部楼层
同问,楼主问题解决了吗?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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