Re: Reading Binary files with mixed-dimensions

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 23 Jan 2008 17:17:27 -0700

DavidP

To illustrate what DaveA is asking about

fortran
      parameter (ntim=10, imax=20, jmax=30)
      integer a(ntim)
      real b(imax,jmax), c(imax,jmax), d(imax,jmax,ntim)
c fortran default is sequential

[1]
       write(10) a
       write(10)b
        write(10)c
        write(10)d
    

        setfileoption("bin","ReadByteOrder","BigEndian")
        ntim = 10
        imax = 20
        jmax = 30
        a = fbinrecread (fili, 0, ntim, "integer")
        b 1, (/jmax,imax/), "float")
        c 2,
        d 3, (/ntim,jmax,imax/) )

[2]
      write(10) a
      write(10) b,c
      write(10) d

       bc = fbinrecread (fili, 1, (/2,jmax,imax/), "real")
       b = bc(0,:,:)
       c = bc(1,:,:)
      
Dave Allured wrote:
> Dave,
>
> Can you be more specific as to the type of binary file? Fortran
> "unformatted sequential access"; plain binary such as written by
> Fortran direct access; or something else? I just want to be sure I'm
> on the right wavelength before responding.
>
> Also, assuming one of the first two: So the record length varies
> within each file? Does each file have its own unique layout, or is
> each variable found in exactly the same position in every file?
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/
>
> David F Porter wrote:
>> Sorry if this has been covered, by I've exhausted the search function
>> with no real results.
>>
>> I am looking to read in some large 4-Byte Float big-endian binary
>> data onto my little-endian machine. The problem I am having is that
>> each file corresponds to ONE time period, but each variable in the
>> file has different dimensions, some 2D and some 3D. Because of the
>> varying sizes, I feel that I cannot simply use the "record number".
>> Also, I only want some of the variables (to save space after loading
>> 300 of these files).
>>
>> I'm not sure if it matters at this point, but the variables are on a
>> gaussian grid.
>>
>> Dave
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 23 2008 - 17:17:27 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 28 2008 - 17:01:44 MST