Accessing Global Ecosystem Dynamics Investigation (GEDI) Level 4A Granule Data

In this example, we demonstrate how to access GEDI Level 4A granule data on the MAAP ADE.

Within your Jupyter Notebook, start by importing the maap package. Then invoke the MAAP constructor, setting the maap_host argument to ''.

# import os module
import os
# import the maap package to handle queries
from maap.maap import MAAP
# invoke the MAAP constructor using the maap_host argument
maap = MAAP(maap_host='')

Search for a granule using the searchGranule function (for more information on searching for granules, see Searching for Granules in MAAP). Note that we can use searchGranule’s cmr_host argument to specify as the CMR instance. 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 its local path to a variable (in this case download).

# search for granule data using CMR host name, collection concept ID, and Granule UR arguments
results = maap.searchGranule(
# download first result
local_dir = '/projects/local_data'  # Download directory (absolute path or relative to current directory)
os.makedirs(local_dir, exist_ok=True) # Create directories, as necessary
download = results[0].getData(local_dir)  # Default download directory is current directory, if no directory is given

We can then use the print function to see the file name and directory.

# print path to downloaded file