def _image_class(cls, rec, **kwargs): try: cat_id = rec['properties']['attributes']['catalogID'] except: cat_id = None types = rec['properties']['item_type'] if 'WV02' in types: return WV02(cat_id, **kwargs) elif 'WV01' in types: return WV01(cat_id, **kwargs) elif 'WV03_VNIR' in types: return WV03_VNIR(cat_id, **kwargs) elif 'WV03_SWIR' in types: return WV03_SWIR(cat_id, **kwargs) elif 'WV04' in types: return WV04(cat_id, **kwargs) elif 'Landsat8' in types: return LandsatImage(rec['properties']['attributes']['productID'], **kwargs) elif 'GE01' in types: return GE01(cat_id, **kwargs) elif 'IKONOS' in types: return IkonosImage(rec, **kwargs) elif 'QB02' in types: return QB02(cat_id, **kwargs) elif 'SENTINEL2' in types: return Sentinel2(rec['properties']['attributes']['bucketPrefix'], **kwargs) elif 'RADARSAT2': return Radarsat(rec, **kwargs) else: raise UnsupportedImageType('Unsupported image type: {}'.format( str(types)))
def _image_class(cls, cat_id, rec, **kwargs): types = rec['properties']['item_type'] if 'WV02' in types: return WV02(cat_id, **kwargs) elif 'WV01' in types: return WV01(cat_id, **kwargs) elif 'WV03_VNIR' in types: return WV03_VNIR(cat_id, **kwargs) elif 'WV03_SWIR' in types: return WV03_SWIR(cat_id, **kwargs) elif 'Landsat8' in types: return LandsatImage(cat_id, **kwargs) elif 'GE01' in types: return GE01(cat_id, **kwargs) elif 'IKONOS' in types: return IkonosImage(rec, **kwargs) elif 'QB02' in types: return QB02(cat_id, **kwargs) else: raise UnsupportedImageType('Unsupported image type: {}'.format( str(types)))