Beispiel #1
0
def test_metadata_bands_dimension_no_band_dimensions():
    metadata = CollectionMetadata({
        "cube:dimensions": {
            "x": {"type": "spatial", "axis": "x"},
        }
    })
    with pytest.raises(MetadataException, match="No band dimension"):
        metadata.band_dimension
    with pytest.raises(MetadataException, match="No band dimension"):
        metadata.bands
    with pytest.raises(MetadataException, match="No band dimension"):
        metadata.band_common_names
    with pytest.raises(MetadataException, match="No band dimension"):
        metadata.get_band_index("red")
    with pytest.raises(MetadataException, match="No band dimension"):
        metadata.filter_bands(["red"])
Beispiel #2
0
    def load_collection(self, collection_id: str, load_params: LoadParameters,
                        env: EvalEnv) -> DummyDataCube:
        _register_load_collection_call(collection_id, load_params)
        if collection_id in _collections:
            return _collections[collection_id]

        metadata = CollectionMetadata(
            metadata=self.get_collection_metadata(collection_id))
        if load_params.bands:
            metadata = metadata.filter_bands(load_params.bands)
        image_collection = DummyDataCube(metadata=metadata)

        _collections[collection_id] = image_collection
        return image_collection