Downloading NSIDC DAAC Earthdata Cloud Data Using earthaccess
earthaccess is a Python library that simplifies authentication, search, and download of data from NASA's Earthdata systems. It allows you to work with Earthdata directly in the cloud or download files to your local machine.
This article demonstrates how to download data from the Earthdata Cloud to your local machine—focusing on data sets hosted by the NSIDC Distributed Active Archive Center—using earthaccess. You can run the same code using any of the following Python methods:
- Python Interpreter (interactive line-by-line)
- Python script file (
.py) - Jupyter notebook (
.ipynb)
The code stays the same across all methods; only how you run it differs.
Prerequisites
Before you begin, make sure you have the following:
- Earthdata Login (EDL) Account
Create one here: https://urs.earthdata.nasa.gov/users/new - Python Installed
Download and install Python from https://www.python.org/downloads. During installation, check the box: “Add Python to PATH.” earthaccessInstalled
You can install the latest version with:pip install earthaccess. You can also use conda or mamba if you’re using those environments.Authentication Setup (Optional but Recommended)
To avoid logging in repeatedly, you can create a.netrcfile with your EDL credentials. See the setup guide here: https://nsidc.org/data/user-resources/help-center/creating-netrc-file-earthdata-login.
General earthaccess Workflow
earthaccess makes it easy to work with Earthdata in just three steps:
Step 1: Authenticate
import earthaccess
# This will prompt for login or use your .netrc if configured
earthaccess.login()Step 2: Search for Data
To search for data with earthaccess , you’ll need to define a few parameters:
short_name: Dataset ID (e.g.,ATL06,NSIDC-0715)version: Dataset version (optional)bounding_box: Spatial filter - format: (West, South, East, and North)cloud_hosted: SetTrueto search cloud-hosted datatemporal: Time range - format: (”YYYY-MM-DD”, “YYYY-MM-DD”).count: (Optional) Limit the number of results returned
Example: Search for ATL06 data from ICESat-2
results = earthaccess.search_data(
short_name="ATL06",
version="006",
cloud_hosted=True,
temporal=("2022-07-17", "2022-07-31"),
bounding_box=(-105, 39, -104, 40),
count=2
)Step 3: Download the Data
After your search is complete, you can download the data to your local machine. This creates a folder called "data" with your files stored inside a subfolder. The subfolder name combines the date (in YYYY-MM-DD format) when you downloaded the files and a unique download ID number.
earthaccess.download(results)Download the data to a specific folder by adding a second argument. This will download the data to a directory named local_folder in your current working directory (the directory from which you are running this code, also known as .). If that directory doesn't exist, it will be created automatically.
earthaccess.download(results, "./local_folder")Running the Code in Different Environments
The code above will produce the same output regardless of how you execute it. Here’s how to run it using three different methods:
Option 1: Python Interpreter
1. Open a terminal (command prompt on Windows)
2. Type python and press Enter
You'll see something like:
Python 3.12.0 (main, ...)
Type "help", "copyright", "credits" or "license" for more information.
>>>This >>> means you're inside the Python interpreter and ready to type Python code.
3. Paste each code snippet from above one at a time (authentication → search → download)
4. Type exit() to leave the interpreter
Option 2: Python Script File
1. Open a text editor (e.g., Notepad. VS Code, or Text Editor)
2. Copy the complete code and give it a filename with a .py file extension. For example, download_nsidc_data.py.
3. Open a terminal, navigate to the file, and run:
python download_nsidc_data.pyOption 3: Jupyter Notebook
1. In a terminal, install Jupyter (if not already installed): pip install jupyterlab
2. Launch it: jupyter lab
3. Create a new notebook, copy the code into three cells (authentication → search → download), and run them one at a time.
Final Thoughts
earthaccess simplifies working with NASA Earthdata Cloud by handling authentication and providing straightforward commands for searching and downloading data. This example used ICESat-2 ATL06 data, but the same workflow applies to other NSIDC DAAC datasets in the cloud.
Key advantages of earthaccess include:
- Streamlined authentication process
- Simple, consistent interface for data access
- Works with both cloud and local machine data access
- Supports programmatic workflows
For help, consult the earthaccess documentation at https://earthaccess.readthedocs.io/en/latest/ or contact NSIDC User Services at nsidc@nsidc.org.