Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
    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
Esempio n. 4
0
 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
Esempio n. 5
0
    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
Esempio n. 6
0
 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