Re: irregular binary files

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat Oct 02 2010 - 16:19:46 MDT

Maybe ..., let N be the largest possible size (depth) or just some
very large number.

=======================
; generate a test binary
    x1 = (/ 10.2, 10.1, 9.5, 8.4 /)
    x2 = (/ 12.1,12.0,10.0,9.0,8.6,7.5,6.5 /)
    x3 = (/ 182./)

    filo = "foo.bin"
    system("/bin/rm -f "+filo)

    fbinrecwrite (filo, -1, x1)
    fbinrecwrite (filo, -1, x2)
    fbinrecwrite (filo, -1, x3)

; read the test binary

    N = 10 ; some 'big' number [max depth]
    nLake = 3
    tlake = new ( (/nLake,N/), "float", -999.)

    do n=1,nLake
       work = fbinrecread(filo, (n-1), -1, "float")
       lwork = dimsizes(work)
       tlake(n-1,0:lwork-1) = work
       delete(work) ; may change size the next iteration
    end do

    print(tlake)

==========================
On 10/2/10 12:47 PM, Michael Notaro wrote:
> Any suggestions?
>
>
>
>
> Can NCL read a binary file with different #s of values on each line?
>
> For example, I have a binary file written with fortran where each
> row has a different # of values. Lets say I have 100 different lake
> points, each with different depths, and on each row is the temperature
> of the each at 1-meter increments. Something like this:
>
> 10.2 10.1 9.5 8.4
> 12.1 12.0 10.0 9.0 8.6 7.5 6.5
> etc...
>
> The 1st lake is 4-m deep so it has 4 values.
> The 2nd is 7-m deep so it has 7 values.
> Etc.
>
> Or is this too irregular for NCL to handle.
>
> Michael
> _______________________________________________
> 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 Sat Oct 2 16:19:51 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:54 MDT