diff --git a/tests/test_esa_safe.py b/tests/test_esa_safe.py index c0e0448..34a458b 100644 --- a/tests/test_esa_safe.py +++ b/tests/test_esa_safe.py @@ -182,6 +182,31 @@ def test_parse_orbit() -> None: assert set(res[0]) == expected +def test_parse_swath_timing() -> None: + annotation_path = ( + DATA_FOLDER + / "S1B_IW_SLC__1SDV_20210401T052622_20210401T052650_026269_032297_EFA4.SAFE" + / "annotation" + / "s1b-iw1-slc-vv-20210401t052624-20210401t052649-026269-032297-004.xml" + ) + expected = { + "azimuthTime", + "azimuthAnxTime", + "sensingTime", + "byteOffset", + "firstValidSample", + "lastValidSample", + } + res = esa_safe.parse_swath_timing(annotation_path) + + assert isinstance(res, dict) + assert "burstList" in res + assert "burst" in res["burstList"] + burst_list = res["burstList"]["burst"] + assert isinstance(burst_list, list) + assert set(burst_list[0]) == expected + + @pytest.mark.parametrize("product_id,expected", SENTINEL1_ATTRIBUTES.items()) def test_parse_manifest_sentinel1( product_id: str, expected: T.Dict[str, T.Any] diff --git a/xarray_sentinel/esa_safe.py b/xarray_sentinel/esa_safe.py index a8fb1de..4c8a7f8 100644 --- a/xarray_sentinel/esa_safe.py +++ b/xarray_sentinel/esa_safe.py @@ -51,6 +51,10 @@ def parse_geolocation_grid_points( return parse_tag_list(annotation_path, "product", ".//geolocationGridPoint") +def parse_swath_timing(annotation_path: PathType,) -> T.List[T.Dict[str, T.Any]]: + return parse_tag_list(annotation_path, "product", ".//swathTiming") + + def open_manifest( product_folder: T.Union[str, "os.PathLike[str]"] ) -> ElementTree.ElementTree: