Dear Dennis Shea & Mary, thanks for helping me.
One more request, I’m interested to plot rainfall vs time (time series) over
the averaged area using the wrf data. The script is attached here, kindly
could you have a look on it
thanks again and regards,
************************
***********************
Begin
f0 = a->RAINNC
f1 = a->RAINC
rainfall = f0+f1
printVarSummary(rainfall) ; look at the variable
;WRF XLAT/XLONG are (Time,south_north,west_east)
lat2d = a->XLAT(0,:,:)
lon2d = a->XLONG(0,:,:)
lat2d@units = "degrees_north" ; not required for interpolation
lon2d@units = "degrees_east"
printVarSummary(lat2d)
printVarSummary(lon2d)
latS = 10 ; regular grid output
latN = 20
lonL = 80
lonR = 90
mlon = 22 ; however many points you want, here 22 because 0.5 degree
lon = fspan (lonL, lonR, mlon)
lon!0= "lon"
lon@units = "degrees_east"
print(mlon)
nlat = 14 ; however many points you want
lat = fspan (latS,latN, nlat)
lat!0= "lat"
lat@units = "degrees_north"
print(nlat)
raingrd = rcm2rgrid_Wrap(lat2d,lon2d,rainfall,lat,lon,0)
;printVarSummary(raingrd,True)
Times = a->Times
Time = WRF_Times2Udunits_c(Times, 0)
ntim = dimsizes(Time)
u = wgt_areaave_Wrap(raingrd, 1.0, 1.0, 0)
printVarSummary(u)
end
Print summary:
Variable: rainfall
Type: float
Total Size: 879660 bytes
219915 values
Number of Dimensions: 3
Dimensions and sizes: [9] x [135] x [181]
Coordinates:
Variable: lat2d
Type: float
Total Size: 97740 bytes
24435 values
Number of Dimensions: 2
Dimensions and sizes: [south_north | 135] x [west_east | 181]
Coordinates:
Number Of Attributes: 5
FieldType : 104
MemoryOrder : XY
description : LATITUDE, SOUTH IS NEGATIVE
units : degrees_north
stagger :
Variable: lon2d
Type: float
Total Size: 97740 bytes
24435 values
Number of Dimensions: 2
Dimensions and sizes: [south_north | 135] x [west_east | 181]
Coordinates:
Number Of Attributes: 5
FieldType : 104
MemoryOrder : XY
description : LONGITUDE, WEST IS NEGATIVE
units : degrees_east
stagger :
Variable: mlon
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 22
Variable: nlat
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 14
Variable: u
Type: float
Total Size: 36 bytes
9 values
Number of Dimensions: 1
Dimensions and sizes: [9]
Coordinates:
Number Of Attributes: 3
_FillValue : -999
ncl : rcm2rgrid used for interpolation
wgt_areaave_op_ncl : Area Average
On Mon, Dec 6, 2010 at 11:56 PM, Dennis Shea <shea@ucar.edu> wrote:
> The 1st place ranfall_tot is referenced is in line 31
>
>
> prcDay(nt/24,:,:) = dim_sum_n(rainfall_tot(ntStrt:ntLast,:,:), 0)
>
> ===
> I think it should be
>
> prcDay(nt/24,:,:) = dim_sum_n(rainfall_hour(ntStrt:ntLast,:,:), 0)
>
> ===
>
> Prior to that .... Why are you doing this???
>
>
>
> > rainfall_hour = new ( (/ntim,nlat,mlon/), "float")
> > do it = 0,ntimes-1
> > rain_con = wrf_user_getvar(a,"RAINC",-1)
> > rain_exp = wrf_user_getvar(a,"RAINNC",-1)
> > rainfall_hour = rain_con + rain_exp
> > end do
>
> You should be able to dor
>
>
> rain_con = wrf_user_getvar(a,"RAINC",-1)
> rain_exp = wrf_user_getvar(a,"RAINNC",-1)
> rainfall_hour = rain_con + rain_exp
>
>
> On 12/6/10 7:18 AM, wei huang wrote:
>
>> Dear NCL users,
>> I have 90 hours of wrf data and I want to convert it into number of
>> days. During my conversion process the following error is appeared given
>> below:
>>
>> fatal:Undefined identifier: (rainfall_tot) is undefined, can't continue
>>
>> fatal:Execute: Error occurred at or near line 31 in file rain10d1.ncl
>>
>> Any advice/suggestion will be appreciated
>>
>> My script is attached herewith
>>
>> Thanks
>>
>> wei
>>
>> *************************************
>>
>> 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/wrf/WRF_contributed.ncl"
>>
>> begin
>>
>> a = addfile("/wrfout.nc <http://wrfout.nc>","r")
>>
>>
>> times= wrf_user_list_times(a); get times in the file
>>
>> ntimes = dimsizes(times)
>>
>> print(times)
>>
>> xlat = a->XLAT(0,:,:)
>>
>> xlon = a->XLONG(0,:,:)
>>
>> dimll= dimsizes( xlat )
>>
>> nlat = dimll(0)
>>
>> mlon = dimll(1)
>>
>> ntim = ntimes
>>
>> rainfall_hour = new ( (/ntim,nlat,mlon/), "float")
>>
>> do it = 0,ntimes-1
>>
>> rain_con = wrf_user_getvar(a,"RAINC",-1)
>>
>> rain_exp = wrf_user_getvar(a,"RAINNC",-1)
>>
>> rainfall_hour = rain_con + rain_exp
>>
>> end do
>>
>> ntJump = 24 ; 24 'samples' per day
>>
>> prcDay = rainfall_hour(::ntJump,:,:)
>>
>> 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
>>
>> end do
>>
>> prcDay@long_name = "Daily total precipitation"
>>
>> prcDay@units = rain_con@units
>>
>> copy_VarCoords(xlat,prcDay(0,:,:))
>>
>> printVarSummary(prcDay)
>>
>> end
>>
>>
>>
>> _______________________________________________
>> 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 Tue Dec 7 19:23:02 2010
This archive was generated by hypermail 2.1.8 : Fri Dec 10 2010 - 14:58:12 MST