Skip to content

Commit

Permalink
Add back in 'dodgy check' for older versions of pystac
Browse files Browse the repository at this point in the history
  • Loading branch information
jsignell committed Dec 18, 2023
1 parent 736e1d1 commit 9de0b42
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions odc/stac/_mdtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ def has_proj_ext(item: Union[pystac.item.Item, pystac.collection.Collection]) ->
:returns: ``True`` if PROJ extension is enabled
:returns: ``False`` if no PROJ extension was found
"""
return ProjectionExtension.has_extension(item)
if ProjectionExtension.has_extension(item):
return True
# can remove this block once pystac 1.9.0 is the min supported version
else:
return any(
ext_name.startswith("https://stac-extensions.github.io/projection/")
for ext_name in item.stac_extensions
)


def has_raster_ext(item: Union[pystac.item.Item, pystac.collection.Collection]) -> bool:
Expand All @@ -166,7 +173,14 @@ def has_raster_ext(item: Union[pystac.item.Item, pystac.collection.Collection])
:returns: ``True`` if Raster extension is enabled
:returns: ``False`` if no Raster extension was found
"""
return RasterExtension.has_extension(item)
if RasterExtension.has_extension(item):
return True
# can remove this block once pystac 1.9.0 is the min supported version
else:
return any(
ext_name.startswith("https://stac-extensions.github.io/raster/")
for ext_name in item.stac_extensions
)


def has_proj_data(asset: pystac.asset.Asset) -> bool:
Expand Down

0 comments on commit 9de0b42

Please sign in to comment.