output NC ploblem

From: Guanghua Chen <cgh_at_nyahnyahspammersnyahnyah>
Date: Sat, 22 Nov 2008 10:39:43 +0800

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")
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)

var&lev=new((/nlev/),"float")
var&lev=(/1000,925,850,700,600,500,400,300,250,200,150,100/)
var&time=fspan(date,date+nday-1,nday)
var&lat=fspan(-10,40,ny)
var&lon=fspan(90,270,nx)

var&lev_at_units="hpa"
var&lat_at_units="degrees_north"
var&lon_at_units="degrees_east"
var&time_at_units="days since 0000-01-01"

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
Received on Fri Nov 21 2008 - 19:39:43 MST

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