matplotlib and large array

One workaround is to try converting it to a PIL image first.

For whatever reason, imshow chokes on large arrays, but handles PIL images of the same array just fine.

However, you’ll need to set the colormap and such through PIL, which can be a bit frustrating if you’re unfamiliar with it. Also, you’ll quite likely need to rescale your data if it’s a float.

Hope that points you in the right direction, anyway…

-Joe

···

On Wed, Jun 9, 2010 at 1:31 PM, Massimo Di Stefano <massimodisasha@…287…> wrote:

Hi All,

i need to work with a relative large images “60 mb” (single band geotiff file)

i store it in python as a numpy array using python-gdal,

the array dinension is (7173 X 7924) single band image,

but tring to display it with matshow/imageshow

or other matplotlib functions i have that python freeze itself and is not able to load the image.

if i use a subset of the image, i 'm able to display it

or at least i hade to reduce its resolution using hacks like :

reduced_array = array[::3,::3]

i don’t need full resolution dataset when the image is displaied with a full “zoom out”

so the reduction " reduced_array = array[::3,::3] " is good to show the complete image

but when i zoom in the image i obviously lost data (less resolution)

what do you use to display large dataset ?

i’m thinking about a “piramid” with multy array based on the different zoom levels

… but maybe this idea is not so cool.

someone already has developed similar code ?

thanks to All for any suggestion!

Regards,

Massimo


ThinkGeek and WIRED’s GeekDad team up for the Ultimate

GeekDad Father’s Day Giveaway. ONE MASSIVE PRIZE to the

lucky parental unit. See the prize list and enter to win:

http://p.sf.net/sfu/thinkgeek-promo


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users