Re: Read binary file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 05 2010 - 14:27:44 MDT

[1]
*You* must uncompress the file: gunzip, .....

[2]
  Was this written with fortran sequential write ( default)
or
  Was it written via fortran direct access or C

[3]
  It is not clear what the ordering should be

[4]
Try some variant of

    setfileoption("bin","ReadByteOrder","LittleEndian")
    x = fbinrecread (fili, 0, (/12,2160,4320/), "float")
    print("min(x)="+min(x)+" max(x)="+max(x))

Does this look reasonable?

Maybe the dimensioning should be: (/2160,4320,12/) or ???

[5]
Please read the following:

  http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/fdirrecread.shtml

On 11/05/2010 01:39 PM, Lei Meng wrote:
> Hi,
> I have not used ncl to read binary file (not familiar with binary
> file either) . I have the following information on the binary data
> format, can I use ncl to read it?
> ______________________
> The files (one per crop class, separately for irrigated and for rainfed
> crops)
> are compressed (gnu-zip format) versions of binary files containing
> 4-byte floating point values.
> The data were generated on a x86 (IBM-PC) low-endian system. Users of
> high-endian systems
> (e.g. SPARC) need to convert the data by switching the bytes.
>
> Each file contains for each of the 4320 x 2160 grid cells 12 values
> indicating the monthly
> growing area in hectare. Value at position number 15 would therefore
> represent the growing area
> of the second cell in the first row in March. The cell order is from
> North to South and West to East.
> Total necessary disk space for each decompressed file is 4320 x 2160 x
> 12 x 4 = 447,897,600 bytes.
> ________________________
> Thanks for your help in advance,
> Lei
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> 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
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 5 14:27:49 2010

This archive was generated by hypermail 2.1.8 : Mon Nov 08 2010 - 08:08:50 MST