我不熟悉 GeoTIFF 信息,但对于存储平面数据,我强烈推荐hdf5格式,它有一组很好的 python 绑定,称为h5py。这是一个简单的示例,展示了使用它是多么容易:
>>> import h5py
>>> f = h5py.File('data.hdf5')
>>> a = np.arange(12.0).reshape((4,3))
>>> a
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., 7., 8.],
[ 9., 10., 11.]])
>>> f.create_dataset('array', data=a)
<HDF5 dataset "array": shape (4, 3), type "<f8">
>>> f['array'].attrs['info'] = 'some data I want to store'
>>> f['array'].attrs['date'] = (6, 21, 2012)
>>> f.close()
>>> f = h5py.File('data.hdf5')
>>> f['array']
<HDF5 dataset "array": shape (4, 3), type "<f8">
>>> f['array'].value
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., 7., 8.],
[ 9., 10., 11.]])
>>> f['array'].attrs['info']
'some data I want to store'
>>> f['array'].attrs['date']
array([ 6, 21, 2012])