Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility fix for passing odc-geo GeoBoxes to dc.load(like=...) #1551

Merged
merged 12 commits into from Mar 26, 2024
7 changes: 7 additions & 0 deletions datacube/api/core.py
Expand Up @@ -875,9 +875,16 @@ def output_geobox(like=None, output_crs=None, resolution=None, align=None,
assert output_crs is None, "'like' and 'output_crs' are not supported together"
assert resolution is None, "'like' and 'resolution' are not supported together"
assert align is None, "'like' and 'align' are not supported together"

# If user passes a GeoBox, return as-is
if isinstance(like, GeoBox):
return like

# For `odc-geo` GeoBox compatibility: use "compat" attribute if
# it exists to convert to a Datacube-style GeoBox
if hasattr(like, "compat"):
return like.compat
SpacemanPaul marked this conversation as resolved.
Show resolved Hide resolved

return like.geobox

if load_hints:
Expand Down
1 change: 1 addition & 0 deletions docs/about/whats_new.rst
Expand Up @@ -15,6 +15,7 @@ v1.8.next
- Update github-Dockerhub credential-passing mechanism. (:pull:`1528`)
- Tweak ``list_products`` logic for getting crs and resolution values (:pull:`1535`)
- Add new ODC Cheatsheet reference doc to Data Access & Analysis documentation page (:pull:`1543`)
- Compatibility fix to allow users to supply ``odc.geo``-style GeoBoxes to ``dc.load(like=...)`` (:pull:`1551`)

v1.8.17 (8th November 2023)
===========================
Expand Down
1 change: 1 addition & 0 deletions wordlist.txt
Expand Up @@ -170,6 +170,7 @@ geo
geobase
GeoBox
geobox
GeoBoxes
GeoboxTiles
GEOGCS
GeoJSON
Expand Down