Reading and displaying a MODICE image


In [1]:
%pylab inline
import numpy as np
from PIL import Image


Populating the interactive namespace from numpy and matplotlib

Using PIL's Image function, and convert to nparray:


In [14]:
im = Image.open('MODICE.v0.4.h23v05.2001.3strike.landice.tif')
imarray = np.array(im)
print imarray.shape
print type( imarray )


(2400, 2400)
<type 'numpy.ndarray'>

Or use pyplot (which apparently uses PIL under-the-hood


In [7]:
import matplotlib.pyplot as plt
I = plt.imread('MODICE.v0.4.h23v05.2001.3strike.landice.tif')

In [8]:
type(I)


Out[8]:
numpy.ndarray

In [9]:
diff = I - imarray

In [11]:
plt.imshow(imarray)
plt.gray()
plt.show()



In [ ]: