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 'api.ops.maap-project.org'
.
[1]:
# 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='api.ops.maap-project.org')
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 cmr.maap-project.org
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
).
[2]:
# search for granule data using CMR host name, collection concept ID, and Granule UR arguments
results = maap.searchGranule(
cmr_host='cmr.maap-project.org',
collection_concept_id='C1202028193-NASA_MAAP',
granule_ur='GEDI_L4A_AGB_Density_V2_1.GEDI04_A_2019107224731_O01958_01_T02638_02_002_02_V002.h5')
# 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.
[3]:
# print path to downloaded file
print(download)
/projects/local_data/GEDI04_A_2019107224731_O01958_01_T02638_02_002_02_V002.h5