[ncl-talk] Regrinding WRF precipitation to TRMM grid
Saurabh Singh
saurabhsingh123op at gmail.com
Wed Apr 13 13:01:42 MDT 2016
Dear Mam/Sir
NCL 6.3.0
OS Ubuntu
I am trying to regard WRF precipitation data from curvilinear grid to
rectilinear grid ignorer to take its difference from TRMM data. i am using
the code :
a = addfile ("/Users/saurabh/Downloads/wrfout_d01_2000-01-24_12:00:00.nc
","r")
Rain = a->RAINC
rainfall = a->RAINC
printVarSummary(rainfall) ; look at the variable
printMinMax(rainfall, True ) ; contributed.ncl
rainfall!0 = "time"
rainfall!1 = "lat"
rainfall!2 = "lon"
printVarSummary(rainfall)
rearrange_rain = rainfall(time|:,lon|:,lat|:)
; reorder coordinates for next step
; Average all lats as a function of lon for Time vs. Longitude plot
;(Hovmueller diagram)
rain=dim_avg(rearrange_rain) ; avg rightmost dimension with center
dimension
copy_VarMeta(rearrange_rain, rain)
printVarSummary(rain)
printMinMax(rain)
;WRF XLAT/XLONG are (Time,south_north,west_east)
;Generally, they do not change with time.
;Hence, read then as 2D arrays
; These are [*][*] (two dimensional)
lat2d = a->XLAT(0,:,:)
lon2d = a->XLONG(0,:,:)
lat2d_at_units = "degrees_north" ; not required for interpolation
lon2d_at_units = "degrees_east"
printVarSummary(lat2d)
printVarSummary(lon2d)
;Your 'target' (rectilinear) grid is lat[*],lon[*].
;This could be from some other model
;or you could manually create via
latS = 5 ; regular grid output
latN = 11
lonL = -30
lonR = -20
mlon = 22 ; however many points you want, here 22
;because 0.5 degree
lon = fspan (lonL, lonR, mlon)
lon!0= "lon"
lon_at_units = "degrees_east"
print(mlon)
nlat = 14 ; however many points you want
lat = fspan (latS,latN, nlat)
lat!0= "lat"
lat_at_units = "degrees_north"
print(nlat)
raingrd = rcm2rgrid(lat2d,lon2d,rain,lat,lon,0)
printVarSummary(ringed)
but the regrinding does not happen, i get the following error:
fatal:rcm2rgrid: The rightmost dimensions of fi must be nlat2d x nlon2d,
where nlat2d and nlon2d are the dimensions of the lat2d/lon2d arrays
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 46 in file
regrid.ncl
fatal:Variable (raingrd) is undefined
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 47 in file
regrid.ncl
Kindly help me to solve this problem.
--
With regards
Saurabh Kumar singh
*P** : * *Please consider the environment before printing this e-mail*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160414/afde005a/attachment.html
More information about the ncl-talk
mailing list