Re: WRF: Daily Precipitation

From: Sahidul <sahidul_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 20 2010 - 06:52:11 MDT

Dear NCl help,

I tried to plot according to youe suggestion. I am facing problem like:
in line: prcDay = rainfall_tot(::ntJump,:,:)
= = = = = == =
fatal:Number of subscripts on rhs do not match number of dimensions of
variable,(3) Subscripts used, (2) Subscripts expected
fatal:Execute: Error occurred at or near line 109 in file precipitation.ncl
= = = = = == =

The code is:
= = = = = = =
;***********************************************************************
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/csm/contributed.ncl"

begin
;***********************************************************************
; Open wrfout file.
;***********************************************************************)
datadir = "/casvol5/basantas/cas/WRF3-1/output-wrf/2010041400/"
FILES = systemfunc ("ls -1 " + datadir + "wrfout_d01_2010-04* " )
numFILES = dimsizes(FILES)

do ifil = 0,numFILES-1
   wrf_out = addfile(FILES(ifil)+".nc","r")
;***********************************************************************
; Read time dimesion.
;***********************************************************************
  times = wrf_user_list_times(wrf_out)
  ntimes=dimsizes(times)

do it = 0,ntimes-1,1

;***********************************************************************
;Open Workstation ps,eps,X11,pdf,ncgm
;***********************************************************************
  type = "ps"
  wks = gsn_open_wks(type,"precip_animation")

  res = True
  res@InitTime = False
  res@Footer = False
  res@gsnMaximize = True
  res@MainTitle = "Total Precipitation"

  opts = res
  opts@cnLinesOn = False
  opts@cnFillOn = True
  opts@UnitLabel = "mm"
  opts@cnFillColors = (/"White","White","DarkOliveGreen1", \
                                         "DarkOliveGreen3","Chartreuse", \

"Chartreuse3","Green","ForestGreen", \
                                         "Yellow","Orange","Red","Violet"/)
  opts@cnInfoLabelOn = False
  opts@cnConstFLabelOn = False

  pltres = True
  mpres = True
  mpres@mpOutlineBoundarySets = "National"
  mpres@mpNationalLineThicknessF = 1.5
  mpres@mpNationalLineColor = "Red"
  mpres@mpGeophysicalLineColor = "Red"
  mpres@mpGeophysicalLineThicknessF = 1.5

;***********************************************************************
; Total Rainfall calculation
;***********************************************************************

  rain_con = wrf_user_getvar(wrf_out,"RAINC",it)
  printVarSummary(rain_con)
  rain_exp = wrf_user_getvar(wrf_out,"RAINNC",it)
  printVarSummary(rain_exp)
  rainfall_tot(it) = rain_con(it) + rain_exp(it)
  rainfall_tot@description = "Total Precipitation"

 printVarSummary(rainfall_tot)
  ;***********************************************************************
;Ploting Total Precipitation
;***********************************************************************

daily_precip = rainfall_tot(0::72,:,:)
printVarSummary(daily_precip)

  dimprc = dimsizes(rainfall_tot)
  printVarSummary(dimprc)
  ntim = dimprc(0) ; total number of time steps
  ntJump = 24 ; eight samples per day (=24/3)

  prcDay = rainfall_tot(::ntJump,:,:) ; create array with meta data

  ntStrt = 0
  ntLast = ntJump-1

  do nt=0,ntim-1,ntJump

     prcDay(nt/24,:,:) = dim_sum_n(rainfall_tot(ntStrt:ntLast,:,:), 0)
     ntStrt = ntStrt + ntJump
     ntLast = ntLast + ntJump

     contour_tot = wrf_contour(wrf_out,wks,prcDay,opts)
     plot = wrf_map_overlays(wrf_out,wks,(/contour_tot/),pltres,mpres)
  end do
  printVarSummary(prcDay)
 end do ; Time Looend do

end do
end

Kindly help me to solve this.

with regards,

On Mon, Apr 19, 2010 at 10:34 PM, Dennis Shea <shea@ucar.edu> wrote:

> Please see the FAQ:
>
> http://www.ncl.ucar.edu/FAQ/
>
> Data Analysis: Example 1
>
> ===
> You must write your own script.
> ===
>
> In your case:
>
> (1) ntJump = 24 ; 24 samples per day
> (2) Use dim_sum_n
> (3) See
>
> do nt=0,ntim-1,ntJump
> prcDay(nt/8,:,:) = dim_sum_n(prc(ntStrt:ntLast,:,:), 0)
> ntStrt = ntStrt + ntJump
> ntLast = ntLast + ntJump
>
> ; write netCDF
> ; http://www.ncl.ucar.edu/Applications/method_1.shtml
> end do
>
>
>
> On 04/18/2010 01:08 AM, Sahidul wrote:
>
>> Dear NCL Users,
>>
>> I am having hourly WRF forecast files. The number of files is 72. ( each
>> file having only 1 time )
>> Using this, I would like to calculate Daily Precipitation, i.e., 24
>> hourly accumulated rainfall. So I want to create 3 files, for example,
>> day1, day2 & day3.
>>
>> Can I have any script for this calculations.?
>>
>> Thanking you,
>>
>> Sahidul
>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 20 06:52:20 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 23 2010 - 14:40:07 MDT