gjoseph92 / stackstac

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

README example raises `DoesNotConformTo` #220

Closed ljstrnadiii closed 10 months ago

ljstrnadiii commented 10 months ago

When trying to run this sentinel2 example as shown on the readme

import stackstac
import pystac_client

URL = "https://earth-search.aws.element84.com/v0"
catalog = pystac_client.Client.open(URL)

stac_items = catalog.search(
    intersects=dict(type="Point", coordinates=[-105.78, 35.79]),
    collections=["sentinel-s2-l2a-cogs"],
    datetime="2020-04-01/2020-05-01"
).get_all_items()

stack = stackstac.stack(stac_items)
print(stack)

The client is raising a DoesNotConformTo. Any ideas? 🙏

Name: pystac-client Version: 0.7.5 Name: pystac Version: 1.8.3 Name: stackstac Version: 0.4.3

TomAugspurger commented 10 months ago

I think EarthSearch is at https://earth-search.aws.element84.com/v1 now (v1). And it seems like the collection names may have changed too. Does using that newer endpoint work for you?

On Tue, Sep 19, 2023 at 8:29 AM Leonard @.***> wrote:

When trying to run this sentinel2 example as shown on the readme

import stackstac import pystac_client

URL = "https://earth-search.aws.element84.com/v0" catalog = pystac_client.Client.open(URL)

stac_items = catalog.search( intersects=dict(type="Point", coordinates=[-105.78, 35.79]), collections=["sentinel-s2-l2a-cogs"], datetime="2020-04-01/2020-05-01" ).get_all_items()

stack = stackstac.stack(stac_items) print(stack)

The client is raising a DoesNotConformTo. Any ideas? 🙏

Name: pystac-client Version: 0.7.5 Name: pystac Version: 1.8.3 Name: stackstac Version: 0.4.3

— Reply to this email directly, view it on GitHub https://github.com/gjoseph92/stackstac/issues/220 or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAOIXE2J3DY7LASXWFY33X3GM37BFKMF2HI4TJMJ2XIZLTSOBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTLDTOVRGUZLDORPXI6LQMWSUS43TOVS2M5DPOBUWG44SQKSHI6LQMWVHEZLQN5ZWS5DPOJ42K5TBNR2WLKJTGQ2TAMBUG43DBAVEOR4XAZNFNFZXG5LFUV3GC3DVMWVDCOJQGI4TKMZQHA2KO5DSNFTWOZLSUZRXEZLBORSQ . You are receiving this email because you are subscribed to this thread.

Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

ljstrnadiii commented 10 months ago

Thanks, @TomAugspurger--I just figured this out. Yes, collection names have also changed:

list(
    pystac_client.Client.open(
        "https://earth-search.aws.element84.com/v1"
    ).get_children()
)

Gives:

 [<CollectionClient id=cop-dem-glo-30>,
 <CollectionClient id=naip>,
 <CollectionClient id=sentinel-2-l2a>,
 <CollectionClient id=sentinel-2-l1c>,
 <CollectionClient id=landsat-c2-l2>,
 <CollectionClient id=cop-dem-glo-90>,
 <CollectionClient id=sentinel-1-grd>] 

Looking at the sentinel-2-l2a collection shows they are cogs for each band, etc. Modifying the url and collection seems to work:

import stackstac
import pystac_client

URL = "https://earth-search.aws.element84.com/v1"
catalog = pystac_client.Client.open(URL)

stac_items = catalog.search(
    intersects=dict(type="Point", coordinates=[-105.78, 35.79]),
    collections=["sentinel-2-l2a"],
    datetime="2020-04-01/2020-05-01"
).get_all_items()

stack = stackstac.stack(stac_items)
print(stack)
Screenshot 2023-09-19 at 7 47 34 AM
gjoseph92 commented 10 months ago

@ljstrnadiii interestingly, I don't get this error with older versions of pystac-client. Thanks for the catch, we might as well use the newer endpoint anyway.