stac-utils / stac-task

Provides a class interface for running custom algorithms on STAC ItemCollections
Apache License 2.0
21 stars 5 forks source link

Add find_collection method #109

Closed philvarner closed 7 months ago

philvarner commented 7 months ago
  def find_collection(self, item_dict: dict[str, Any]) -> Optional[str]:
        return next(
            (
                c
                for c, expr in self.upload_options.get("collections", {}).items()
                if stac_jsonpath_match(item_dict, expr)
            ),
            None,
        )