I write a binary data into a netcdf data .But , the nc can't be opened in Grads.

From: lxf <heaven_bird334_at_nyahnyahspammersnyahnyah>
Date: Tue, 6 Jun 2006 22:47:02 +0800

Hi,

         I read a binary data "u.nc" and wrote it into a netcdf data "uuu.nc" in an efficient way . But ,The "uuu.nc" can't be opened in Grads:
       "-> sdfopen uuu.lxf.nc
       Scanning self-describing file: uuu.nc
       SDF file has no discernable X coordinate."
    
    I just can't find out the reason.
    Any suggestion are much appreciated!

=============================================================
    The following is result of "% ncl -x uuu.ncl > info.txt "
-------------------------------------------------------------
"info.txt" :

 Copyright (C) 1995-2006 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 4.2.0.a033
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
+ begin
+ dir="./"
+ in=systemfunc("ls "+dir+"u.grd")
+ u = fbindirread(in,0,(/244,12,73,144/),"float")
+
+ ;=============================
+ ; create coordinate variables
+ ;============================
+ lon=fspan(0,357.5,144)
+ lon!0 = "lon"
+ lon_at_long_name = "longitude"
+ lon_at_units = "degrees_east"
+ lon&lon = lon
+
+ lat=fspan(-90,90,73)
+ lat!0 = "lat"
+ lat_at_long_name = "latitude"
+ lat_at_units = "degrees_north"
+ lat&lat = lat
+
+ lev=(/89,726,1408,2945,4136,5505,7121,9102,10308,11752,13577,16088/)
+ lev!0 = "lev"
+ lev_at_long_name = "level"
+ lev_at_units = "m"
+ lev&lev = lev
+
+ time=ispan(17552832,17554290,6)*1d0
+ time!0 = "time"
+ time_at_long_name = "time"
+ time_at_units = "hours since 1-1-1 00:00:0.0"
+ time&time = time
+
+ u!0 = "time"
+ u!1 = "lev"
+ u!2 = "lat"
+ u!3 = "lon"
+
+ u&time = time
+ u&lev = lev
+ u&lat = lat
+ u&lon = lon
+
+ ;=============================
+ system("rm -f uuu.lxf.nc")
+ fout=addfile("uuu.lxf.nc","c")
+ setfileoption(fout,"DefineMode",True)
+
+ ;creat global attributes
+ fileAtt = True
+ fileAtt_at_creation_date = systemfunc("date")
+ fileAtt_at_title = "efficient write netcdf data "
+ fileattdef(fout,fileAtt)
+
+ ;predefine coordinate variables
+ dimNames = (/"time","lev","lat","lon"/)
+ dimSizes = (/-1,12,73,144/)
+ dimUnlim = (/True,False,False,False/)
+ filedimdef(fout,dimNames,dimSizes,dimUnlim)
+
+ ;predefine variable names,type,and dimensions
+ filevardef (fout,"time",typeof(time),"time")
+ filevardef (fout,(/"lev"/),(/typeof(lev)/),(/"lev"/))
+ filevardef (fout,(/"lat"/),(/typeof(lat)/),(/"lat"/))
+ filevardef (fout,(/"lon"/),(/typeof(lon)/),(/"lon"/))
+ filevardef (fout,(/"uwnd"/),(/"float"/),(/"time","lev","lat","lon"/))
+
+ ;create var attributes for each variable
+ u_at_long_name = "4xDaily u-wind"
+ u_at_units = "m/s"
+ u_at_missing_value = 32766
+ u@_FillValue = u_at_missing_value
+ filevarattdef(fout,"uwnd",u)
+
+ printVarSummary(u)
+
+ ;output data values only
+ fout->time = (/time/)
+ fout->lev = (/lev/)
+ fout->lat = (/lat/)
+ fout->lon = (/lon/)
+ fout->uwnd = (/u/)
+
+ system("ncl_filedump uuu.nc")
+ end
 Copyright (C) 1995-2006 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 4.2.0.a033
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
Variable: f (file variable)

filename: uuu.lxf
path: uuu.lxf.nc
   file global attributes:
      title : efficient write netcdf data
      creation_date : Tue Jun 6 22:33:42 CST 2006
   dimensions:
      time = 244 // unlimited
      lev = 12
      lat = 73
      lon = 144
   variables:
      double time ( time )

      integer lev ( lev )

      float lat ( lat )

      float lon ( lon )

      float uwnd ( time, lev, lat, lon )
         _FillValue : 32766
         missing_value : 32766
         units : m/s
         long_name : 4xDaily u-wind

 
 Copyright (C) 1995-2006 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 4.2.0.a033
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: u
Type: float
Total Size: 123116544 bytes
            30779136 values
Number of Dimensions: 4
Dimensions and sizes: [time | 244] x [lev | 12] x [lat | 73] x [lon | 144]
Coordinates:
            time: [17552832..17554290]
            lev: [89..16088]
            lat: [-90..90]
            lon: [ 0..357.5]
Number Of Attributes: 4
  _FillValue : 32766
  missing_value : 32766
  units : m/s
  long_name : 4xDaily u-wind

=================================================================
Yours,
Li

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 06 2006 - 08:47:02 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 06 2006 - 14:11:24 MDT