odc-stac
raw JSON → 0.5.2 verified Fri May 01 auth: no python
Tooling for converting STAC metadata to ODC (Open Data Cube) data model. Current version: 0.5.2. Release cadence: irregular, patches as needed.
pip install odc-stac Common errors
error ModuleNotFoundError: No module named 'odc.stac' ↓
cause Python cannot find the odc-stac package; either not installed or import path is wrong.
fix
Install with
pip install odc-stac. Ensure you are using from odc.stac import ... (dot notation, not underscore). error ModuleNotFoundError: No module named 'odc.loader' ↓
cause odc-loader package not installed. Required since odc-stac 0.5.0.
fix
Install odc-loader:
pip install odc-loader. error AttributeError: 'NoneType' object has no attribute 'shape' ↓
cause stac_load returned None or empty dataset due to no matching data or incorrect parameters.
fix
Check item collection, bands, and ensure
configure_s3_access is called for cloud data access. Verify items have the requested bands. error TypeError: stac_load() got an unexpected keyword argument 'chunks' ↓
cause chunks parameter changed between odc-loader versions; older version expects `dask_chunks` or different dict format.
fix
Use
chunks={} (dict) for automatic chunking. For odc-loader <0.6.0, use dask_chunks=True/False. Upgrade odc-loader: pip install odc-loader>=0.6.0. Warnings
breaking odc-loader extraction: Since 0.5.0, the loader code has been extracted into a separate `odc-loader` package. You must have odc-loader>=0.6.0 installed. Existing code using `odc.stac.load` should still work, but function signatures may have changed. ↓
fix Ensure both `odc-stac` and `odc-loader` are installed and compatible. Use `pip install odc-stac odc-loader`.
gotcha Deprecated pystac methods: Some pystac client methods (e.g., `get_all_items`) have been renamed. Use `get_items()` or `get_all_items()` depending on your pystac version. Check pystac documentation. ↓
fix Replace deprecated method calls with the current pystac API. For example, use `catalog.get_items()` instead of `catalog.get_all_items()`.
gotcha Geometry handling: When using `bbox` with `stac_load`, the output geobox may not align with items if CRS is not specified. Use `crs=` and `resolution=` explicitly to avoid misalignment. ↓
fix Always specify `crs` and `resolution` in `stac_load` when using `bbox` to ensure consistent output geobox.
deprecated The `odc.stac.eo3` module has been removed (since ~0.4.x). Migrate to `odc.stac.stac2ds` or direct item conversion. ↓
fix Replace `from odc.stac.eo3 import ...` with `from odc.stac import stac2ds`.
Imports
- stac_load wrong
from odc_stac import stac_loadcorrectfrom odc.stac import stac_load - configure_s3_access
from odc.stac import configure_s3_access - load wrong
from odc.stac import loadcorrectfrom odc.stac.load import stac_load
Quickstart
import pystac_client
import planetary_computer
from odc.stac import stac_load, configure_s3_access
catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=planetary_computer.sign_inplace,
)
query = catalog.search(
collections=["sentinel-2-l2a"],
bbox=[142, -37, 143, -36],
datetime="2022-01-01/2022-01-31",
max_items=10,
)
items = list(query.items())
configure_s3_access(aws_unsigned=True)
ds = stac_load(
items,
bands=["red", "green", "blue"],
resolution=10,
chunks={},
groupby="solar_day",
)
print(ds)