diff --git a/scenes/sentinel.py b/scenes/sentinel.py index a2776f6dd814e552b6b32b91805176c3c6bb298a..3a1989aab52a84a9eabecc2d1fb0d96c34bc1c07 100644 --- a/scenes/sentinel.py +++ b/scenes/sentinel.py @@ -471,19 +471,17 @@ class Sentinel2TheiaScene(Sentinel2SceneBase): Returns: the file - Raises: - ValueError: If none or multiple candidates are found. - """ filtered_files_list = [f for f in self.files if f.endswith(endswith)] nb_matches = len(filtered_files_list) - if nb_matches != 1: - raise ValueError( - "Cannot instantiate Sentinel-2 Theia product from " - f"{self.archive}: found {nb_matches} occurrence(s) of file " - f"with suffix \"{endswith}\"" - ) - return filtered_files_list[0] + if nb_matches == 1: + return filtered_files_list[0] + print( + "Warning: " + f"{self.archive}: found {nb_matches} occurrence(s) of file " + f"with suffix \"{endswith}\"" + ) + class Sentinel22AScene(Sentinel2TheiaScene): @@ -544,8 +542,9 @@ def get_scene(archive: str) -> Union[Sentinel22AScene, Sentinel23AScene]: a Sentinel23AScene or Sentinel22AScene instance """ + # todo: raise filenotfound if file/path not exist splits = utils.basename(archive).split("_") - if len(splits) == 5: + if len(splits) > 4: level = splits[2] if level == "L3A": return Sentinel23AScene(archive)