[ncl-talk] Regrinding WRF precipitation to TRMM grid
Dennis Shea
shea at ucar.edu
Sat Apr 16 11:57:15 MDT 2016
I have no idea why you are doing what you did!
diri = "./"
fili = "wrfout_...nc"
f = addfile(diri+fili,"r")
r = f->RAINC
printVarSummary(r) ; ***LOOK AT YOUR DATA***
printMinMax(r,1) ; *** KNOW YOUR DATA***
lat2d = f->XLAT(0,:,:)
lon2d = f->XLONG(0,:,:)
dimr = dimsizes(r)
ntim = dimr(0)
; Global TRMM grid .... Change for the WRF region
nlat = 400
mlon = 1400
lat = fspan(-48.875, 48.875, nlat)
lat!0 = "lat"
lat at units = "degrees_north"
lon = fspan(-179.875, 179.875, nlat)
lon!0 = "lon"
lon at units = "degrees_east"
; regrid (bilinear)
rTRMM = rcm2rgrid_Wrap(lat2d,lon2d,r,lat,lon,0)
printVarSummary(rTRMM)
On Wed, Apr 13, 2016 at 1:01 PM, Saurabh Singh <saurabhsingh123op at gmail.com>
wrote:
>
> 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*
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160416/edb5c28d/attachment.html
More information about the ncl-talk
mailing list