コード例 #1
0
def test_calculate_stats_wfs_polygons():
    """ Test calculate_stats with a group_by argument."""

    zones = '/app/tests/small_admin_boundaries.json'
    geotiff = '/app/tests/raster_sample.tif'
    wfs_response = {'filter_property_key': 'label', 'path': '/app/tests/wfs_response.json'}

    features = calculate_stats(
        zones, geotiff, geojson_out=False, wfs_response=wfs_response)
    assert len(features) == 5

    features = calculate_stats(
        zones, geotiff, group_by='ADM1_PCODE', geojson_out=False, wfs_response=wfs_response)
    assert len(features) == 2

    assert True
コード例 #2
0
def test_calculate_stats_json_output():
    """ Test calculate_stats with geojson_out=False."""

    zones = '/app/tests/small_admin_boundaries.json'
    geotiff = '/app/tests/raster_sample.tif'
    features = calculate_stats(zones, geotiff, geojson_out=False)
    assert len(features) == 26
    assert True
コード例 #3
0
def test_calculate_stats_with_group_by():
    """ Test calculate_stats with a group_by argument."""

    zones = '/app/tests/small_admin_boundaries.json'
    geotiff = '/app/tests/raster_sample.tif'
    features = calculate_stats(
        zones, geotiff, group_by='ADM1_PCODE', geojson_out=False)
    assert len(features) == 4
    assert True
コード例 #4
0
ファイル: main.py プロジェクト: WFP-VAM/prism-frontend
def _calculate_stats(zones, geotiff, stats, prefix, group_by, geojson_out,
                     wfs_response):
    """Calculate stats."""
    return calculate_stats(zones,
                           geotiff,
                           stats=stats,
                           prefix=prefix,
                           group_by=group_by,
                           geojson_out=geojson_out,
                           wfs_response=wfs_response)