[ncl-talk] use rgrid2rcm to deal with TRMM 3B42

Dennis Shea shea at ucar.edu
Wed Nov 19 09:14:56 MST 2014


I modified an existing script (attached).

The TRMM 3B42RT file I have had the 'rain' (PRC) as type short.
Also, I used a WRF file I had locally ... not China.

Good Luck


On Wed, Nov 19, 2014 at 5:23 AM, 易路 <dg1225033 at smail.nju.edu.cn> wrote:

> Dear all,
>
>    I downloaded the TRMM 3B42 with a format of NetCDF, and want to change
> to rcm for keeping consistance with WRF output data.
>
> The problem is (1) the spatial area of wrf output is regioanl, for example
> in China, but the spatial area of TRMM is nearly global(-50,50;-180,180)
>                (2) the TRMM data is grided, the wrf data is rcm (lambert)
> when I want to display the regioanl (China) area of the TRMM and in a
> format of RCM, how to realize?
>
> I tried writing the scriput, but it is wrong , would you please check it
> for me? Thanks a lot!
>
> SCRIPT AS FOLLOWS:
> ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>
> 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/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>
> begin
>
> ; read data
> *****************************************************************
>
>   aDataDir       ="/home/yl/wrfcase/ncl-picture/"
>   aFileName      ="wrfout_d01_2003-07-02_00:00:00.nc"
>   aFile          =aDataDir+aFileName
>   a = addfile(aFile,"r")                                             ; a
> is the wrf output with the format of rcm
>
>   bDataDir       ="/home/yl/wrfcase/TRMM/rgrid2rcm/"
>   bFileName      ="trmmdata"
>   bFile          =bDataDir+bFileName
>   b = addfile(bFile,"r")                                             ; b
> is the trmm data with the format of grid
>
>   lat2d=wrf_user_getvar(a,"XLAT",0)
>   lon2d=wrf_user_getvar(a,"XLONG",0)
>
>   xlat=b->latitude
>   xlon=b->longitude
>   rain=b->pcp
>   times=b->time
>   xtimes=dimsizes(times)
>   year="2003"
>   ;printVarSummary(xlat)
>   ;printVarSummary(xlon)
>   ;printVarSummary(times)
>   ;printVarSummary(rain)
> ; set basic resources*****************************************************
>
>    type    = "x11"
>    wksname ="GrADS_rain_2rcm"
>    wks     = gsn_open_wks(type,wksname)
>
>   res                   = True
>   res at gsnAddCyclic     = False
>
> ; set map
>    res at mpGeophysicalLineColor = "Navy"
>    res at mpNationalLineColor    = "Black"
>   ;res at mpUSStateLineColor     = "Black"
>   ;res at mpLimbLineColor        = "Black"
>   ;res at mpPerimLineColor       = "Black"
>   res at mpDataBaseVersion="MediumRes"    ;加入中国省界边界线
>   res at mpDataSetName="Earth..4"         ;加入中国省界边界线
>   res at mpOutlineSpecifiers = "China:states"   ;加入中国省界边界线
>
>   res at pmTickMarkDisplayMode   ="Always"
>
>   res at mpLimitMode             ="Corners"
>   res at mpLeftCornerLatF        =lat2d(0,0)             ; lat2d(nlat-1,0)
>   res at mpLeftCornerLonF        =lon2d(0,0)             ; lon2d(nlat-1,0)
>   res at mpRightCornerLatF        =lat2d(nlat-1,mlon-1)  ; lat2d(0,nlon-1)
>   res at mpRightCornerLonF        =lon2d(nlat-1,mlon-1)  ; lon2d(0,nlon-1)
>
>   res at mpProjection            ="LambertConformal"
>   res at mpLambertParallel1F     =30.
>   res at mpLambertParallel2F     =60.
>   res at mpLambertMeridianF      =113.5
>   res at mpCenterLonF            =113.5
>   res at mpFillOn                =False
>
> ;set grid line
>   res at mpGridAndLimbOn          =True     ; defalt is True
>   res at mpGridAndLimbDrawOrder   ="PostDraw" ; Draw, PostDraw
>   res at pmTickMarkDisplayMode    ="Always"
>
>   res at mpGridLineDashPattern       =0   ; 17 kinds in all
>   res at mpGridSpacingF              =5.
>   res at mpGridLineThicknessF        =2
>   res at mpGridLineColor             ="Grey"
>
> ;
> plot*************************************************************************
> ; do it =0,xtimes-1,1          ; TIME LOOP  0,xtimes-1,1
>
>       ;print("Working on time: " + times(it) )
>
>       rain_it  =rain(:,:,:)
>       rain_it_xgrd = rgrid2rcm(xlat,xlon,rain_it,lat2d,lon2d,0)
>       rain_it_xgrd!0  ="south_north"
>       rain_it_xgrd!1  ="west_east"
>       rain_it_xgrd at lat2d  =lat2d
>       rain_it_xgrd at lon2d  =lon2d
>
>       printVarSummary(rain_it_xgrd)
>
>       plot = gsn_csm_contour_map(wks,rain_it_xgrd,res)
>
>
>  ;end do
>
> ;*****************************************************************************
>
> end
>
>
> ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> _______________________________________________
> ncl-talk mailing list
> 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/20141119/a0c16e86/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trmm_rgrid2rcm.ncl
Type: application/octet-stream
Size: 3010 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141119/a0c16e86/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NCL_rain_2rcm.png
Type: image/png
Size: 50874 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141119/a0c16e86/attachment.png 


More information about the ncl-talk mailing list