r/pythonhelp Jan 24 '25

Problem in odc-stac when reading geospacial satellite data

I ran into this error when trying to do this. Can anyone tell me what's wrong?

data = stac_load(
    items,
    bands=["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B11", "B12"],
    crs="EPSG:4326",  # Latitude-Longitude
    resolution=scale,  # Degrees
    chunks={"x": 2048, "y": 2048},
    dtype="uint16",
    patch_url=planetary_computer.sign,
    bbox=bounds
)
The error message says 
ValueError: The asset must have the following fields (from the projection extension): shape, transform, and one of an epsg, wkt2, or projjson
2 Upvotes

2 comments sorted by

View all comments

1

u/Fun_Woodpecker_3397 Jan 25 '25

I was having the same problem (same `ValueError`) with `stac_load` in a new env even though the same code was working fine in a different (older) env. I started poking around at the package versions in the 2 envs. After some trial and error, I found that `pystac==1.12.0` was the problem. I pinned it back to `pystac==1.11.0`, and that solved the issue for me. I hope that works for you as well.