235def pt2numpy(pt):
236 """Translate GDAL data type to NumPy data type"""
237 ptnumpy = {
238 gdalc.GDT_Byte : numpy.uint8,
239 gdalc.GDT_Int16 : numpy.int16,
240 gdalc.GDT_UInt16 : numpy.uint16,
241 gdalc.GDT_Int32 : numpy.int32,
242 gdalc.GDT_UInt32 : numpy.uint32,
243 gdalc.GDT_Float32: numpy.float32,
244 gdalc.GDT_Float64: numpy.float64
245 }
246 if hasattr(gdalc, 'GDT_Float16'):
247 ptnumpy[gdalc.GDT_Float16] = numpy.float16
248 return ptnumpy.get(pt, numpy.uint8)
249