[Gdal-dev] ReadAsArray()

Gong, Shawn (Contractor) Shawn.Gong at drdc-rddc.gc.ca
Mon Mar 19 11:02:25 EDT 2007


Hi list,

I have questions regarding ReadAsArray()

Here is the code:
    msi_array = gdal_dataset.ReadAsArray().astype(Numeric.Float32)

Q1: what is msi_array?  Is it a Numeric array?

Q2: printing out "print msi_array" generates a three-dimensional array
(or list?)
[ [ [0 1 2 up to col] ... ... up to row] ... up to bands]
What function to call if I want to get a number of subarrays like:
	R = #1 band and 100x50 pixels
	G = #2 band and 100x50 pixels

I have used
    r = msi_array[0:row][0:col][int(r_band)-1]
    g = msi_array[0:row][0:col][int(g_band)-1]
b = msi_array[0:row][0:col][int(b_band)-1]
but it did not for the cases when row > col, what I got is 
r = msi_array[0:col][0:col], etc.

Thanks,
Shawn


                 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070319/f47804bd/attachment.html


More information about the Gdal-dev mailing list