Exemple #1
0
def test_circle_geometries():
    """
    Test that correct geometry objects are returned and GeoDataMixin is working correctly
    """
    c_locs = [Circle(*vals) for vals in zip(lons, lats, radii, names)]
    geoms = CircleGeometries(c_locs)
    assert geoms.to_geojson() == geojson
Exemple #2
0
def test_rastersum(get_dataframe):
    """
    Test that CircleRasterSum returns correct data 
    """
    c_locs = [Circle(84.038, 28.309, 500, "test")]
    geoms = CircleGeometries(c_locs)
    crs = geoms.raster_sum("population.small_nepal_raster")
    crs = get_dataframe(crs).set_index("name")

    assert crs.loc["test"]["statistic"] == 4610.0
Exemple #3
0
def test_rastersum(get_dataframe):
    """
    Test that CircleRasterSum returns correct data 
    """
    c_locs = [Circle(*vals) for vals in zip(lons, lats, radii, names)]
    geoms = CircleGeometries(c_locs)
    crs = geoms.raster_sum("population.worldpop_2015_un")
    crs = get_dataframe(crs).set_index("name")

    assert crs.loc["Kathmandu"]["statistic"] == 1_135_396.204_037_67
    assert crs.loc["Pokhara"]["statistic"] == 405_240.399_796_441_02
Exemple #4
0
def test_circle_column_names():
    """Test that CircleGeometries has correct column_names property"""
    cl = Circle(2, 3, 4, "bob")
    c = CircleGeometries([cl])
    assert c.head(0).columns.tolist() == c.column_names