diff --git a/scripts/create_expected.py b/scripts/create_expected.py index a26337c..8cf31c3 100755 --- a/scripts/create_expected.py +++ b/scripts/create_expected.py @@ -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) diff --git a/src/stactools/sentinel2/stac.py b/src/stactools/sentinel2/stac.py index 0d94262..668dbe3 100644 --- a/src/stactools/sentinel2/stac.py +++ b/src/stactools/sentinel2/stac.py @@ -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)