예제 #1
0
    def test_reprojection_source_str(self):
        reproject = Reproject(source=self.source,
                              interpolation="bilinear",
                              coordinates=self.coarse_coords.json)
        o1 = reproject.eval(self.coarse_coords)
        o2 = self.source_coarse.eval(self.coarse_coords)

        assert_array_equal(o1.data, o2.data)

        node = podpac.Node.from_json(reproject.json)
        o3 = node.eval(self.coarse_coords)
        assert_array_equal(o1.data, o3.data)
예제 #2
0
    def test_reprojection_Coordinates_crs(self):
        # same eval and source but different reproject
        reproject = Reproject(
            source=self.source,
            interpolation={
                "method": "bilinear",
                "params": {
                    "fill_value": "extrapolate"
                }
            },
            coordinates=self.coarse_coords.transform("EPSG:3857"),
        )
        o1 = reproject.eval(self.source_coords)
        # We have to use a second source here because the reprojected source
        # gets interpreted as having it's source coordinates in EPSG:3857
        # and when being subsampled, there's a warping effect...
        o2 = self.source_coarse2.eval(self.source_coords)
        assert_almost_equal(o1.data, o2.data, decimal=13)

        node = podpac.Node.from_json(reproject.json)
        o3 = node.eval(self.source_coords)
        assert_array_equal(o1.data, o3.data)

        # same eval and reproject but different source
        o1 = reproject.eval(self.source_coords.transform("EPSG:3857"))
        o2 = self.source_coarse2.eval(
            self.source_coords.transform("EPSG:3857"))
        assert_almost_equal(o1.data, o2.data, decimal=13)

        # same source and reproject but different eval
        reproject = Reproject(source=self.source,
                              interpolation="bilinear",
                              coordinates=self.coarse_coords)
        o1 = reproject.eval(self.source_coords.transform("EPSG:3857"))
        o2 = self.source_coarse.eval(self.source_coords.transform("EPSG:3857"))
        assert_almost_equal(o1.data, o2.data, decimal=13)