Пример #1
0
    def IRECI(self, out_raster=None):
        """
        Calculates IRECI index

        Parameters
        ----------
            out_raster : str, optional
                Output filepath for calculated TIFF.

        Returns
        -------
            equation : array
                Output array of the generated index.

        """
        gdal.PushErrorHandler('CPLQuietErrorHandler')
        gdal.UseExceptions()
        gdal.AllRegister()
        np.seterr(divide='ignore', invalid='ignore')

        bands = self.load_bands(['band_4'])
        band_5 = resample(self.path['band_5'], 10)
        band_6 = resample(self.path['band_6'], 10)
        band_7 = resample(self.path['band_7'], 10)

        equation = ((band_7 - bands['band_4']) / (band_5 / band_6))

        snap = self.path['band_4']

        if out_raster is not None:
            save_index(equation, out_raster, snap, gdal.GDT_Float32)
        return equation
Пример #2
0
    def AWEIsh(self, out_raster=None):
        """
        Calculates AWEIsh index

        Parameters
        ----------
            out_raster : str, optional
                Output filepath for calculated TIFF.

        Returns
        -------
            equation : array
                Output array of the generated index.

        """

        gdal.PushErrorHandler('CPLQuietErrorHandler')
        gdal.UseExceptions()
        gdal.AllRegister()
        np.seterr(divide='ignore', invalid='ignore')

        bands = self.load_bands(["band_2", "band_3", "band_8"])

        band_11 = resample(self.path['band_11'], 10)
        band_12 = resample(self.path['band_12'], 10)

        a = (bands["band_2"] + 2.5 * bands["band_3"] - 1.5 *
             (bands["band_8"] + band_11) - 0.25 * band_12)
        b = (bands["band_2"] + bands["band_3"] + bands["band_8"] + band_11 +
             band_12)
        equation = a / b

        snap = self.path['band_2']

        if out_raster is not None:
            save_index(equation, out_raster, snap, gdal.GDT_Float32)
        return equation
Пример #3
0
def test_resample():
    data = Sentinel(path)

    re_arr = resample(data.path['band_1'], 1, './tests/data/resample_test.tif')