31def pt2fmt(pt):
32 fmttypes = {
33 gdalc.GDT_Byte: 'B',
34 gdalc.GDT_Int8: 'B',
35 gdalc.GDT_Int16: 'h',
36 gdalc.GDT_UInt16: 'H',
37 gdalc.GDT_Int32: 'i',
38 gdalc.GDT_UInt32: 'I',
39 gdalc.GDT_Float32: 'f',
40 gdalc.GDT_Float64: 'f'
41 }
42 if hasattr(gdalc, 'GDT_Float16'):
43 fmttypes[gdalc.GDT_Float16] = 'e'
44 return fmttypes.get(pt, 'x')
45