writing binary to nc file problem

From: Ioana Colfescu <colfescu_at_nyahnyahspammersnyahnyah>
Date: Sun Jul 18 2010 - 19:45:37 MDT

Hi,

I try to read a binary file using NCL and then write it to an nc file. I seems that I do something wrong since the file I get though is written is empty - there are no values there.
Could someone give me a hint what I might do wrong and how could I solve it ? My code is the following (and the dimensions of the variables etc are correct in the code so the pb is not from there).

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
    nlat = 128
    nlon = 256
    zlev = 8
    time = 12
    fils = systemfunc("ls noiseb30.bin")
    finarr = new((/time,zlev,nlat,nlon/),"float")
  
    finarr!0 = "time"
    finarr&time = (/0,1,2,3,4,5,6,7,8,9,10,11/)
    finarr!1="zlev"
    finarr&zlev=(/1000., 850., 700., 500. ,300. ,200., 100., 50./)
    finarr&zlev@units="milibars"
    finarr!2 = "lat"
    finarr&lat = (/-88.9277353522959,-87.5387052130273,-86.1414721015279,-84.7423855907142, -83.3425960440704, -81.9424662991732,-80.5421464346171, -79.1417096486217, -77.7411958655139,-76.3406287023715, -74.9400230196494, -73.5393886337675,-72.1387322891624, -70.7380587725176, -69.3373715749609,-67.9366733025785, -66.5359659401756, -65.1352510260352,-63.7345297708429, -62.3338031405324, -60.9330719152074,-59.5323367318266, -58.1315981156439, -56.7308565037137,-55.3301122627028, -53.9293657025561, -52.5286170870997,-51.1278666423533, -49.7271145631097, -48.3263610181882,-46.9256061546646, -45.5248501013023, -44.1240929713558,-42.723334864877, -41.3225758706231, -39.9218160676465,-38.5210555266244, -37.1202943109789, -35.719532477824,-34.3187700787707, -32.918007160614, -31.5172437659226,-30.1164799335463, -28.7157156990552, -27.3149510951204,-25.9141861518467, -24.5134208970629, -23.1126553565776,-21.7118895544042, -20.3111235129604, -18.9103572532454, -17.5095907949986, -16.
 1088241568413, -14.7080573564048,-13.3072904104462, -11.9065233349538, -10.5057561452436, -9.10498885604852, -7.70422148160049, -6.3034540357076,-4.90268653182654, -3.5019189831313, -2.10115140257898,-0.700383802973324, 0.700383802973324, 2.10115140257898,3.5019189831313,4.90268653182654, 6.3034540357076, 7.70422148160049, 9.10498885604852,10.5057561452436, 11.9065233349538, 13.3072904104462, 14.7080573564048,16.1088241568413, 17.5095907949986, 18.9103572532454, 20.3111235129604,21.7118895544042, 23.1126553565776, 24.5134208970629, 25.9141861518467,27.3149510951204, 28.7157156990552, 30.1164799335463, 31.5172437659226,32.918007160614, 34.3187700787707, 35.719532477824, 37.1202943109789,38.5210555266244, 39.9218160676465, 41.3225758706231, 42.723334864877,44.1240929713558, 45.5248501013023, 46.9256061546646, 48.3263610181882, 49.7271145631097, 51.1278666423533, 52.5286170870997, 53.9293657025561,55.3301122627028, 56.7308565037137, 58.1315981156439, 59.5323367318266, 60.933071
 9152074, 62.3338031405324, 63.7345297708429, 65.1352510260352,66.5359659401756, 67.9366733025785, 69.3373715749609, 70.7380587725176,72.1387322891624, 73.5393886337675, 74.9400230196494, 76.3406287023715,77.7411958655139, 79.1417096486217, 80.5421464346171, 81.9424662991732,83.3425960440704, 84.7423855907142, 86.1414721015279, 87.5387052130273,88.9277353522959 /)
    finarr&lat@units = "degrees_north"
    finarr!3 = "lon"
    finarr&lon = ispan(0,nlon-1,1)*1.40625
    finarr&lon@units = "degrees_east"
    a = addfile("noise1yr.nc","c") ; write netCDF file
    a@title = "1 year of montlhy data of noise generated using noise.scr ... "
    a@source = "CAM runs ... "
    filedimdef(a,"time",-1,True)
    a->nhfn = finarr
    a->nsfn = finarr
    a->zfsn = finarr
    a->mwsn = finarr
    a->fwfn = finarr
   end

                                                                                                                                                                

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jul 18 19:45:42 2010

This archive was generated by hypermail 2.1.8 : Mon Jul 19 2010 - 09:39:01 MDT