Re: read binary data for integer and float types

From: <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 19 2010 - 19:03:02 MST

This is not clear.

Are you sure the file was created with "direct" writing?

Or, was it created with a fortran sequential write

    integer i1, i2
    real x(ii,jj)

    write(iunit) i1, i2, x

If the latter, then use fbinrecread

    irec = fbinrecread("data.bin",0, ii*jj+2,"integer")
    i1 = irec(0)
    i2 = irec(1)

    rec = fbinrecread("data.bin",0, ii*jj+2,"float")
    data = onedtond( rec(2:), (/jj,ii/) )

> Hi,
>
> I have following script to read binary data in integer/float type.
>
> two = new(2,"integer")
> ;two = fbindirread("data.bin",0,2,"integer")
> jj = 67
> ii = 43
> rf = new((/jj,ii/),"float")
> rf = fbindirread("data.bin",0,(/jj,ii/),"float")
>
> Question (1),
>
> Can fbindirread work without "(/jj,ii/)"? I tried and failed without it.
>
> Question (2),
>
> How can jj and ii be read from data.bin and then used to define jj and ii
> for rf = new(xxx) ?
>
> Either
> two = fbindirread("data.bin",0,2,"integer")
> or
> rf = fbindirread("data.bin",0,(/jj,ii/),"float")
> works well separately.
>
> But they do not work together (change 0 to 1 in rf line when both
> applied).
>
> Thanks
>
> Yongzuo
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 19 19:04:49 2010

This archive was generated by hypermail 2.1.8 : Thu Jan 21 2010 - 13:54:45 MST