Skip to content

[BUG] search_services example in howto guide raises error #1093

@andypbarrett

Description

@andypbarrett

Is this issue already tracked somewhere, or is this a new report?

  • I've reviewed existing issues and couldn't find a duplicate for this problem.

Current Behavior

The search_services example in the HowTo notebook https://github.com/nsidc/earthaccess/blob/update-search-user-guide/docs/howto/search-services.md raises a ValueError

services = earthaccess.search_services(provider="POCLOUD", keyword="COG")
File ~/src/earthaccess/earthaccess/api.py:307, in search_services(count, **kwargs)
    286 def search_services(count: int = -1, **kwargs: Any) -> List[Any]:
    287     """Search the NASA CMR for Services matching criteria.
    288 
    289     See <https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#service>.
   (...)
    305         ```
    306     """
--> 307     query = DataServices(auth=earthaccess.__auth__).parameters(**kwargs)
    308     hits = query.hits()
    309     logger.info(f"Services found: {hits}")

File ~/mambaforge/envs/earthaccess/lib/python3.13/site-packages/cmr/queries.py:144, in Query.parameters(self, **kwargs)
    141 for key, val in kwargs.items():
    142     # verify the key matches one of our methods
    143     if key not in methods:
--> 144         raise ValueError(f"Unknown key {key}")
    146     # call the method
    147     if isinstance(val, tuple):

ValueError: Unknown key keyword

Expected Behavior

Based on the link to the CMR API, search_services should accept the following keywords

name
type
provider
native_id
concept_id
keyword

Both keyword and type raise ValueError: Unknown key type

Steps To Reproduce

earthaccess.__version__
'0.14.0'
test_kwargs = [
    {"provider": "PODAAC"},
    {"concept_id": "S3084748458-POCLOUD"},
    {"name": "PODAAC_SWODLR"},
    {"native_id": 'POCLOUD_podaac_swodlr'},
    {"type": "swodlr"},
    {"keyword": "cog"},
]

for test in test_kwargs:
    try:
        earthaccess.search_services(**test)
    except ValueError as err:
        print(err)
Unknown key type
Unknown key keyword

Environment

- OS: Ubuntu 22.04.5 LTS
- Python: Python 3.13.7

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact: documentationImprovements or additions to documentationtype: bugSomething isn't working

    Type

    No type

    Projects

    Status

    🏗 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions