Skip to content

Commit

Permalink
Better handle potential issues #176
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed May 29, 2024
1 parent 1177bb2 commit deed73b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
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

0 comments on commit deed73b

Please sign in to comment.