def test_download_as_catalog(self):
        input = self.create_spacetime_layer()

        imagecollection = GeotrellisTimeSeriesImageCollection(
            gps.Pyramid({0: input}), InMemoryServiceRegistry())
        imagecollection.download("catalogresult.tiff",
                                 format="GTIFF",
                                 parameters={"catalog": True})
    def test_download_geotiff_no_args(self):

        input = self.create_spacetime_layer()

        imagecollection = GeotrellisTimeSeriesImageCollection(
            gps.Pyramid({0: input}), InMemoryServiceRegistry())
        geotiffs = imagecollection.download(
            str(self.temp_folder / "test_download_result.geotiff"))
        print(geotiffs)
    def test_download_masked_geotiff(self):

        input = self.create_spacetime_layer()
        polygon = geometry.Polygon([[0, 0], [1.9, 0], [1.9, 1.9], [0, 1.9]])

        imagecollection = GeotrellisTimeSeriesImageCollection(
            gps.Pyramid({0: input}), InMemoryServiceRegistry())
        imagecollection = imagecollection.mask(polygon)
        geotiffs = imagecollection.download(
            str(self.temp_folder / "test_download_masked_result.geotiff"))
        print(geotiffs)
    def test_download_masked_geotiff_reproject(self):

        input = self.create_spacetime_layer()
        polygon = geometry.Polygon([[0, 0], [1.9, 0], [1.9, 1.9], [0, 1.9]])

        import pyproj
        from shapely.ops import transform
        from functools import partial

        project = partial(
            pyproj.transform,
            pyproj.Proj(init="EPSG:4326"),  # source coordinate system
            pyproj.Proj(init="EPSG:3857"))  # destination coordinate system

        reprojected = transform(project, polygon)

        imagecollection = GeotrellisTimeSeriesImageCollection(
            gps.Pyramid({0: input}), InMemoryServiceRegistry())
        imagecollection = imagecollection.mask(reprojected, "EPSG:3857")
        geotiffs = imagecollection.download(
            str(self.temp_folder / "test_download_masked_result.3857"))
        print(geotiffs)