import scipy.io code example
Example 1: save np array as mat file
scipy.io.savemat('test.mat', {'mydata': mydata})
Example 2: open mat file in python
#!python
#!/usr/bin/env python
from scipy.io import loadmat
x = loadmat('test.mat')
lon = x['lon']
lat = x['lat']
# one-liner to read a single variable
lon = loadmat('test.mat')['lon']