Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README example raises DoesNotConformTo #220

Closed
ljstrnadiii opened this issue Sep 19, 2023 · 3 comments · Fixed by #221
Closed

README example raises DoesNotConformTo #220

ljstrnadiii opened this issue Sep 19, 2023 · 3 comments · Fixed by #221

Comments

@ljstrnadiii
Copy link
Contributor

ljstrnadiii commented Sep 19, 2023

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

@ljstrnadiii ljstrnadiii changed the title Sentinel Example fails with DoesNotConformTo README Example raises DoesNotConformTo Sep 19, 2023
@ljstrnadiii ljstrnadiii changed the title README Example raises DoesNotConformTo README example raises DoesNotConformTo Sep 19, 2023
@TomAugspurger
Copy link
Contributor

TomAugspurger commented Sep 19, 2023 via email

@ljstrnadiii
Copy link
Contributor Author

ljstrnadiii commented Sep 19, 2023

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
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants