Exemple #1
0
    def test_ndarray_no_blosc(self):
        args = dict(inputs=['landsat:LC08:PRE:TOAR:meta_LC80270312016188_v1'],
                    bands=['red', 'green', 'blue', 'alpha'],
                    resolution=960,
                    align_pixels=True)
        r, meta = self.raster.ndarray(**args)

        with mock.patch.object(descarteslabs.client.services.raster.raster,
                               "blosc", addons.ThirdParty("blosc")):
            r2, meta2 = self.raster.ndarray(**args)

        np.testing.assert_array_equal(r, r2)
        self.assertEqual(meta, meta2)
    def test_ndarray_no_blosc(self):
        args = dict(
            inputs=["landsat:LC08:PRE:TOAR:meta_LC80270312016188_v1"],
            bands=["red", "green", "blue", "alpha"],
            resolution=960,
            align_pixels=True,
        )
        r, meta = self.raster.ndarray(**args)

        with mock.patch.object(
                descarteslabs.client.services.raster.raster,
                "blosc",
                addons.ThirdParty("blosc"),
        ):
            r2, meta2 = self.raster.ndarray(**args)

        np.testing.assert_array_equal(r, r2)
        assert meta == meta2
    def test_ndarray_blosc(self):
        r, meta = self.raster.ndarray(inputs=['meta_LC80270312016188_v1'],
                                      bands=['red', 'green', 'blue', 'alpha'],
                                      resolution=960,
                                      align_pixels=True)

        old_blosc = addons.blosc
        addons.blosc = addons.ThirdParty("blosc")

        r2, meta2 = self.raster.ndarray(
            inputs=['meta_LC80270312016188_v1'],
            bands=['red', 'green', 'blue', 'alpha'],
            resolution=960,
            align_pixels=True)

        addons.blosc = old_blosc

        self.assertTrue((r == r2).all())
        self.assertEqual(meta, meta2)
    def test_raster_blosc(self):
        r = self.raster.raster(
            inputs=['meta_LC80270312016188_v1'],
            bands=['red', 'green', 'blue', 'alpha'],
            resolution=960,
        )

        old_blosc = addons.blosc
        addons.blosc = addons.ThirdParty("blosc")

        r2 = self.raster.raster(
            inputs=['meta_LC80270312016188_v1'],
            bands=['red', 'green', 'blue', 'alpha'],
            resolution=960,
        )

        addons.blosc = old_blosc

        self.assertEqual(r, r2)