datacube-core
datacube-core copied to clipboard
Cannot pass `odc.geo` GeoBoxes to `dc.load`
Expected behaviour
A user may try to use an odc.geo
GeoBox to load data from datacube-core
. e.g.:
from odc.geo.geobox import GeoBox
gbox = GeoBox.from_bbox(
[149.036528545, -35.384897602, 149.233835134, -35.198132594], resolution=0.002
)
ds = dc.load(
product="ga_ls8c_ard_3",
measurements=["nbart_red", "nbart_green", "nbart_blue"],
time=("2019-01-10", "2019-01-15"),
like=gbox,
resampling="nearest",
group_by="solar_day",
)
Actual behaviour
However, the code above fails with an AttributeError
:
To make it work correctly, the user must add .compat
to the end of the odc.geo
GeoBox to get out an older-style datacube
GeoBox, e.g. gbox.compat
:
from odc.geo.geobox import GeoBox
gbox = GeoBox.from_bbox(
[149.036528545, -35.384897602, 149.233835134, -35.198132594], resolution=0.002
)
ds = dc.load(
product="ga_ls8c_ard_3",
measurements=["nbart_red", "nbart_green", "nbart_blue"],
time=("2019-01-10", "2019-01-15"),
like=gbox.compat,
resampling="nearest",
group_by="solar_day",
)
Even though our timeline for odc-geo
integration isn't expected until version 1.9, it would be very helpful to support odc-geo
GeoBoxes in dc.load
even in version 1.8 to allow users to start writing code that integrates with odc-geo
.
This could be as simple as detecting odc-geo
GeoBoxes and converting them via the .compat
method internally within datacube-core
.
Environment information
- Which
datacube --version
are you using?1.8.17
- What datacube deployment/enviornment are you running against? `DEA prod Sandbox
Note: Stale issues will be automatically closed after a period of six months with no activity. To ensure critical issues are not closed, tag them with the Github
pinned
tag. If you are a community member and not a maintainer please escalate this issue to maintainers via GIS StackExchange or Slack.
Interested in your thoughts @SpacemanPaul @Ariana-B @omad. Would definitely make the product team's lives easier by letting us start using odc-geo
functionality before it's fully/officially integrated in version 1.9.
Given there's an existing .compat
method on the odc-geo
GeoBoxes, I imagine this could be as simple as just calling that method under the hood in dc.load
if a user passes in an odc-geo
GeoBox instead of a datacube-core
one.
Makes sense to me.