How do I find data using Python?

Here are our recommended approaches for finding data with Python, from the command line or a notebook.

In Python we can use the earthaccess library.

This example searches for data from the Land Processes DAAC with a spatial bounding box and temporal range.

## Import packages
import earthaccess
from earthaccess import DataGranules, DataCollections
from pprint import pprint 
## We'll get 4 collections that match with our keyword of interest
collections = DataCollections().keyword("REFLECTANCE").cloud_hosted(True).get(4)
## Let's print 2 collections
for collection in collections[0:2]:
    print(pprint(collection.summary()) , collection.abstract(), "\n")
{'cloud-info': {'Region': 'us-west-2',
                'S3BucketAndObjectPrefixNames': ['s3://lp-prod-protected/MOD09GA.061',
                                                 's3://lp-prod-public/MOD09GA.061'],
                'S3CredentialsAPIDocumentationURL': 'https://data.lpdaac.earthdatacloud.nasa.gov/s3credentialsREADME',
                'S3CredentialsAPIEndpoint': 'https://data.lpdaac.earthdatacloud.nasa.gov/s3credentials'},
 'concept-id': 'C2202497474-LPCLOUD',
 'file-type': "[{'Format': 'HDF-EOS2', 'FormatType': 'Native', 'Media': "
              "['HTTPS', 'Earthdata Cloud']}]",
 'get-data': ['https://e4ftl01.cr.usgs.gov/MOLT/MOD09GA.061/',
              'https://search.earthdata.nasa.gov/search/granules?p=C2202497474-LPCLOUD',
              'https://appeears.earthdatacloud.nasa.gov/',
              'https://earthexplorer.usgs.gov/'],
 'short-name': 'MOD09GA',
 'version': '061'}
None The MOD09GA Version 6.1 product provides an estimate of the surface spectral reflectance of Terra Moderate Resolution Imaging Spectroradiometer (MODIS) Bands 1 through 7, corrected for atmospheric conditions such as gasses, aerosols, and Rayleigh scattering. Provided along with the 500 meter (m) surface reflectance, observation, and quality bands are a set of ten 1 kilometer (km) observation bands and geolocation flags. The reflectance layers from the MOD09GA are used as the source data for many of the MODIS land products. 

Validation at stage 3 (https://modis-land.gsfc.nasa.gov/MODLAND_val.html) has been achieved for the MODIS Surface Reflectance products. Further details regarding MODIS land product validation for the MOD09 data product is available from the MODIS Land Team Validation site (https://modis-land.gsfc.nasa.gov/ValStatus.php?ProductID=MOD09).

 Improvements/Changes from Previous Versions

* The Version 6.1 Level-1B (L1B) products have been improved by undergoing various calibration changes that include: changes to the response-versus-scan angle (RVS) approach that affects reflectance bands for Aqua and Terra MODIS, corrections to adjust for the optical crosstalk in Terra MODIS infrared (IR) bands, and corrections to the Terra MODIS forward look-up table (LUT) update for the period 2012 - 2017.
* A polarization correction has been applied to the L1B Reflective Solar Bands (RSB).

 

{'cloud-info': {'Region': 'us-west-2',
                'S3BucketAndObjectPrefixNames': ['s3://lp-prod-protected/MOD09GQ.061',
                                                 's3://lp-prod-public/MOD09GQ.061'],
                'S3CredentialsAPIDocumentationURL': 'https://data.lpdaac.earthdatacloud.nasa.gov/s3credentialsREADME',
                'S3CredentialsAPIEndpoint': 'https://data.lpdaac.earthdatacloud.nasa.gov/s3credentials'},
 'concept-id': 'C2343115666-LPCLOUD',
 'file-type': "[{'Format': 'HDF-EOS2', 'FormatType': 'Native', 'Media': "
              "['HTTPS', 'Earthdata Cloud']}]",
 'get-data': ['https://e4ftl01.cr.usgs.gov/MOLT/MOD09GQ.061/',
              'https://search.earthdata.nasa.gov/search?q=C2343115666-LPCLOUD',
              'https://earthexplorer.usgs.gov/',
              'https://appeears.earthdatacloud.nasa.gov/'],
 'short-name': 'MOD09GQ',
 'version': '061'}
None The MOD09GQ Version 6.1 product provides an estimate of the surface spectral reflectance of Terra Moderate Resolution Imaging Spectroradiometer (MODIS) 250 meter (m) bands 1 and 2, corrected for atmospheric conditions such as gasses, aerosols, and Rayleigh scattering. Along with the 250 m surface reflectance bands are the Quality Assurance (QA) layer and five observation layers. This product is intended to be used in conjunction with the quality and viewing geometry information of the 500 m product (MOD09GA). 

Validation at stage 3 (https://modis-land.gsfc.nasa.gov/MODLAND_val.html) has been achieved for the MODIS Surface Reflectance products. Further details regarding MODIS land product validation for the MOD09 data product is available from the MODIS Land Team Validation site (https://modis-land.gsfc.nasa.gov/ValStatus.php?ProductID=MOD09).

Improvements/Changes from Previous Versions

* The Version 6.1 Level-1B (L1B) products have been improved by undergoing various calibration changes that include: changes to the response-versus-scan angle (RVS) approach that affects reflectance bands for Aqua and Terra MODIS, corrections to adjust for the optical crosstalk in Terra MODIS infrared (IR) bands, and corrections to the Terra MODIS forward look-up table (LUT) update for the period 2012 - 2017.
* A polarization correction has been applied to the L1B Reflective Solar Bands (RSB). 
## Search for files from the second dataset result over a small plot in Nebraska, USA for two weeks in September 2022
granules = earthaccess.search_data(concept_id = "C2021957657-LPCLOUD", 
                                   temporal = ("2022-09-10","2022-09-24"),
                                   bounding_box = (-101.67271,41.04754,-101.65344,41.06213))           
Granules found: 8