Download NASA Earth Science Data from LAADS DAAC using python

The NASA LAADS DAAC (Level-1 and Atmosphere Archive & Distribution System Distributed Active Archive Center) provides satellite data products to users worldwide. These data products support various scientific and educational research projects. In this section, we will explore the methods for locating and downloading data from NASA LAADS DAAC using Python.

Creating an account on NASA LAADS DAAC

To download files from NASA LAADS DAAC, you need to create an access token. Follow these steps to generate your token:

Visit the NASA LAADS DAAC website.

  • Create a free account by signing up.

  • Once logged in, click on your profile icon in the top right corner and select "Generate Token" from the drop-down menu.

  • Copy the generated token and keep it secure.

Replace the placeholder token with your own token in your python code. For example:

token = 'YourGeneratedTokenHere'

Here is a sample token for illustration purposes:

token = 'Ym1hcmNoYW50OlltVnVhbUZ0YVc0dWJXRnlZMmhoYm5SQWJtRnpZUzVuYjNZPToxNjI0NzE3MjEwOjEwZmNhNWU4ODVlNzc3OGUyMzE3NzFkZjNmNjUwMGIzNjVhMDY4ZWY'

Remember to replace 'YourGeneratedTokenHere' with the token you obtained from the NASA LAADS DAAC website.

NASA Earth science data products are categorized into different levels based on their processing and complexity. Here's a general overview:

Classification of NASA Earth Science Data Products

Level 1 (L1):

  • Level 1 data are usually raw or minimally processed satellite observations.These data often undergo initial processing to correct for sensor-specific effects like geometric distortions, radiometric calibration, and sensor artifacts.
  • Level 1 data typically contain basic parameters such as radiance or reflectance values.

Level 2 (L2):

  • Level 2 data are derived geophysical variables or intermediate products generated from Level 1 data.
    These data often involve more advanced processing algorithms to convert raw measurements into meaningful geophysical parameters.
  • Level 2 data may include products such as surface temperature, vegetation indices, atmospheric profiles, or ocean chlorophyll concentration. They provide information that is closer to what scientists need for research and applications.

Level 3 (L3):

  • Level 3 data are typically gridded or spatially aggregated products derived from Level 2 data. These data are often averaged or aggregated over specific time intervals (e.g., daily, monthly, yearly) and/or spatial resolutions (e.g., global grids, regional tiles).
  • Level 3 data facilitate easier analysis and visualization of long-term trends, spatial patterns, and regional variability. They are commonly used for large-scale studies, climate monitoring, and model validation.

Example: Downloading Aqua/MODIS L1 data

What is Aqua ?

Aqua is a major international Earth Science satellite mission developed by NASA, launched in 2002. It circles the Earth in a sun-synchronous orbit, meaning it passes over the equator at roughly the same time each day. Aqua carries six instruments that continuously monitor Earth's water cycle, atmosphere, and land masses.

Here's a breakdown of Aqua's key aspects:

  • Focus: Earth's water cycle, atmosphere, and land
  • Launched by: NASA (in collaboration with international partners)
  • Orbit: Sun-synchronous
  • Instruments: Six instruments collecting data on various aspects of Earth's systems

What is MODIS instrument ?

The Moderate Resolution Imaging Spectroradiometer (MODIS) is a key instrument onboard two NASA Earth science satellites:

  • Terra: Launched in 1999, Terra circles the Earth in a morning orbit, collecting data around 10:30 AM local time.
  • Aqua: Launched in 2002, Aqua follows a sun-synchronous afternoon orbit, acquiring data at approximately 1:30 PM local time.

MODIS: A Powerful Eye on Earth

MODIS acts like a giant camera, but instead of capturing visible light like a regular camera, it detects electromagnetic radiation across a wide range of wavelengths. This allows scientists to observe and measure various aspects of Earth's system, including:

  • Land: Vegetation cover, land surface temperature, and changes in deforestation.
  • Oceans: Ocean color, which can reveal phytoplankton abundance and ocean health.
  • Atmosphere: Cloud cover, aerosols, and atmospheric water vapor.

Finding specific datasets for a given product and day

Here's a detailed explanation of the code for downloading and processing NASA LAADS DAAC data using Python:

Import Necessary Libraries

from datetime import date
from os import path

import urllib.request
import urllib.request, json 
import pprint
  • datetime: Used to handle date calculations.
  • os: Used to handle file path operations.
  • urllib.request: Used for making HTTP requests.
  • json: Used to parse JSON responses.
  • pprint: Used to pretty-print JSON data for readability.

Set Up Authorization

token = 'YourGeneratedTokenHere'

opener = urllib.request.build_opener()
opener.addheaders = [('Authorization', 'Bearer {}'.format(token))]
  • build_opener(): Creates an opener object to handle HTTP requests.
  • addheaders: Adds the authorization header using the token for authenticated access to NASA LAADS DAAC.
  • install_opener(opener): Installs the opener as the default opener for urllib.

Define Parameters

year = 2015
month = 7
day = 18
hour = 19
minute = 35

product_name = 'MYD021KM'
collection = 61
  • year, month, day, hour, minute: Define the date and time for the data request.
  • product_name: Specifies the satellite product name (e.g., 'MYD021KM').
  • collection: Indicates the collection number for the dataset.

Calculate Day of the Year

d0 = date(year, 1, 1)
d1 = date(year, month, day)
delta = d1 - d0

count_of_day = delta.days + 1

  • d0: Represents January 1st of the specified year.
  • d1: Represents the target date for the data request.
  • delta: Calculates the difference between the target date and January 1st.
  • count_of_day: Computes the day of the year (DOY) for the target date.

Construct the URL and Request Data

ladsweb_url = '{}/{}/{:04d}/{:03d}.json'.format(collection, product_name,year,count_of_day)

with urllib.request.urlopen(ladsweb_url) as url:
    data = json.loads(
  • ladsweb_url: Constructs the URL for accessing the data using the collection number, product name, year, and DOY.
  • urlopen(ladsweb_url): Opens the URL and retrieves the data.
  • json.loads( Decodes and parses the JSON response from the server.

Pretty Print the Data

pp = pprint.PrettyPrinter(indent=4)
  • PrettyPrinter: Initializes a pretty printer object with an indent level of 4.
  • pprint(data): Prints the JSON data in a human-readable format.