Accessing Data Provided by NASA’s Distributed Active Archive Centers (DAACs)

Authors: Samuel Ayers (UAH), Alex Mandel (DevSeed)

Date: April 3, 2023

Description: In this example, we will demonstrate how to get authorized access from a Distributed Active Archive Center (DAAC) in NASA Earthdata, and then access data from the DAAC. Note: not all DAACs will require prior authorization to access data.

Run This Notebook

To access and run this tutorial within MAAP’s Algorithm Development Environment (ADE), please refer to the “Getting started with the MAAP” section of our documentation.

Disclaimer: it is highly recommended to run a tutorial within MAAP’s ADE, which already includes packages specific to MAAP, such as maap-py. Running the tutorial outside of the MAAP ADE may lead to errors.

Additional Resources

Create a Workspace

It is possible to download data provided by DAACs, including data which is not cataloged by the MAAP’s CMR, using the NASA MAAP ADE. This data is hosted externally from the MAAP but can be accessed using the NASA MAAP ADE’s authentication systems.

In order to do this, we start by creating a Jupyter workspace within the NASA MAAP ADE. Using the left-hand navigation, select “+ Get Started” and then select the “Jupyter - MAAP Basic Stable” workspace.

Create Jupyter Workspace

Alternatively, you can create a workspace using the “Workspaces” interface. See Create Workspace for more information.

Importing Packages

You can access data from Jupyter Notebook within your workspace. In your Jupyter Notebook, start by importing the maap package. Then invoke the MAAP constructor, setting the maap_host argument to 'api.maap-project.org'.

[7]:
# import the maap package
from maap.maap import MAAP
#import os for directory creation later in the example
import os
# invoke the MAAP constructor using the maap_host argument
maap = MAAP(maap_host='api.maap-project.org')

Granting Earthdata Login Access

In order to access external DAAC data from the NASA MAAP ADE, MAAP uses your Earthdata Login profile to send a data request to the desired DAAC application.

Some DAAC applications (such as ‘Alaska Satellite Facility Data Access’) must be authorized before you can use them. Login or register at https://urs.earthdata.nasa.gov/ in order to see the applications that you have authorized. From the profile page, click on the ‘Applications’ tab and select ‘Authorized Apps’ from the drop-down menu.

profile page

This takes you to the Approved Applications page which lists the applications you have authorized. To add more applications, scroll down to the bottom of the page and click the ‘APPROVE MORE APPLICATIONS’ button which takes you to the Application search page.

Approved Applications page

Enter the desired application name within the search box and click the ‘SEARCH’ button. After this, a list of search results appears.

Application search page

Once you find the desired application, click the ‘AUTHORIZE’ button next to the name.

search results

You are then presented with its End User License Agreement. In order to have authorization, you need to select the ‘I agree to the terms of End User License Agreement’ checkbox and then click the ‘AGREE’ button.

End User License Agreement Page

Along with ‘Alaska Satellite Facility Data Access’, you must also authorize ‘Alaska Satellite Facility Data Access Egress Control’. Return to the search page to find this application.

egress_control_asf

Similar to the previous application, once you click ‘AUTHORIZE’, you will also select the ‘I agree to the terms of the End User License Agreement’ checkbox and click ‘AGREE’.

After these steps are done, you are then shown the Approved Applications page again and both of the desired applications should now be listed.

approved_asf_apps

Note that if Earthdata Login access is not granted to your target DAAC application, the following example will result in a 401-permission error.

Accessing Sentinel-1 Granule Data from the Alaska Satellite Facility (ASF)

Search for a granule using the searchGranule function (for more information on searching for granules, see Searching for Granules in MAAP). Then utilize the getData function, which downloads granule data if it doesn’t already exist locally. We can use getData to download the first result from our granule search into the file system and assign it to a variable (in this case download). Note that you will need to authorize the ‘Alaska Satellite Facility Data Access’ application before downloading any results from our search (see the above section for more information concerning authorizing applications).

Before downloading our data, we will also create a new data directory to download our files into using os.

[8]:
# set data directory
dataDir = './data'

# check if directory exists -> if directory doesn't exist, directory is created
if not os.path.exists(dataDir):
    os.mkdir(dataDir)
[9]:
# search for granule data using the short_name argument
results = maap.searchGranule(short_name='SENTINEL-1A_DP_GRD_HIGH')
# download first result
download = results[0].getData(dataDir)

Note that we can then use the print function to see the file name and directory.

[10]:
# print file directory
print(download)
./data/S1A_S3_GRDH_1SDH_20140615T034444_20140615T034512_001055_00107C_8977.zip

Accessing Harmonized Landsat Sentinel-2 (HLS) Level 3 Granule Data from the Land Processes Distributed Active Archive Center (LP DAAC)

We use a similar approach in order to access HLS Level 3 granule data. Note that this data is not cataloged by the MAAP’s CMR but we can use searchGranule’s cmr_host argument to specify a CMR instance external to MAAP.

[11]:
# search for granule data using CMR host name and short name arguments
results = maap.searchGranule(
    cmr_host='cmr.earthdata.nasa.gov',
    short_name='HLSL30')
# download first result
download = results[0].getData(dataDir)

As in the previous example, we can use the print function to see the file name and directory.

[12]:
# print file directory
print(download)
./data/HLS.L30.T59WPT.2013101T001445.v2.0.B09.tif