def __init__(self, product_id): product_id = product_id.strip() super(Sentinel2, self).__init__(product_id) id_len = self.check_id(product_id) if id_len is 'short': _idlist = product_id.split('_') self.year = _idlist[3][:4] self.doy = julian_from_date(self.year, _idlist[3][4:6], _idlist[3][6:8]) self.julian = self.year + self.doy self.tile = _idlist[1] elif id_len is 'long': self.year = product_id[25:29] self.doy = julian_from_date(self.year, product_id[29:31], product_id[31:33]) self.julian = self.year + self.doy self.tile = product_id[66:71] else: msg = 'the Sentinel-2 product_id {} does not match any expected pattern'.format( product_id) logger.exception(msg) raise ProductNotImplemented(product_id)
def __init__(self, product_id): product_id = product_id.strip() super(Landsat, self).__init__(product_id) # only the collections product ids include underscores if '_' in product_id: # lt05_l1tp_042034_20011103_20160706_01_a1 _idlist = product_id.split('_') self.year = _idlist[3][:4] self.doy = julian_from_date(_idlist[3][:4], _idlist[3][4:6], _idlist[3][6:8]) self.julian = self.year + self.doy self.path = _idlist[2][:3].lstrip('0') self.row = _idlist[2][3:].lstrip('0') self.correction_level = _idlist[1] self.collection_number = _idlist[-2] self.collection_category = _idlist[-1] self.lta_json_name = self.lta_json_name.format(collection=int(self.collection_number)) else: self.path = product_id[3:6].lstrip('0') self.row = product_id[6:9].lstrip('0') self.year = product_id[9:13] self.doy = product_id[13:16] self.julian = product_id[9:16] self.station = product_id[16:19] self.version = product_id[19:21]
def __init__(self, product_id): product_id = product_id.strip() super(Landsat, self).__init__(product_id) _idlist = product_id.split('_') self.year = _idlist[3][:4] self.doy = julian_from_date(_idlist[3][:4], _idlist[3][4:6], _idlist[3][6:8]) self.julian = self.year + self.doy self.path = _idlist[2][:3].lstrip('0') self.row = _idlist[2][3:].lstrip('0') self.correction_level = _idlist[1] self.collection_number = _idlist[-2] self.collection_category = _idlist[-1] self.lta_json_name = self.lta_json_name.format(collection=int(self.collection_number))