Re: I can draw a netCDF file in GrADS

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 26 Jul 2006 20:32:11 -0600 (MDT)

On Wed, 26 Jul 2006, Hee-Jeong Baek wrote:

> Hi,
>
> Thank you for previous help for solving NCL problem.
> But I have a problem again.
> I made a netCDF file interpolated from fixed grid to gaussian grid.
>
> *************************************************
> ; read and calcualte of multiple files
> ;*************************************************
> 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"
> ;*************************************************
> begin
> ;*************************************************
> ; open file and read in data
> ;*************************************************
> filename = "stream.daily.grid.1978.nc"
> fu = addfile (filename,"r")
> sf = fu->sf(:,9,:,:)
> time = fu->time
> lat = fu->lat
> lon = fu->lon
> dimu = getfilevardimsizes(fu,"sf")
> nt = dimu(0)
> nlev = dimu(1)
> nlat = dimu(2)
> nlon = dimu(3)
> ;************************************************
> ;interpolates a scalar quantity from a fixed grid to a Gaussian grid
> ;************************************************
> jlat=32
> ilon = 64
> sfT21 = f2gsh_Wrap (sf, (/jlat,ilon/), 21)
> lonT21 = lonGlobeF (ilon, "lon", "longitude", "degrees_east")
> latT21 = latGau (jlat, "lat", "latitude" , "degrees_north")
> ;************************************************
> ; outfile of interpolated stream function
> ;************************************************
> fout = addfile("stream.daily.trun.1978.nc","c")
> setfileoption(fout,"DefineMode",True)
> fileAtt = True
> fileAtt_at_creation_date = systemfunc("date")
> fileAtt_at_title = "efficient write netcdf data "
> fileattdef(fout,fileAtt)
> dimNames = (/"time","lat","lon"/)
> dimSizes = (/nt,jlat,ilon/)
> dimUnlim = (/False,False, False/)
> filedimdef (fout,dimNames,dimSizes,dimUnlim)
> filevardef (fout,"time",typeof(time),getvardims(time))
> filevardef (fout,"lat" ,typeof(lat) ,getvardims(latT21))
> filevardef (fout,"lon" ,typeof(lon) ,getvardims(lonT21))
> filevardef (fout,"sfT21" ,typeof(sfT21) ,getvardims(sfT21))
> filevarattdef(fout,"time",time)
> filevarattdef(fout,"lat" ,latT21)
> filevarattdef(fout,"lon" ,lonT21)
> filevarattdef(fout,"sfT21",sfT21)
> fout->time = (/time/)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
You have previously predefined the "lat" and "lon" variable names.

However,

> fout->latT21 = (/latT21/)
> fout->lonT21 = (/lonT21/)

writes to variable names "latT21" and "lonT21"
which you have *not* predefined.

Try:
   fout->lat = (/latT21/)
   fout->lon = (/lonT21/)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

> fout->sfT21 = (/sfT21/)
> end
>
> but I have a error message during drawing in GrADS.
> =====================================
> sdfopen stream.daily.trun.1978.nc
> Scanning self-describing file: stream.daily.trun.1978.nc
> SDF file stream.daily.trun.1978.nc is open as file 1
> LON set to 0 360
> LAT set to 9.96921e+36 9.96921e+36
> LEV set to 0 0
> Time values set: 1978:1:1:0 1978:1:1:0
> ga-> d sft21
> Map Projection Error: Internal Logic check
> Cannot contour grid - all undefined values
> ==============================
> I don't know why?
> Thank you for help in advance!
>
> Hee-Jeong
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 26 2006 - 20:32:11 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 28 2006 - 16:18:18 MDT