Hi,
Taday I have a binary reading problem when using "fbindiread" function .
So I design a test as following to read a "direct" "unformated" binary data "t.grd".
I think that when give "dims" to the function "fbindirread(path, nrec, dims, "float")" , the record number is then determined by the as :
number of record = (data's legth)/dims
So, I think I can read the data segment which I want without read the whole data. But the following script "t.ncl" and it's result puzzled me:
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
The following is the output of "% ncl -x t.ncl" :
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Copyright (C) 1995-2007 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 4.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
+ begin
+ a = new((/2/),float)
+ b = ispan(1,10,1)*1.
+ print (b)
+ print ("")
+ fbindirwrite("./t.grd",b)
+
+ do nrec=0,4
+ a = fbindirread("./t.grd",nrec,2,"float")
+ print("nrec="+nrec+ " "+a(0)+ " "+a(1))
+ end do
+
+ end
Variable: b
Type: float
Total Size: 40 bytes
10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 1
(1) 2
(2) 3
(3) 4
(4) 5
(5) 6
(6) 7
(7) 8
(8) 9
(9) 10
(0)
(0) nrec=0 1 2
(0) nrec=1 3 4
(0) nrec=2 5 6
(0) nrec=3 1 2 ; Here I had suposed the third record to be "7 8" ,but it was "1 2"
(0) nrec=4 3 4 ; Here I had suposed the third record to be "9 10" ,but it was "3 4"
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Any help is appreciated.
Li
2006.6.21
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 21 2007 - 07:53:29 MDT
This archive was generated by hypermail 2.2.0 : Fri Jun 22 2007 - 07:01:57 MDT