Skip to content

Commit a0299cc

Browse files
authored
BUG: Add datacube 1.9+ geobox compatibility (#186)
1 parent 2b95aa5 commit a0299cc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/history.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ History
33

44
Latest
55
------
6+
- BUG: Add datacube 1.9+ geobox compatibility (#185)
67

78
0.7.0
89
------

geocube/geo_utils/geobox.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,12 @@ def from_vector(
174174
), "'like' and 'resolution' are not supported together"
175175
assert self.align is None, "'like' and 'align' are not supported together"
176176
try:
177-
geobox = self.like.geobox
177+
try:
178+
# datacube 1.9+
179+
geobox = self.like.odc.geobox
180+
except AttributeError:
181+
# datacube <= 1.8
182+
geobox = self.like.geobox
178183
except (AttributeError, ValueError):
179184
geobox = geobox_from_rio(self.like)
180185
return geobox

0 commit comments

Comments
 (0)