I'm a GrADS user too..
During my transition to NCL I too am facing the same problem. What I do is
to convert the Grads file to NetCDF with the 'lats4d' package in Grads.
Then use the 'addfile' command to read the netcdf.
Else, to read the binary file of Grads, one has to supply all the
attributes explicitly to the data read with 'fbindirread'
Please see a NCL script segment.
fname = "/user1/prince/Reynolds/1x1/sstan_jan1982_dec2002.grd"
ntim = 252
nlat = 180
nlon = 360
lonL = 0
lonR = 360
latS = -89.5
latN = 89.5
years = sprinti("%4i",ispan(1982,2002,1)) ; write integers
as string
months = sprinti("%0.2i", ispan(1,12,1)) ; ditto for
months
time = new(dimsizes(years)*dimsizes(months),"integer") ; create
time array
k=0
do i=0,dimsizes(years)-1
do j = 0, dimsizes(months)-1
time(k)=stringtointeger(years(i)+months(j)) ; combine to
strings
k=k+1 ; and
convert to int
end do
end do
lat = fspan(latS,latN,nlat)
lat_at_units = "degrees_north"
lon = fspan(lonL,lonR,nlon)
lon_at_units = "degrees_east"
sst = fbindirread(fname,0,(/ntim,nlat,nlon/), "float")
sst!0 = "time"
sst!1 = "lat"
sst!2 = "lon"
time_at_long_name = "time"
time_at_units = "yyyymm"
sst&time = time
sst&lat = lat
sst&lon = lon
sst@_FillValue = -32767
------------------------------------------
Hope this helps!
Prince
On Fri, 3 Mar 2006, Dennis Shea wrote:
>
> Well, I am not a GrADS user :-)
> so I do not know. You may have to go to the GrADS
> WWW and read about it.
>
> GrADS format is basically a flat binary file.
>
> I speculate that the following will work.
>
> rain = fbindirread("1991new.grads", 0, 365, "float")
> print(rain)
>
> ==========================================================================
> > On Thu, 2 Mar 2006, sahana_paul wrote:
>>
> Hi,
> I have dat in grads binary file say temp.grads and descripter file
> temp.ctl and temp.map also. Is it possible to use this file in NCL or anyother
> way to convert it netcdf, grib, or any other file format.
>
>> I have station data, so how to assaign the lat lon to the
>> perticular station.
>> my ctl file is,
>>
>> dset ^1991new.grads
>> dtype station
>> stnmap 1991new.map
>> undef -9999.00
>> title rain
>> tdef 365 linear 01jan1991 1dy
>> vars 1
>> rain 0 99 rain
>> endvars
>>
>> in that case I cannot use the grads2nc.
>>
>> regards
>>
>> sahana
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-- Prince K XAVIER Centre for Atmospheric and Oceanic Sciences Indian Institute of Science Bangalore - 560 012 INDIA http://caos.iisc.ernet.in/hpg/students/prince.html __________________________________________________ Phone No. +91 80 2293 2505 (Extn:201) +91 98808 19172 (Mobile) _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Fri Mar 03 2006 - 22:23:03 MST
This archive was generated by hypermail 2.2.0 : Wed Mar 08 2006 - 17:08:37 MST