Re: output NC ploblem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat, 22 Nov 2008 08:47:45 -0700

This is a GrADS question, not an NCL question.
In the future, GrADS questions should be sent to

   http://www.iges.org/grads/users.html

Look at the documentation for sdsopen and xdfopen

------------------------------------------
Ideally, GrADS wants netCDF files which conform to the
COARDS netCDF convention. Please read the following and
you can use NCL to create a COARDS conforming netCDF files.

http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html
--------------------------------------------
Below are some changes to your code

uanghua Chen wrote:
> Hi
> I have one 4-D binary data, whose dimension is nlev*ntime*ny*nx. It
> need to be converse into nc formmat with ntime*nlev*ny*nx structure.
> According to the following script, the output nc data can be produced.
> However, when nc data is open by grads, a warning display: Found
> displayable variable ugrd with 0 levels in SDF file. It means that nc
> data just includes one level. Why?
>
> begin
> nlev=12
> nday=183
> ny=51
> nx=181
> infile="2000ugrd.dat"
> outfile="2000ugrd.nc"
> var=fbindirread(infile,0,(/nlev,nday,ny,nx/),"float")
> ncfile=addfile(outfile,"c")
>
> var!0="lev"
> var!1="time"
> var!2="lat"
> var!3="lon"
>
> ref=new((/1/),"integer")

no need for "new"
   ref = 0 ; or True , actually anything

> ref_at_units="days since 0000-01-01 00:00:00"
> date=ut_inv_calendar(nyear,6,1,0,0,0,ref_at_units,0)

what is "nyear"
>
> var&lev=new((/nlev/),"float")
> var&lev=(/1000,925,850,700,600,500,400,300,250,200,150,100/)

replace with

   lev = (/1000,925,850,700,600,500,400,300,250,200,150,100/)
   lev_at_units = "hPa"
   lev!0 = "lev"
   var&lev = lev

> var&time=fspan(date,date+nday-1,nday)

replace with

   time = fspan(date,date+nday-1,nday)
   time_at_units = "days since 0000-01-01"
   time!0 = "time"

> var&lat=fspan(-10,40,ny)
> var&lon=fspan(90,270,nx)

   lat = span(-10,40,ny)
   lat_at_units = "degrees_north"
   lat!0 = "lat"

   lon = fspan(90,270,nx)
   lon_at_units = "degrees_east"
   lon!0 = "lon"

   var&lat = lat
   var&lon= lon
>

> ncfile->ugrd=var(time|:,lev|:,lat|:,lon|:)
>
> end
>
> 2008-11-22
> ------------------------------------------------------------------------
> Guanghua Chen
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Nov 22 2008 - 08:47:45 MST

This archive was generated by hypermail 2.2.0 : Tue Nov 25 2008 - 10:18:44 MST