Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 8383d88

Browse files
authored
Implement bbox property (#89)
1 parent f1cb4ee commit 8383d88

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cads_api_client/catalogue.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ def end_datetime(self) -> datetime.datetime:
6060
self._temporal_interval[1].replace("Z", "+00:00")
6161
)
6262

63+
@property
64+
def bbox(self) -> tuple[float, float, float, float]:
65+
"""Bounding box of the collection (W, S, E, N).
66+
67+
Returns
68+
-------
69+
tuple[float,float,float,float]
70+
"""
71+
return tuple(self.json["extent"]["spatial"]["bbox"][0])
72+
6373
@property
6474
def id(self) -> str:
6575
"""Collection ID.

tests/integration_test_10_catalogue.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ def test_catalogue_collection_end_datetime(collection: Collection) -> None:
5656
assert collection.end_datetime.isoformat() == "2023-05-09T00:00:00+00:00"
5757

5858

59+
def test_catalogue_collection_bbox(collection: Collection) -> None:
60+
assert collection.bbox == (0, -89, 360, 89)
61+
62+
5963
def test_catalogue_collection_id(collection: Collection) -> None:
6064
assert collection.id == "test-adaptor-mars"
6165

0 commit comments

Comments
 (0)