88 nasa earth data
Searching and downloading NASA Earth science data products
Leafmap builds upon the earthaccess Python package to search and download NASA Earth science data products, making it easier visualize the footprints of the data products and download them interactively.
# %pip install leafmap earthaccess mapclassify
import leafmap
import pandas as pd
To download and access the data, you will need to create an Earthdata login. You can register for an account at urs.earthdata.nasa.gov.
leafmap.nasa_data_login()
You can search data by short name, doi, concept id, etc. You can find the list of NASA Earth science data products from the NASA-Earth-Data repo. The example below shows how to show the metadata of the 9,000+ NASA Earth science data products.
url = "https://github.com/opengeos/NASA-Earth-Data/raw/main/nasa_earth_data.tsv"
df = pd.read_csv(url, sep="\t")
df
To search data, specify the short name, bounding box, date range, etc. To return the footprints of the data, set return_gdf=True
.
results, gdf = leafmap.nasa_data_search(
short_name="GEDI_L4A_AGB_Density_V2_1_2056",
cloud_hosted=True,
bounding_box=(-73.9872, -33.7683, -34.7299, 5.2444),
temporal=("2020-07-01", "2020-07-31"),
count=-1, # use -1 to return all datasets
return_gdf=True,
)
Visualize the footprints of the data on an interactive map.
gdf.explore()
Download the data to your local drive. Let's download the first 5 data products.
leafmap.nasa_data_download(results[:5], out_dir="data")
Use the interactive GUI to search and download data.
from leafmap import leafmap
m = leafmap.Map()
m.add("nasa_earth_data")
m
To access the search results as a GeoDataFrame:
# m._NASA_DATA_GDF
To download the data:
# leafmap.nasa_data_download(m._NASA_DATA_RESULTS, out_dir="data")