Re: Calculating daily rainfall from 3hourly WRF output

From: Will Hobbs <Will.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 18 2013 - 01:26:48 MDT

Kamal

Your loop at line 50 has too many iterations with respect to the array
rainfall_tot.

'rainfall_tot' has dimensions (/31,210,213/), so the highest index you
have for the left most dimension is 30.

For your loop, when nt=30, nt+1=31 which is outside the range of
rainfall_tot.

Hope that helps

Will

On 18/03/13 6:15 PM, "mmkamal@uwaterloo.ca" <mmkamal@uwaterloo.ca> wrote:

>Hi,
>
>
>I have been trying to calculate daily precipitation from 3hourly WRF
>history file but could not succeed. Below I am including my script
>with the error message I got.
>
>
>;=================================================================
>; Output Frequency: 00, 03, 06, 09, 12, 15, 18, 21
>; Want to generate a Rainfall time series
>; In WRF rainfall variable RAINC and RAINNC are accumulated rainfall
>; (rainfall at a particulat time steps is the cumulative sum of the
>previous all time steps)
>;*************************************************************************
>*************************
>
> 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
>;************************************************
>; Read the file
>;************************************************
>
> wrf_out =
>addfile("/scratch/j/jcl/mkamal/DATA/Observation/DAYMET/Regrid_Rect_Curv/wr
>fout_d02_2002-01-01.nc","r")
>
> lat = wrf_out->XLAT(0,:,:)
> lon = wrf_out->XLONG(0,:,:)
>
> x = wrf_out->RAINC(::8,:,:) ; 8 'samples' per day
>
> y = wrf_out->RAINNC(::8,:,:)
>
> printVarSummary(x)
>
> printVarSummary(y)
>
> rainfall_tot = x+y
>
> printVarSummary(rainfall_tot)
>
>;-------------------------------------------
>; The following statement works fine
>;-------------------------------------------
>
> nt = 0
> wrf_rain = rainfall_tot(nt+1,:,:)-rainfall_tot(nt,:,:)
> printVarSummary(wrf_rain)
>
>; times = wrf_user_list_times(wrf_out)
>; ntimes=dimsizes(times)
>
>;-------------------------------------------------------------------------
>; Seperating daily rainfall from accumulated rainfall (problem is here)
>;-------------------------------------------------------------------------
> do nt =0,30,1
> wrf_rain = rainfall_tot(nt+1,:,:)-rainfall_tot(nt,:,:)
> end do
>
>end
>
>===========================================
>I get the following error message:
>===========================================
>Variable: rainfall_tot
>Type: float
>Total Size: 5546520 bytes
> 1386630 values
>Number of Dimensions: 3
>Dimensions and sizes: [31] x [210] x [213]
>Coordinates:
>
>Variable: wrf_rain
>Type: float
>Total Size: 178920 bytes
> 44730 values
>Number of Dimensions: 2
>Dimensions and sizes: [210] x [213]
>Coordinates:
>fatal:Subscript out of range, error in subscript #0
>fatal:An error occurred reading rainfall_tot
>fatal:["Execute.c":7743]:Execute: Error occurred at or near line 50 in
>file wrf_daily_precipitation.ncl
>
>
>Where line 50 in my script is "wrf_rain =
>rainfall_tot(nt+1,:,:)-rainfall_tot(nt,:,:)"
>==========================================================================
>==
>
>I look forward to hearing from you.
>
>
>Thanks
>Kamal
>
>
>
>_______________________________________________
>ncl-talk mailing list
>List instructions, subscriber options, unsubscribe:
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 18 01:27:02 2013

This archive was generated by hypermail 2.1.8 : Tue Mar 19 2013 - 16:31:18 MDT