Skip to content

Commit

Permalink
Stop using the dd.dataset.title field and replace it with collection.…
Browse files Browse the repository at this point in the history
…title

PiperOrigin-RevId: 704622076
  • Loading branch information
Google Earth Engine Community Authors authored and copybara-github committed Dec 10, 2024
1 parent 303c8c4 commit 74a8add
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stac/stac_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ def get(self, item: str, default: Optional[Any] = None) -> Optional[Any]:
def public_id(self) -> str:
return self['id']

def title(self) -> str:
return self.stac_json['title']

def dataset_type(self) -> stac_checker.GeeType:
return stac_checker.GeeType(self.stac_json['gee:type'])

Expand Down
5 changes: 5 additions & 0 deletions stac/stac_lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def test_get_attribute(self):
with self.assertRaises(KeyError):
collection['does not exist'] # pylint: disable=pointless-statement

def test_get_title(self):
stac_json = _valid_stac()
collection = stac.Collection(stac_json)
self.assertEqual('A Title', collection.title())

def test_bbox(self):
stac_json = _valid_stac()
stac_json['extent']['spatial'].update({'bbox': [[-1, -2, 3, 4]]})
Expand Down

0 comments on commit 74a8add

Please sign in to comment.