On 11 May 2011 11:42, fReeq <[email protected]> wrote:
>> # if this call to reshape fails then the binary file probably
>> # contains some header information.
>> # Try calling 'print data_string[:2880]' to see
>> # if there's any text there. I'm guessing the 2880 but
>> # you should be able to get the right number by reading
>> # documentation on the file format
>> precip.reshape((480, 1440))
>
> Hey there!
>
> TRMM data have header information and the 2880 is the right
> guess! ...thats what I found out so far before reading your thread.
> But how to proceed with the header? If I simply erase it from the .bin
> file, phyton has the following error: "ValueError: string size must be
> a multiple of element size".
> Meanwhile I tried the same with PERSIANN data. They have no header and
> the method u describe works fine.
> Thank u very much for that already!
>
> Well, if anybody has a solution or another way to convert TRMM data I
> would be glad to hear about it.
>
> Best regards,
> F#

It's very hard to tell what your problem is without seeing the code,
or knowing what TRMM data product you are trying to read. You can try
the code posted here http://goo.gl/1eRR8 and see if that works for
you. The main issue I guess you're encountering is that the fields in
the TRMM data files are stored as either 16-bit or 8-bit integer
types, you'll need to read the correct portion of the binary string
into a Numpy array using numpy.fromstring - then convert to float
(numpy.asarray) and scale the data where relevant.

I'm posting this to the mailing list, as that's better than a direct
e-mail discussion.

Cheers,
Scott

Reply via email to