Skip to content

Commit

Permalink
Issue #28: make sure band_indices are ints before passing to pyramid …
Browse files Browse the repository at this point in the history
…builders

also related to Open-EO/openeo-python-client#76
  • Loading branch information
soxofaan committed Nov 5, 2019
1 parent cec2437 commit 2de8554
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions openeogeotrellis/layercatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def load_collection(self, collection_id: str, viewing_parameters: dict) -> Image
# TODO is it necessary to do this kerberos stuff here?
kerberos()

layer_metadata = self.get_collection_metadata(collection_id, strip_private=False)
layer_source_info = layer_metadata.get("_vito", {}).get("data_source", {})
metadata = CollectionMetadata(self.get_collection_metadata(collection_id, strip_private=False))
layer_source_info = metadata.get("_vito", "data_source", default={})
layer_source_type = layer_source_info.get("type", "Accumulo").lower()

import geopyspark as gps
Expand All @@ -55,7 +55,8 @@ def load_collection(self, collection_id: str, viewing_parameters: dict) -> Image
top = viewing_parameters.get("top", None)
bottom = viewing_parameters.get("bottom", None)
srs = viewing_parameters.get("srs", None)
band_indices = viewing_parameters.get("bands")
bands = viewing_parameters.get("bands", [])
band_indices = [metadata.get_band_index(b) for b in bands]
pysc = gps.get_spark_context()
extent = None

Expand Down Expand Up @@ -130,7 +131,7 @@ def sentinel_hub_l8_pyramid():
image_collection = GeotrellisTimeSeriesImageCollection(
pyramid=gps.Pyramid(levels),
service_registry=self._service_registry,
metadata=CollectionMetadata(layer_metadata)
metadata=metadata
)
return image_collection.band_filter(band_indices) if band_indices else image_collection

Expand Down

0 comments on commit 2de8554

Please sign in to comment.