stackstac: easier cloud-native geoprocessing#
stackstac.stack turns a STAC collection into a lazy
xarray.DataArray, backed by dask.
This lets you easily compute composites, mosaics, and any other sorts of fun aggregations on raster data. Run it in parallel on one machine, or distribute it across many in the cloud, using Coiled, Pangeo, or your own distributed deployment.
stackstac does for you:#
Figure out the geospatial parameters from the STAC metadata (if possible): a coordinate reference system, resolution, and bounding box.
Transfer the STAC metadata into xarray coordinates for easy indexing, filtering, and provenance of metadata.
Efficiently generate a Dask graph for loading the data in parallel.
Mediate between Dask’s parallelism and GDAL’s aversion to it, allowing for fast, multi-threaded reads when possible, and at least preventing segfaults when not.
stackstac is available on pip:
pip install 'stackstac[viz]'
Its main dependencies are rasterio, pyproj, dask, and xarray, all of which should pose no problems to install—no need to build GDAL from source here.