
Hi! I would need a little help on this: I want to read a set of images (raw bin data, unsigned int*8) and display them using xply.imagesc just to mae sure there have been no errors at downloding them. For each file, I'm doing the following: f =open("NDVI_GIMMS_8KM.8107","r") a=f.read() b = array(a,typecode=UnsignedInt8) b.shape = (2168,5004) xplt.imagesc(b) The problem is that, as the array "b" is very large, the display takes too long. Therefore, I'm trying to subsample b. I've tried with take(), but no luck. The question is, how could I select every i.e. 10th row and col from matrix b? Also, any other comment on improving what I want to do is welcome! (perhaps I can subsample at reading). Thanks Agus Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 alobo@ija.csic.es

how about: ... b.shape=(2168,5004) c = b[0:2168:8,0:5004:8] #this should subsample b every 8th point xplt.imagesc(c) ... Bryan On Mon, 2003-02-03 at 12:02, Agustin Lobo wrote:
Hi! I would need a little help on this:
I want to read a set of images (raw bin data, unsigned int*8) and display them using xply.imagesc just to mae sure there have been no errors at downloding them.
For each file, I'm doing the following:
f =open("NDVI_GIMMS_8KM.8107","r") a=f.read() b = array(a,typecode=UnsignedInt8) b.shape = (2168,5004) xplt.imagesc(b)
The problem is that, as the array "b" is very large, the display takes too long. Therefore, I'm trying to subsample b. I've tried with take(), but no luck. The question is, how could I select every i.e. 10th row and col from matrix b?
Also, any other comment on improving what I want to do is welcome! (perhaps I can subsample at reading).
Thanks
Agus
Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 alobo@ija.csic.es
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user -- Bryan Cole Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom. tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382

Thanks, why is it that, while xplt.imagesc(b[0:2168:8,0:5004:8]) and xplt.imagesc(b[0:2168:8,5004:0:-8]) display the image with a black background xplt.imagesc(b[2168:0:-8,0:5004:8]) displays it with a green background? (the background in the image has value 128, so it seems that somehow I change the lut). Agus Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 alobo@ija.csic.es On 3 Feb 2003, bryan cole wrote:
how about:
... b.shape=(2168,5004) c = b[0:2168:8,0:5004:8] #this should subsample b every 8th point xplt.imagesc(c) ...
Bryan
On Mon, 2003-02-03 at 12:02, Agustin Lobo wrote:
Hi! I would need a little help on this:
I want to read a set of images (raw bin data, unsigned int*8) and display them using xply.imagesc just to mae sure there have been no errors at downloding them.
For each file, I'm doing the following:
f =open("NDVI_GIMMS_8KM.8107","r") a=f.read() b = array(a,typecode=UnsignedInt8) b.shape = (2168,5004) xplt.imagesc(b)
The problem is that, as the array "b" is very large, the display takes too long. Therefore, I'm trying to subsample b. I've tried with take(), but no luck. The question is, how could I select every i.e. 10th row and col from matrix b?
Also, any other comment on improving what I want to do is welcome! (perhaps I can subsample at reading).
Thanks
Agus
Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 alobo@ija.csic.es
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user -- Bryan Cole Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom. tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user

Thanks,
why is it that, while
xplt.imagesc(b[0:2168:8,0:5004:8]) and xplt.imagesc(b[0:2168:8,5004:0:-8])
display the image with a black background
xplt.imagesc(b[2168:0:-8,0:5004:8])
displays it with a green background?
The image is always a byte array and what is plotted is a colormap of 240-255 different colors. Your image values are transformed into that range. If you would like a fixed range, then use cmax=<image value for highest color> and cmin=<image value for lowest color> as keywords to the imagesc plot. But, in your case, the data should be exactly the same (it's just given in a different order), so I'm not sure what is wrong. You can do source(xplt.imagesc) to see what is happening under the covers Also, xplt.ghelp('pli') can give you the Gist documentation on the underlying commands. This does seem like strange behavior. -Travis
participants (3)
-
Agustin Lobo
-
bryan cole
-
Travis Oliphant