Пример #1
0
def test_landsat_get_stats_noOverviews(monkeypatch):
    """Should return a valid dict with array statistics and warns about missing overviews."""
    monkeypatch.setenv("GDAL_DISABLE_READDIR_ON_OPEN", "EMPTY_DIR")
    with pytest.warns(NoOverviewWarning):
        stats = landsat8._landsat_stats("5", LANDSAT_PATH,
                                        LANDSAT_METADATA["L1_METADATA_FILE"])
        assert stats["statistics"]["5"]
Пример #2
0
def test_landsat_get_stats_valid():
    """Should return a valid dict with array statistics."""
    stats = landsat8._landsat_stats("4", LANDSAT_PATH,
                                    LANDSAT_METADATA["L1_METADATA_FILE"])
    assert stats["bounds"]
    assert stats["bounds"]["crs"] == CRS({"init": "EPSG:4326"})
    assert stats["statistics"]["4"]
    assert isinstance(stats["statistics"]["4"]["pc"][0], float)
    assert list(map(int, stats["statistics"]["4"]["pc"])) == [423, 7028]
Пример #3
0
def test_landsat_get_stats_validOptions():
    """Should return a valid dict with array statistics."""
    stats = landsat8._landsat_stats(
        "10",
        LANDSAT_PATH,
        LANDSAT_METADATA["L1_METADATA_FILE"],
        overview_level=2,
        percentiles=(5, 95),
        dst_crs="epsg:3857",
    )
    assert stats["bounds"]
    assert stats["bounds"]["crs"] == "epsg:3857"
    assert stats["statistics"]["10"]
    assert list(map(int, stats["statistics"]["10"]["pc"])) == [281, 297]