Ejemplo n.º 1
0
    def test_actual_arrays(self):
        known_raster_file = resource_filename("tidegates.testing.polygons_to_raster", "test_zones_raster.tif")
        known_raster = utils.load_data(known_raster_file, 'raster')
        raster = utils.polygons_to_raster(self.testfile, "GeoID", **self.kwargs)
        arrays = utils.rasters_to_arrays(raster, known_raster)
        arcpy.management.Delete(raster)

        nptest.assert_array_almost_equal(*arrays)
Ejemplo n.º 2
0
    def test_actual_arrays(self):
        known_raster_file = resource_filename(
            "tidegates.testing.polygons_to_raster", "test_zones_raster.tif")
        known_raster = utils.load_data(known_raster_file, 'raster')
        raster = utils.polygons_to_raster(self.testfile, "GeoID",
                                          **self.kwargs)
        arrays = utils.rasters_to_arrays(raster, known_raster)
        arcpy.management.Delete(raster)

        nptest.assert_array_almost_equal(*arrays)
Ejemplo n.º 3
0
    def test_process(self):
        raster = utils.polygons_to_raster(self.testfile, "GeoID", **self.kwargs)
        nt.assert_true(isinstance(raster, arcpy.Raster))

        array = utils.rasters_to_arrays(raster, squeeze=True)
        arcpy.management.Delete(raster)

        flat_arr = array.flatten()
        bins = numpy.bincount(flat_arr[flat_arr > 0])
        nptest.assert_array_almost_equal(numpy.unique(array), self.known_values)
        nptest.assert_array_almost_equal(bins[bins > 0], self.known_counts)
        nt.assert_tuple_equal(array.shape, self.known_shape)
Ejemplo n.º 4
0
    def test_process(self):
        raster = utils.polygons_to_raster(self.testfile, "GeoID",
                                          **self.kwargs)
        nt.assert_true(isinstance(raster, arcpy.Raster))

        array = utils.rasters_to_arrays(raster, squeeze=True)
        arcpy.management.Delete(raster)

        flat_arr = array.flatten()
        bins = numpy.bincount(flat_arr[flat_arr > 0])
        nptest.assert_array_almost_equal(numpy.unique(array),
                                         self.known_values)
        nptest.assert_array_almost_equal(bins[bins > 0], self.known_counts)
        nt.assert_tuple_equal(array.shape, self.known_shape)