Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handle potential issues #176 #179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions scripts/create_expected.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@
root = Path(__file__).parents[1]
data_files = root / "tests" / "data-files"

errored = False
for path in data_files.iterdir():
if path.name in EXCLUDE or path.name.startswith("."):
continue
print(path)
item = stac.create_item(str(path))
item.set_self_href(str(data_files / path.name / "expected_output.json"))
item.make_asset_hrefs_relative()
item.validate()
item.save_object(include_self_link=False)
try:
item = stac.create_item(str(path))
item.set_self_href(str(data_files / path.name / "expected_output.json"))
item.make_asset_hrefs_relative()
item.validate()
item.save_object(include_self_link=False)

except Exception as e:
print(e)
errored = True

if errored:
print("At least one error occurred")
exit(1)
2 changes: 2 additions & 0 deletions src/stactools/sentinel2/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ def image_asset_from_href(
resolution = highest_asset_res(band_id_search.group(1))
elif IS_TCI_PATTERN.search(asset_href):
resolution = 10
else:
raise ValueError(f"Could not determine resolution for {asset_href}")

shape = list(resolution_to_shape[int(resolution)])
transform = transform_from_bbox(proj_bbox, shape)
Expand Down
Loading