gjoseph92 / stackstac

Turn a STAC catalog into a dask-based xarray
https://stackstac.readthedocs.io
MIT License
238 stars 49 forks source link

Unexpected results? Strange array shapes? Missing data? Read here first. #152

Open gjoseph92 opened 2 years ago

gjoseph92 commented 2 years ago

If stackstac.stack is producing unexpected results, it's possible (but not certain!) that the problem is that the STAC metadata doesn't match up with the actual GeoTIFFs.

stackstac determines the resolution, bounds, CRS, array size, etc. up front only from the STAC metadata—it's careful to not look at the underlying data (GeoTIFFs) at all. If the STAC metadata says, for example, that an item is 1024x1024 pixels at 5m resolution, but the GeoTIFF is actually 1m resolution, then stackstac will pick an output bounding box and resolution 5x larger than what the actual data calls for.

Additionally, while compute-ing each dask chunk, stackstac skips even opening files that don't spatially overlap with the chunk, according to STAC metadata. If the STAC metadata is wrong, and a file does in fact overlap, then stackstac will never know, and your result may have unexpected sections of NaNs/missing data.

What can you do about it?

If there isn't a mismatch between STAC metadata and actual data, and you're getting unexpected results, there are a couple other things to be aware of:

If you've checked all those things, and you're still getting unexpected results, then there's probably a stackstac bug. Please open an issue!

Past issues ultimately due to incorrect STAC metadata or xy_coords/snap_bounds: