Skip to content

Commit

Permalink
add get_asset_list method
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Nov 5, 2024
1 parent cb861cc commit 10b3c59
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 7.2.0 (2024-11-05)

* Ensure compatibility between XarrayReader and other Readers by adding `**kwargs` on class methods
* Ensure compatibility between XarrayReader and other Readers by adding `**kwargs` on class methods (https://github.com/cogeotiff/rio-tiler/pull/762)

* add `STACReader.get_asset_list()` method to enable easier customization of the asset listing/validation (https://github.com/cogeotiff/rio-tiler/pull/762)

# 7.1.0 (2024-10-29)

Expand Down
23 changes: 19 additions & 4 deletions rio_tiler/io/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@
import json
import os
import warnings
from typing import Any, Dict, Iterator, Optional, Sequence, Set, Tuple, Type, Union
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Sequence,
Set,
Tuple,
Type,
Union,
)
from urllib.parse import urlparse

import attr
Expand Down Expand Up @@ -273,7 +284,13 @@ def __attrs_post_init__(self):
self.minzoom = self.minzoom if self.minzoom is not None else self._minzoom
self.maxzoom = self.maxzoom if self.maxzoom is not None else self._maxzoom

self.assets = list(
self.assets = self.get_asset_list()
if not self.assets:
raise MissingAssets("No valid asset found. Asset's media types not supported")

def get_asset_list(self) -> List[str]:
"""Get valid asset list"""
return list(
_get_assets(
self.item,
include=self.include_assets,
Expand All @@ -282,8 +299,6 @@ def __attrs_post_init__(self):
exclude_asset_types=self.exclude_asset_types,
)
)
if not self.assets:
raise MissingAssets("No valid asset found. Asset's media types not supported")

def _get_reader(self, asset_info: AssetInfo) -> Tuple[Type[BaseReader], Dict]:
"""Get Asset Reader."""
Expand Down

0 comments on commit 10b3c59

Please sign in to comment.