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.
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.
Alternatively, you can create a workspace using the “Workspaces” interface. See Create Workspace for more information.
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
# 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.
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.
Enter the desired application name within the search box and click the ‘SEARCH’ button. After this, a list of search results appears.
Once you find the desired application, click the ‘AUTHORIZE’ button next to the name.
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.
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.
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.
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
# 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)
# search for granule data using the short_name argument results = maap.searchGranule(short_name='SENTINEL-1A_DP_GRD_HIGH') # download first result download = results.getData(dataDir)
Note that we can then use the
# print file directory print(download)
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
cmr_host argument to specify a CMR instance external to MAAP.
# 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.getData(dataDir)
As in the previous example, we can use the
# print file directory print(download)