def NDVI(self): """The Normalized Difference Vegetation Index""" label1, label2 = lu.NDVI_BANDS[self.spacecraft] try: arr1 = self.__getattr__(label1).data arr2 = self.__getattr__(label2).data return ir.normdiff(arr1, arr2) except AttributeError: LOGGER.critical("Error accessing bands %s and %s " % (label1, label2) + "to calculate NDVI.") raise
def NDVI(self): """The Normalized Difference Vegetation Index""" label1, label2 = lu.NDVI_BANDS[self.spacecraft] try: arr1 = self.__getattr__(label1).data arr2 = self.__getattr__(label2).data return ir.normdiff(arr1, arr2) except AttributeError: LOGGER.critical( "Error accessing bands %s and %s " % (label1, label2) + "to calculate NDVI.") raise
def get_normdiff(self, label1, label2): """Calculate a generic normalized difference index Arguments: label1, label2 (str): valid band labels, usually of the form 'bandN' """ try: arr1 = self.__getattr__(label1).data arr2 = self.__getattr__(label2).data return ir.normdiff(arr1, arr2) except AttributeError: LOGGER.critical( "Error accessing bands %s and %s to calculate NBR." % (label1, label2)) raise
def get_NBR(self, reflectance=True): """The Normalized Burn Index""" label1, label2 = lu.NBR_BANDS[self.spacecraft] try: if reflectance: arr1 = self.__getattr__(label1).reflectance arr2 = self.__getattr__(label2).reflectance else: arr1 = self.__getattr__(label1).data arr2 = self.__getattr__(label2).data return ir.normdiff(arr1, arr2) except AttributeError: LOGGER.critical("Error accessing bands %s and %s " % (label1, label2) + "to calculate NBR.") raise
def get_NBR(self, reflectance=True): """The Normalized Burn Index""" label1, label2 = lu.NBR_BANDS[self.spacecraft] try: if reflectance: arr1 = self.__getattr__(label1).reflectance arr2 = self.__getattr__(label2).reflectance else: arr1 = self.__getattr__(label1).data arr2 = self.__getattr__(label2).data return ir.normdiff(arr1, arr2) except AttributeError: LOGGER.critical( "Error accessing bands %s and %s " % (label1, label2) + "to calculate NBR.") raise