Lazily load COG assets from STAC items into xarray DataArrays using async-geotiff
Project description
Open a lazy (time, band, y, x) xarray DataArray from thousands of cloud-optimized geotiffs (COGs). No GDAL required.
What is lazycogs?
stackstac and odc-stac established the pattern that lazycogs builds on: take a STAC item collection and expose it as a spatially-aligned xarray DataArray ready for dask-parallel computation. Both are excellent tools that cover most satellite imagery workflows well. They rely on the trusty combination of rasterio and GDAL for data i/o and warping operations.
lazycogs takes the same approach but replaces GDAL and rasterio with a Rust-native stack: rustac for STAC queries over stac-geoparquet files, async-geotiff for COG i/o, and obstore for cloud storage access.
The result is a tool that can instantly expose a lazy xarray DataArray view of massive STAC item archives in any CRS and resolution. Each array operation triggers a targeted spatial query on the stac-geoparquet file to find only the assets needed for that specific chunk — no upfront scan of every item required.
One constraint worth naming: lazycogs only reads Cloud Optimized GeoTIFFs. If your assets are in another format, this is not the right tool.
| Task | Library |
|---|---|
| STAC search + spatial indexing | rustac (DuckDB + geoparquet) |
| COG I/O | async-geotiff (Rust, no GDAL) |
| Cloud storage | obstore |
| Reprojection | pyproj + numpy |
| Lazy dataset construction | xarray BackendEntrypoint + LazilyIndexedArray |
Installation
Not yet published to PyPI. Install directly from GitHub:
pip install git+https://github.com/developmentseed/lazycogs.git
Example
import rustac
import lazycogs
from pyproj import Transformer
# set a target CRS and extent
dst_crs = "EPSG:32615"
dst_bbox = (380000.0, 4928000.0, 420000.0, 4984000.0)
# transform to 4326 for STAC search
transformer = Transformer.from_crs(dst_crs, "epsg:4326", alwaysxy=True)
bbox_4326 = transformer.transform_bounds(*dst_bbox)
# Search a STAC API and cache results to a local stac-geoparquet file.
await rustac.search_to(
"items.parquet",
"https://earth-search.aws.element84.com/v1",
collections=["sentinel-2-l2a"],
datetime="2023-06-01/2023-08-31",
bbox=bbox_4326,
)
# Open a fully lazy (time, band, y, x) DataArray. No COGs are read yet.
da = lazycogs.open(
"items.parquet",
bbox=dst_bbox,
crs=dst_crs,
resolution=10.0,
)
Documentation
- Home — quickstart and full usage guide
- Example: Midwest US daily array
- Example: Southwest US monthly composite
- Architecture
- API Reference
- Contributing
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lazycogs-0.1.0.tar.gz.
File metadata
- Download URL: lazycogs-0.1.0.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1382fd29f473896f784d7589c63473dc187033e91b8746a26481957f6a28c44f
|
|
| MD5 |
dc8c9b371cfdee28734396ddf1e019ff
|
|
| BLAKE2b-256 |
0c52bc2058a6da588859638833f2bc9e56c2d8c2d73d60363c8ed9c01e143753
|
File details
Details for the file lazycogs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lazycogs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 46.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdabc1a44ad3ee4ce730b25cfe8ce2803ac3732c20eea2dccf5751f9fab5b184
|
|
| MD5 |
5ddb78b63e08303d3d61229c60468518
|
|
| BLAKE2b-256 |
c9004607160ce9fd9f017e43e67436e47a0a831e5b9e096b6ec413ff1a9cf5e4
|