-
Notifications
You must be signed in to change notification settings - Fork 177
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’ll 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
Conversation
odc-geo
GeoBoxes to dc.load(like=...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Robbi - would be good to have a test though.
It should be reasonably easy to write a test without installing odc-geo - because of the way you wrote it you could just pass in a mock with an ODC-GEO GeoBox
as the compat
attribute.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1551 +/- ##
========================================
Coverage 91.79% 91.79%
========================================
Files 132 132
Lines 14631 14633 +2
========================================
+ Hits 13430 13432 +2
Misses 1201 1201 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Kirill Kouzoubov <[email protected]>
@SpacemanPaul Let me know what you think about this approach - I couldn't get MagicMock to work without infinite recursion errors, so went with making a fake class instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks Robbi (and Kirill)
Reason for this pull request
Support users passing
odc.geo
GeoBoxes todatacube.load(like=...)
. For more details, see #1549.Temporary fix until
odc-geo
is officially integrated in version 1.9.Proposed changes
If the passed object is not a Datacube-style Geobox but has a
odc-geo
".compat" attribute, try using that ".compat" method to convert theodc-geo
style GeoBox to adatacube
-style GeoBox.(I deliberately didn't use a check for whether it was the object was a
odc.geo.geobox.Geobox
object because I didn't know if we wanted to addodc-geo
to the package dependencies yet - happy to change to that though if you'd prefer!)odc.geo
GeoBoxes todc.load
#1549docs/about/whats_new.rst
for all changes📚 Documentation preview 📚: https://datacube-core--1551.org.readthedocs.build/en/1551/