Skip to content

Commit

Permalink
BUG: Add datacube 1.9+ geobox compatibility (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 authored Feb 3, 2025
1 parent 2b95aa5 commit a0299cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ History

Latest
------
- BUG: Add datacube 1.9+ geobox compatibility (#185)

0.7.0
------
Expand Down
7 changes: 6 additions & 1 deletion geocube/geo_utils/geobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ def from_vector(
), "'like' and 'resolution' are not supported together"
assert self.align is None, "'like' and 'align' are not supported together"
try:
geobox = self.like.geobox
try:
# datacube 1.9+
geobox = self.like.odc.geobox
except AttributeError:
# datacube <= 1.8
geobox = self.like.geobox
except (AttributeError, ValueError):
geobox = geobox_from_rio(self.like)
return geobox
Expand Down

0 comments on commit a0299cc

Please sign in to comment.