Skip to content

[BUG] search_data may return granules that do not exist anymore #1142

@bastien-k

Description

@bastien-k

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

I understand that NRT products such as 10.5067/MODIS/MYD11_L2.NRT.061 are deleted on a rolling basis, with only the last 7 days available on the server.

I noticed that the search_data endpoint could still show granules that are no longer on the server.
This will make the download function fail, raising a 404 error.

Expected Behavior

The search function should not return granules that are no longer on the server, and the download function should provide an option to ignore 404 errors.

Steps To Reproduce

This is time dependent, but the following script could demonstrate it:

import earthaccess
import requests

doi = "10.5067/MODIS/MYD11_L2.NRT.061"
temporal = ("2025-11-07T00:00", "2025-11-07T23:59")
bounds = (-122.16838261664851, 38.3103369706418, -121.5725847324255, 38.77823385016004)

granules = earthaccess.search_data(doi=doi, temporal=temporal, bounding_box=bounds)

for granule in granules:
    url = granule.data_links()[0]
    print(url)
    resp = requests.head(url, allow_redirects=True, timeout=5)
    print(resp.status_code)

Result:

https://nrt3.modaps.eosdis.nasa.gov/api/v2/content/archives/allData/61/MYD11_L2/2025/311/MYD11_L2.A2025311.1225.061.2025311142708.NRT.hdf
404
https://nrt3.modaps.eosdis.nasa.gov/api/v2/content/archives/allData/61/MYD11_L2/2025/311/MYD11_L2.A2025311.2150.061.2025311235943.NRT.hdf
200
https://nrt3.modaps.eosdis.nasa.gov/api/v2/content/archives/allData/61/MYD11_L2/2025/311/MYD11_L2.A2025311.2330.061.2025312014959.NRT.hdf
200

The first granule returns a 404.

More importantly, this will fail the download call:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://nrt3.modaps.eosdis.nasa.gov/api/v2/content/archives/allData/61/MYD11_L2/2025/311/MYD11_L2.A2025311.1225.061.2025311142708.NRT.hdf

Environment

- OS: Ubuntu 22.04
- Python: 3.13

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions