Skip to content

Make collection search more permissive #786

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

Closed
gadomski opened this issue Feb 10, 2025 · 0 comments · Fixed by #787
Closed

Make collection search more permissive #786

gadomski opened this issue Feb 10, 2025 · 0 comments · Fixed by #787
Assignees
Labels
bug Something isn't working

Comments

@gadomski
Copy link
Member

Per Postel's law we should be ok reading invalid STAC collections. CSDA currently has invalid collections, and so searching throws an error:

$ stac-client collections https://csdap.earthdata.nasa.gov/stac/
'spatial'
Traceback (most recent call last):
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/cli.py", line 432, in cli
    return collections(client, **args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/cli.py", line 127, in collections
    collections_dicts = [c.to_dict() for c in result.collections()]
                                              ^^^^^^^^^^^^^^^^^^^^
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/collection_search.py", line 375, in collections
    for collection in self.collections_as_dicts():
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/collection_search.py", line 389, in collections_as_dicts
    for page in self.pages_as_dicts():
                ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/collection_search.py", line 438, in pages_as_dicts
    for collection in filter(
                      ^^^^^^^
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/collection_search.py", line 439, in <lambda>
    lambda x: collection_matches(x, **args),
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gadomski/Code/stac-utils/pystac-client/pystac_client/collection_search.py", line 64, in collection_matches
    collection_bboxes = collection_dict["extent"]["spatial"]["bbox"]
                        ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'spatial'
@gadomski gadomski self-assigned this Feb 10, 2025
@gadomski gadomski added the bug Something isn't working label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant