Skip to content

[BUG] search_data(doi=...) is not a valid granule search parameter #1090

@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 DataGranules class has a doi method to search for granules by DOI. However, doi is not a valid search parameter for granule search and raises an error.

Expected Behavior

Although it would be nice to search granules by DOI as an alternative to short_name or concept_id this is not available from CMR and would require search_data to do a collections query to get a short_name or concept_id and then pass this to DataGranule.

I suggest removing the doi method from DataGranules.

Steps To Reproduce

earthaccess.search_data(
    doi="10.5067/ATLAS/ATL10.005", 
    count=10
)

raises RunTimeError

RuntimeError: {"errors":["The CMR does not allow querying across granules in all collections. To help optimize your search, you should limit your query using conditions that identify one or more collections, such as provider, provider_id, concept_id, collection_concept_id, short_name, version or entry_title. For any questions please contact cmr-support@nasa.gov."]}

A curl call raises a similar error

curl "https://cmr.earthdata.nasa.gov/search/granules?doi=10.5067/ATLAS/ATL10.006"
<?xml version="1.0" encoding="UTF-8"?><errors><error>The CMR does not allow querying across granules in all collections. To help optimize your search, you should limit your query using conditions that identify one or more collections, such as provider, provider_id, concept_id, collection_concept_id, short_name, version or entry_title. For any questions please contact cmr-support@nasa.gov.</error></errors>

Environment

- OS: Linux
- Python: 3.13.7

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions