Re: Error in reading binary data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 11 Jun 2007 09:52:55 -0600

Liang Guo wrote:
> Dear All,
>
> I have binary data "avedgn79_02.dat", the size is 192x94x28x6x12.
>
> I read it in ncl, the conmand is:
> ncl 0> cnvhr = fbinrecread ("./avedgn79_02.dat",0,(/28,94,192/),"float")
>
> The error massage is:
> warning:fbinrecread: size specified is greater than record size,
> filling with missing values
> fatal:fbinrecread: an error occurred reading the requested record.
> Something is wrong with the FORTRAN binary file.
> fatal:Execute: Error occurred at or near line 0
>
> What is wrong?
>
> Best,
> Liang
> 2007/06/11
> _______________________________________________
Well without more information, I can only speculate.

[a]
I assume that 192x94x28x6x12 is fortran ordering. so,
         x(192,94,28,6,12)

NCL uses C ordering. Hence, the same array would be referenced
in NCL via
         x(12,6,28,94,192)

the slowest varying subscript is the leftmost dimension in NCL, the rightmost is the fastest.

[b] Is the file a flat binary file created via, fortran *direct* access?
    *Direct* access means there are no imbedded record information
    as would be created by fortran *sequential* access.

    Direct access file:
; read the entire array
x = fbindirread("./avedgn79_02.dat",0,(/192,94,28,6,12/),"float")

; read the 1st 3D record
x = fbindirread("./avedgn79_02.dat",0,(/192,94,28/),"float")

; one 3D grid at time
do nr=0,71
 x= fbindirread("./avedgn79_02.dat",nr,(/192,94,28/),"float")
end do

====
[c] fortran sequentail
; one 3D grid at time
do nr=0,71
 x= fbinrecread("./avedgn79_02.dat",nr,(/192,94,28/),"float")
end do

====

Please note that fortran binary could be "little endian" or "big endian"
Please see
http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
if you need to inform NCL about this.

Goos luck
D

 

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 11 2007 - 09:52:55 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 18 2007 - 10:46:11 MDT