how to read from many binary files:

From: Li Tao (taoli AT hawaii.edu)
Date: Mon Jan 17 2005 - 21:14:42 MST


Hi,

     I am a new user of NCL.

    I try to read many x-y dimension binary files named with date, then
write them into nc format, I have three questions.
    
    First question, I try read one file, and write out one vairable. I
use Grads to visialize the plot , the error message is following:

Scanning self-describing file: rain.nc
SDF file has no discernable X coordinate.

     The following is my ncl file:

_______________________________________________

  begin
   nlat = 720
   mlon = 1440
     file_in = "/disk/ide41/yzhang/AMSR_E/amsre_20040601v4_d3d"
     SST = fbindirread (file_in,0, (/nlat,mlon/),"byte")
     WSPD = fbindirread (file_in,1, (/nlat,mlon/),"byte")
     VAPOR = fbindirread (file_in,2, (/nlat,mlon/),"byte")
     CLOUD = fbindirread (file_in,3, (/nlat,mlon/),"byte")
     RAIN = fbindirread (file_in,4, (/nlat,mlon/),"byte")

 ;==========================================
 ; Create lon and lat coordinates variables
 ; use functions in contributed.ncl
 ;==========================================
 ; lat = latGlobeF (nlat, "lat", "latitude", "degrees_north")
 ; lon = lonGlobeF (mlon, "lon", "longitude", "degrees_east")
   lat = fspan (-89.875,89.875,nlat)
   lon = fspan (0.125,359.875,mlon)

;creat output variables with proper dimensions
    SST!0 ="lat" ; name dimensions
    SST!1 ="lon"
    SST&lat = lat ; assign coordinate values and units
    SST&lon = lon
    SST@long_name ="sea surface temperature*0.15-3.0"
    SST@units ="deg C"
    printVarSummary(SST)

    WSPD!0 ="lat" ; name dimensions
    WSPD!1 ="lon"
    WSPD&lat = lat ; assign coordinate values and units
    WSPD&lon = lon
    VAPOR!0 ="lat" ; name dimensions
    VAPOR!1 ="lon"
    VAPOR&lat = lat ; assign coordinate values and units
    VAPOR&lon = lon
    VAPOR@long_name ="atmospheric water vapor*0.3"
    VAPOR@units ="mm"
    printVarSummary(VAPOR)

    CLOUD!0 ="lat" ; name dimensions
    CLOUD!1 ="lon"
    CLOUD&lat = lat ; assign coordinate values and units
    CLOUD&lon = lon
    CLOUD@long_name ="cloud liquid water*0.01"
    CLOUD@units ="mm"
    printVarSummary(CLOUD)

    RAIN!0 ="lat" ; name dimensions
    RAIN!1 ="lon"
    RAIN&lat = lat ; assign coordinate values and units
    RAIN&lon = lon
    RAIN@long_name ="rain rate*0.1"
    RAIN@units ="mm/hr"
    printVarSummary(RAIN)

;=======================
; draw variable
;=======================
; wks=gsn_open_wks("x11","example")
; res = True
; plot=gsn_csm_contour_map(wks,rain,res)

    fout = addfile ("./rain.nc","w")
    fout ->SST = SST
   end

____________________________________________________
  
    

    second question, I try to read many binary files which named with
date such as amsre_20040601v4_d3d, how can I do?

    Third question, the value of missing data is from 251 to 255, I try
to change 255 to -9999.9 and change 251, 252, 253, 254 as missing data
with same value, May I use ncl to do this?

    Could anyone help me?

   Thanks and regards!

Li Tao

_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Tue Jan 18 2005 - 07:19:07 MST