Hi Moet and dennis
 
Thanks alot. Script is now working ok and  making new file with variable on regular lat lon grid. One another thing that i have seen in original and regrided file is that the values are slightly changed. Is this due to the interpolation of the data i.e rcm2grid fuction .
 
Siraj

 
On 4/3/07, Moetasim <mashfaq@purdue.edu> wrote:
Siraj, I think you got everything right after Dennis reply. I just forgot to
remove that extra False from there while modifying the 3d data script to 2d
data.



Quoting Siraj Ul Islam <sirajkhan78@gmail.com>:

> Hi Moet,
>
> thanks for your comments. Well I have modify the script as you have
> suggested. Now the rcm2grid funtion is working but the errors comes
> from the line 56( ; ####ERROR LINE)  now where the output RT_re.nc
> file is written. I am sending you the error as well as the modified
> script with NC dump of HEAD_OUT and SRF files.
> Hope you will again help me to solve this problem.
>
> cheers
>
> Siraj
> ----------------ERROR-------------------------------
> Variable: newvar
> Type: float
> Total Size: 6791136 bytes
>             1697784 values
> Number of Dimensions: 3
> Dimensions and sizes:   [132] x [109] x [118]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue :  -1e+30
> fatal:Execute: Error occurred at or near line 56 in file rcm2grid.ncl
>
> ---------SCRIPT-------------------------------------
> load "/usr/local/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/usr/local/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "/usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;********************************************
> begin
> ;Set path to HEAD_OUT.nc
> dirhead="/root/"
> filhead="head_out.nc"
> ;Set path to RegCM file
> dirrcm="/root/"
> filrcm="SRF.nc"
> ;Pointers to input files
> fhead=addfile(dirhead+filhead,"r")
> f1 = addfile(dirrcm+filrcm,"r")
> ;Read in Data
> var =  f1->RT
> lat2d = fhead->XLAT(0,:,:)
> lon2d = fhead->XLON(0,:,:)
> newlon = new((/118/),typeof(lon2d))
> newlat = new((/109/),typeof(lat2d))
> do j=0,117
> newlon(j)= 50+(0.5)*j
> end do
> do i=0,108
> newlat(i)=5+(0.5)*i
> end do
> newvar = rcm2rgrid(lat2d,lon2d,var,newlat,newlon,1)
> printVarSummary(newvar)
> ncdf=addfile("RT_re.nc","c")
> dimNames=(/"time","lat","lon"/)
> dimSizes=(/-1,109,118/)
> dimUnlim=(/True,False,False,False/)
> filedimdef(ncdf,dimNames,dimSizes,dimUnlim)   ; ####ERROR LINE
> filevardef(ncdf,"RT",typeof(var),(/"time","lat","lon"/))
> ncdf->lat=(/newlat/)
> ncdf->lon=(/newlon/)
> ncdf->RT=(/newvar/)
> end
>
> ----------------OUT_HEAD----------------
>
> filename:       head_out
> path:   head_out.nc
>    file global attributes:
>       domxmin : 52.37275
>       domxmax : 108.0947
>       domymin : - 2.378861
>       domymax : 44.79095
>       domzmin : 1050
>       domzmax :  0
>    dimensions:
>       lon = 118
>       lat = 109
>       time = 1  // unlimited
>    variables:
>       float lon ( lon )
>          long_name :    Longitude
>          units :        degrees_east
>          actual_range : <ARRAY>
>
> ---------------------------------------------------
> > filename:       SRF
> > path:   SRF.nc
> >  file global attributes:
> >     domxmin : 52.37275
> >     domxmax : 108.0947
> >     domymin : -2.378861
> >     domymax : 44.79095
> >     domzmin : 1050
> >     domzmax : 1050
> >  dimensions:
> >     lon = 118
> >     lat = 109
> >     time = 132  // unlimited
> >  variables:
> >     float lon ( lon )
> >        long_name :    Longitude
> >        units :        degrees_east
> >        actual_range : <ARRAY>
>
> >     float lat ( lat )
> >        long_name :    Latitude
> >        units :        degrees_north
> >        actual_range : <ARRAY>
> >


--
Siraj Ul Islam
Research Fellow (Climate Section)
Global Change Impact Studies Centre
First Floor Saudi Pak tower
Blue Area Islamabad Pakistan
Ph :   92-51-9219785
Fax : 92-51-9219787
http://www.gcisc.org.pk