How to use the terracotta.handlers.datasets.datasets function in terracotta

To help you get started, we’ve selected a few terracotta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DHI-GRAS / terracotta / tests / handlers / test_datasets.py View on Github external
def test_datasets_handler(testdb, use_testdb):
    import terracotta
    from terracotta.handlers import datasets
    driver = terracotta.get_driver(str(testdb))
    keys = driver.key_names
    assert datasets.datasets()
    assert datasets.datasets() == [dict(zip(keys, pair)) for pair in driver.get_datasets().keys()]

    # check key order
    assert all(tuple(ds.keys()) == keys for ds in datasets.datasets())
github DHI-GRAS / terracotta / tests / handlers / test_datasets.py View on Github external
def test_datasets_handler(testdb, use_testdb):
    import terracotta
    from terracotta.handlers import datasets
    driver = terracotta.get_driver(str(testdb))
    keys = driver.key_names
    assert datasets.datasets()
    assert datasets.datasets() == [dict(zip(keys, pair)) for pair in driver.get_datasets().keys()]

    # check key order
    assert all(tuple(ds.keys()) == keys for ds in datasets.datasets())
github DHI-GRAS / terracotta / tests / handlers / test_singleband.py View on Github external
def test_singleband_tile_size(use_testdb, raster_file_xyz):
    from terracotta.handlers import datasets, singleband
    ds = datasets.datasets()

    test_tile_size = (16, 32)

    for keys in ds:
        raw_img = singleband.singleband(keys, raster_file_xyz, tile_size=test_tile_size)
        img_data = np.asarray(Image.open(raw_img))
        assert img_data.shape == test_tile_size
github DHI-GRAS / terracotta / tests / handlers / test_metadata.py View on Github external
def test_metadata_handler(use_testdb):
    from terracotta.handlers import metadata, datasets
    ds = datasets.datasets()[0]
    md = metadata.metadata(ds)
    assert md
    assert md['metadata'] == ['extra_data']
github DHI-GRAS / terracotta / tests / handlers / test_singleband.py View on Github external
def test_singleband_handler(use_testdb, raster_file_xyz,
                            resampling_method):
    import terracotta
    terracotta.update_settings(RESAMPLING_METHOD=resampling_method)

    from terracotta.handlers import datasets, singleband
    settings = terracotta.get_settings()
    ds = datasets.datasets()

    for keys in ds:
        raw_img = singleband.singleband(keys, raster_file_xyz)
        img_data = np.asarray(Image.open(raw_img))
        assert img_data.shape == settings.DEFAULT_TILE_SIZE
github DHI-GRAS / terracotta / tests / handlers / test_colorbar.py View on Github external
def test_colorbar_handler(use_read_only_database):
    from terracotta.handlers import datasets, colorbar
    keys = datasets.datasets()[0]
    cbar = colorbar.colorbar(keys, num_values=50)
    assert cbar
    assert len(cbar) == 50
github DHI-GRAS / terracotta / tests / handlers / test_singleband.py View on Github external
def test_singleband_out_of_bounds(use_testdb):
    import terracotta
    from terracotta.handlers import datasets, singleband
    ds = datasets.datasets()

    for keys in ds:
        with pytest.raises(terracotta.exceptions.TileOutOfBoundsError):
            singleband.singleband(keys, (10, 0, 0))