Skip to content
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

DataArray contains nan-buffer? #83

Closed
maawoo opened this issue Aug 8, 2022 · 2 comments
Closed

DataArray contains nan-buffer? #83

maawoo opened this issue Aug 8, 2022 · 2 comments

Comments

@maawoo
Copy link

maawoo commented Aug 8, 2022

Hi all,
I've mostly used stackstac by now and wanted to see if our dataset's STAC metadata is also usable with this library. The overview on technical differences between both libraries provided in #54 is very helpful. In practice, however, I've also noticed that the DataArray created by odc-stac adds a nan-buffer resulting in a slightly larger spatial extent. I was wondering if this is intended? Or is something going wrong on my side? I was not able to find anything about this in other issues or in the documentation.
Here is how I'm loading the dataset in both libraries, screenshots of the DataArrays and visualizations of a subset to highlight the problem:

# stackstac
ds_st = stackstac.stack(items=nrb_catalog, assets=['vh'], dtype=np.dtype('float32'), chunksize=(-1, 1, 2048, 2048))

# odc-stac
nrb_items = nrb_catalog.get_all_items()
ds_odc = odc.stac.load(items=nrb_items, bands=['vh'], chunks={'x': 2048, 'y': 2048})
ds_odc = ds_odc.chunk(chunks={'time':-1})

stackstac
Screenshot 2022-08-08 at 16 11 14

odc-stac
Screenshot 2022-08-08 at 16 10 29


stackstac
Screenshot 2022-08-08 at 16 21 27

odc-stac
Screenshot 2022-08-08 at 16 21 48

@gadomski
Copy link
Contributor

gadomski commented Aug 8, 2022

I've seen this sort of nodata buffer appear when the Item geometry is larger/different than the asset's bounds -- odc-stac uses the item geometry to define the spatial extents of the output xarray. Check your item geometry and see if it is different than your asset geometry. Since STAC Items are GeoJSON features, I usually just load both the Item and the asset into QGIS and visually compare the two.

@maawoo
Copy link
Author

maawoo commented Aug 8, 2022

Spot-on, thanks @gadomski!

Screenshot 2022-08-08 at 17 39 28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants