earthaccess

raw JSON →
0.17.0 verified Fri May 01 auth: no python

Client library for NASA Earthdata APIs. Provides authenticated search, access, and streaming of NASA Earth science data via Earthdata Login. Current version: 0.17.0. Releases on a monthly cadence.

pip install earthaccess
error AttributeError: module 'earthaccess' has no attribute 'open_files'
cause The function was renamed from open_files to open in an earlier version.
fix
Use earthaccess.open() instead.
error earthaccess.exceptions.AuthenticationError: Earthdata Login credentials rejected
cause Credentials are invalid or expired. Since v0.14.0, this raises an exception.
fix
Check your .netrc file or environment variables (EARTHDATA_USERNAME, EARTHDATA_PASSWORD). Or call earthaccess.login(strategy='netrc') to force netrc usage.
breaking In v0.14.0, earthaccess.login() now raises an exception on rejected credentials instead of printing a warning. Code that ignored login failures will break.
fix Wrap in try/except: try: earthaccess.login() except Exception: print('Login failed')
deprecated earthaccess.open_virtual_dataset() and open_virtual_mfdataset() are deprecated in v0.17.0 ahead of v1.0. They are replaced by the unified .virtualize() method.
fix Use .virtualize() on the store object instead.
gotcha earthaccess.open() returns fsspec file objects, not xarray Datasets. You must pass them to xarray.open_dataset() or use .virtualize().
fix Use xarray.open_dataset(earthaccess.open(results)[0]) to get an xarray Dataset.