On Wed, 16 Dec 2015 13:19:26 -0200, jorge.conr...@cptec.inpe.br wrote: > > I dowmloaded some data from the Mirador NASA site: > > http://mirador.gsfc.nasa.gov/cgi-bin/mirador/presentNavigation.pl?tree=project&dataset=Global-merged%20IR%20Brightness%20Temperature%20Data&project=TRMM&dataGroup=Ancillary&version=001&CGISESSID=97f4b9244878c87819b2a1144d31e270 > > Each data have the dimension: 9896 x 3298 byte. > > I used to read the command : > > f = open('merg_2015110500_4km-pixel', mode='rb') > > image = f.read() > > Please, what can I do to visualize this data.
You provide a URL to a web page, but you're opening a file. Can you tell us what kind of file you downloaded? I grabbed a random file from that site, and it arrived with the name "merg_2015120123_4km-pixel.Z". After I ran "uncompress" on it, it was named "merg_2015120123_4km-pixel", which looks much like your filename, so I guess this is what you've done. When I dump it as bytes, I get a lot of this: 00000100 ff ff c0 c0 c1 c2 c2 c2 c2 c3 c3 c3 c3 c4 c4 c3 00000110 c3 c3 c1 c1 c0 c0 ff ff ff ff ff ff ff ff c1 c1 00000120 c3 c4 c4 c4 c3 c3 c3 c3 c1 ff ff ff ff ff ff ff 00000130 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00000140 ff ff ff ff ff ff ff c0 c0 c1 c3 c3 c3 c3 c4 c4 00000150 c4 c4 c4 c3 c3 c3 c4 c4 c3 c3 c3 c3 c3 c3 c3 c3 00000160 c4 c4 c4 c4 c4 c5 c5 c6 c7 c7 c7 c7 c5 c5 c5 c6 00000170 c6 c6 c6 c6 c4 c4 c4 c4 c4 c3 c3 c3 c3 c3 c3 c3 00000180 c2 c2 c2 c3 c3 c3 c4 c4 c4 c4 c4 c4 c4 c5 c5 c6 00000190 c6 c6 c6 c6 c6 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 000001a0 c7 c7 c7 c8 c8 c8 c8 c8 c9 c9 c9 c9 c9 c9 c9 c9 The file is 65274016 bytes long. You claim the dimensions are 9896 x 3298, but that comes out to half that number (32637008), so I'll bet the real dimensions are 9896 x 6596, with one byte per pixel. I think this image format is called "raw". I haven't the time and expertise to settle this for you, but the solution is probably going to look something like this: >>> rawdata = open("merg_2015120123_4km-pixel", "rb").read() >>> from PIL import Image >>> img = Image.fromstring("L", (9896, 6596), rawdata) >>> img.save("temp.png") -- To email me, substitute nowhere->runbox, invalid->com. -- https://mail.python.org/mailman/listinfo/python-list