-
Notifications
You must be signed in to change notification settings - Fork 20
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
Data gap at adjacent tile boundary when loading multiple Items #150
Comments
@pjhartzell thanks for reporting this, anchor config does look broken, do you mind creating a separate issue for that? Issues with projection change on tiled products is tricky and sensitive to tiny shifts, like half-pixel shift you are observing due to anchor bug. My understanding is that modis tiling regime uses proper tiles in the mathematical sense of the word: no gaps and no overlaps between tiles. With data like that there is a difference between |
I have verified this being an issue in the latest code too. Issues goes away when you either
Proper solution to this will be complicated. Currently fusing of pixel data from different Items happens after reprojection to a common pixel grid. That's the easiest to implement and allows for greatest concurrency. For a fully proper solution one would have to
This is much more involved than a current setup:
This is one of the reason why Landsat and Sentinel tiles overlap quite a bit even when deep inside UTM zone. Work-aroundRequires latest Code below based on linked example above: %matplotlib inline
import odc.stac
import pystac
items = [
pystac.read_file(path)
for path in [
"data/MCD43A4.A2023205.h08v04.061.2023216154635/MCD43A4.A2023205.h08v04.061.2023216154635.json",
"data/MCD43A4.A2023205.h08v05.061.2023216154702/MCD43A4.A2023205.h08v05.061.2023216154702.json",
]
]
ds = odc.stac.load(items).odc.reproject(32610, anchor="center")
ds.Nadir_Reflectance_Band1.sel(
x=slice(450000, 550000), y=slice(4480000, 4380000)
).plot.imshow(robust=True, size=8, col="time")
display(ds.odc.geobox) |
Certainly. See #151. |
@Kirill888 Thanks for the clear explanation.
|
Summary:
When loading and reprojecting adjacent MODIS sinusoidal tiles to UTM with
odc.stac.load
, I'm ending up with a small sliver of missing data at the sinusoidal tile boundary. If you load each Item separately and plot them on the same graph, there is no gap:But when loading Items simultaneously as an ItemCollection or just a list of Items (which is what I'd like to do), I end up with a small gap at the tile boundary:
My project requires
odc-stac
version 0.3.5 at the moment. I upgraded to version 0.3.9 and that seemed to fix the problem, but closer investigation revealed that myanchor=AnchorEnum.CENTER
argument is being ignored in 0.3.9 and replaced withanchor=AnchorEnum.EDGE
. UsingEDGE
does get rid of the gap, but I need to stick withCENTER
. I also do not know whyEDGE
fixes the problem or if it will hold up in areas where the MODIS Sinusoidal grid is more heavily distorted.I put together some minimal STAC Items and Jupyter notebook for each of the above issues at https://github.com/pjhartzell/data-gap.
Potential solution to the observed
anchor
problem:If this is actually a bug and not a feature that I'm not understanding, in looking through the
output_geobox
function, it looks like the incominganchor
argument is never used. Is it possible that L968 should be changed from:anchor = _anchor
to something like this?
anchor = anchor if anchor else _anchor
Versions, hardware
Currently pinned to:
odc-stac==0.3.5
odc-geo==0.3.3
odc-algo==0.2.3
Tested with Python 3.9 and 3.11.
Apple M1 (arm64)
The text was updated successfully, but these errors were encountered: