Hi,

I'm trying to read TRMM precipitation data from a binary file that I
donwloaded from NASA's web site. The information I have about the file
is:

-----
Data are in 4-byte binary float from a SUN system (big-endian).
units are mm/hr, mm/6hr, mm/day, etc.

coverage is:
   60 to -60 lat
    0 to 360 long

at:
        .25 x .25 deg resolution

for:
        480 rows x 1440 cols

data is stored in C style row centric format.
The first value is centered at
        59.875,.125
the second value at
        59.875,.375
last 2 values are centered at:
        -59.875,359.625 &
        -59.875,359.875

sample matlab code:

function om = loadbfn(fn,dim,sz)
% loadbfn -- loads a binary file fn of dim
%       ([nrows ncols]) of sz 'float','int', etc.
%
%       by DKB on 2/5/96
%

if(nargin < 3)
        sz = 'float32';
end

f = fopen(fn,'r','b');

if(nargout > 0)
        om = fread(f,flipud(dim(:))',sz)';
end
fclose(f);

-----

My python code is:

>>> import uu
>>> infile = 
>>> 'F:\\Hanlie\\UCT\\M.Sc\\Data\\PERSIANN\\2009_10_PERS6hr\\ms6s4_6h0927400.bin'
>>> outfile = 
>>> 'F:\\Hanlie\\UCT\\M.Sc\\Data\\PERSIANN\\2009_10_PERS6hr\\ms6s4_6h0927400.txt'
>>> uu.decode(infile,outfile)

Which produces the error:

Traceback (most recent call last):
  File "<pyshell#23>", line 1, in <module>
    uu.decode(infile,outfile)
  File "F:\Python26\lib\uu.py", line 98, in decode
    raise Error('No valid begin line found in input file')
Error: No valid begin line found in input file


Can someone perhaps help me?

Thanks
Hanlie

Reply via email to